Class PajekNetWriter<V,E>

java.lang.Object
edu.uci.ics.jung.io.PajekNetWriter<V,E>

public class PajekNetWriter<V,E> extends Object
Writes graphs in the Pajek NET format.

Labels for vertices, edge weights, and vertex locations may each optionally be specified. Note that vertex location coordinates must be normalized to the interval [0, 1] on each axis in order to conform to the Pajek specification.

  • Constructor Details

    • PajekNetWriter

      public PajekNetWriter()
      Creates a new instance.
  • Method Details

    • save

      public void save(Graph<V,E> g, String filename, com.google.common.base.Function<V,String> vs, com.google.common.base.Function<E,Number> nev, com.google.common.base.Function<V,Point2D> vld) throws IOException
      Saves the graph to the specified file.
      Parameters:
      g - the graph to be saved
      filename - the filename of the file to write the graph to
      vs - mapping from vertices to labels
      nev - mapping from edges to weights
      vld - mapping from vertices to locations
      Throws:
      IOException - if the graph cannot be saved
    • save

      public void save(Graph<V,E> g, String filename, com.google.common.base.Function<V,String> vs, com.google.common.base.Function<E,Number> nev) throws IOException
      Saves the graph to the specified file.
      Parameters:
      g - the graph to be saved
      filename - the filename of the file to write the graph to
      vs - mapping from vertices to labels
      nev - mapping from edges to weights
      Throws:
      IOException - if the graph cannot be saved
    • save

      public void save(Graph<V,E> g, String filename) throws IOException
      Saves the graph to the specified file. No vertex labels are written, and the edge weights are written as 1.0.
      Parameters:
      g - the graph to be saved
      filename - the filename of the file to write the graph to
      Throws:
      IOException - if the graph cannot be saved
    • save

      public void save(Graph<V,E> g, Writer w) throws IOException
      Saves the graph to the specified writer. No vertex labels are written, and the edge weights are written as 1.0.
      Parameters:
      g - the graph to be saved
      w - the writer instance to write the graph to
      Throws:
      IOException - if the graph cannot be saved
    • save

      public void save(Graph<V,E> g, Writer w, com.google.common.base.Function<V,String> vs, com.google.common.base.Function<E,Number> nev) throws IOException
      Saves the graph to the specified writer.
      Parameters:
      g - the graph to be saved
      w - the writer instance to write the graph to
      vs - mapping from vertices to labels
      nev - mapping from edges to weights
      Throws:
      IOException - if the graph cannot be saved
    • save

      public void save(Graph<V,E> graph, Writer w, com.google.common.base.Function<V,String> vs, com.google.common.base.Function<E,Number> nev, com.google.common.base.Function<V,Point2D> vld) throws IOException
      Saves the graph to the specified writer.
      Parameters:
      graph - the graph to be saved
      w - the writer instance to write the graph to
      vs - mapping from vertices to labels (no labels are written if null)
      nev - mapping from edges to weights (defaults to weights of 1.0 if null)
      vld - mapping from vertices to locations (no locations are written if null)
      Throws:
      IOException - if the graph cannot be saved