Package edu.uci.ics.jung.io
Class PajekNetWriter<V,E>
java.lang.Object
edu.uci.ics.jung.io.PajekNetWriter<V,E>
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Saves the graph to the specified writer.void
save
(Graph<V, E> g, Writer w, com.google.common.base.Function<V, String> vs, com.google.common.base.Function<E, Number> nev) Saves the graph to the specified writer.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) Saves the graph to the specified writer.void
Saves the graph to the specified file.void
save
(Graph<V, E> g, String filename, com.google.common.base.Function<V, String> vs, com.google.common.base.Function<E, Number> nev) Saves the graph to the specified file.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) Saves the graph to the specified file.
-
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, throws IOExceptionString> vs, com.google.common.base.Function<E, Number> nev, com.google.common.base.Function<V, Point2D> vld) Saves the graph to the specified file.- Parameters:
g
- the graph to be savedfilename
- the filename of the file to write the graph tovs
- mapping from vertices to labelsnev
- mapping from edges to weightsvld
- 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, throws IOExceptionString> vs, com.google.common.base.Function<E, Number> nev) Saves the graph to the specified file.- Parameters:
g
- the graph to be savedfilename
- the filename of the file to write the graph tovs
- mapping from vertices to labelsnev
- mapping from edges to weights- Throws:
IOException
- if the graph cannot be saved
-
save
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 savedfilename
- the filename of the file to write the graph to- Throws:
IOException
- if the graph cannot be saved
-
save
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 savedw
- 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, throws IOExceptionString> vs, com.google.common.base.Function<E, Number> nev) Saves the graph to the specified writer.- Parameters:
g
- the graph to be savedw
- the writer instance to write the graph tovs
- mapping from vertices to labelsnev
- 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, throws IOExceptionString> vs, com.google.common.base.Function<E, Number> nev, com.google.common.base.Function<V, Point2D> vld) Saves the graph to the specified writer.- Parameters:
graph
- the graph to be savedw
- the writer instance to write the graph tovs
- 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
-