| 
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.uci.ics.jung.io.PajekNetReader<G,V,E>
public class PajekNetReader<G extends Graph<V,E>,V,E>
Reads a Graph from a Pajek NET formatted source.
 
 
If the edge constraints specify that the graph is strictly undirected,
 and an "*Arcs" section is encountered, or if the edge constraints specify that the 
 graph is strictly directed, and an "*Edges" section is encountered,
 an IllegalArgumentException is thrown.
If the edge constraints do not permit parallel edges, only the first encountered of a set of parallel edges will be read; subsequent edges in that set will be ignored.
More restrictive edge constraints will cause vertices to be generated that are more time- and space-efficient.
At the moment, only supports the part of the specification that defines:
 Here is an example format for a directed graph without edge weights 
 and edges specified in list form: 
 
*vertices <# of vertices> 1 "a" 2 "b" 3 "c" *arcslist 1 2 3 2 3Here is an example format for an undirected graph with edge weights and edges specified in non-list form:
*vertices <# of vertices> 1 "a" 2 "b" 3 "c" *edges 1 2 0.1 1 3 0.9 2 3 1.0
| Nested Class Summary | |
|---|---|
protected static class | 
PajekNetReader.ListTagPred
A Predicate which evaluates to true if the
 argument ends with the string "list". | 
protected static class | 
PajekNetReader.StartsWithPredicate
A Predicate which evaluates to true if the
 argument starts with the constructor-specified String. | 
| Field Summary | |
|---|---|
protected   | 
edge_factory
 | 
protected  SettableTransformer<E,Number> | 
edge_weights
 | 
protected static  | 
l_pred
 | 
protected   | 
vertex_factory
 | 
protected  SettableTransformer<V,String> | 
vertex_labels
The map for vertex labels (if any) created by this class.  | 
protected  SettableTransformer<V,Point2D> | 
vertex_locations
The map for vertex locations (if any) defined by this class.  | 
| Constructor Summary | |
|---|---|
PajekNetReader(
Creates a PajekNetReader instance with the specified edge factory, and whose vertex objects correspond to the integer IDs assigned in the file.  | 
|
PajekNetReader(
Creates a PajekNetReader instance with the specified vertex and edge factories.  | 
|
| Method Summary | |
|---|---|
protected  E | 
createAddEdge(StringTokenizer st,
              V v1,
              EdgeType directed,
              Graph<V,E> g,
              List<V> id,
              
 | 
 SettableTransformer<E,Number> | 
getEdgeWeightTransformer()
Returns a transformer from edges to their weights.  | 
 SettableTransformer<V,String> | 
getVertexLabeller()
Returns a transformer from vertices to their labels.  | 
 SettableTransformer<V,Point2D> | 
getVertexLocationTransformer()
 | 
 G | 
load(Reader reader,
     
Returns the graph created by parsing the specified reader, as created by the specified factory.  | 
 G | 
load(String filename,
     
Returns the graph created by parsing the specified file, as created by the specified factory.  | 
 void | 
setEdgeWeightTransformer(SettableTransformer<E,Number> edge_weights)
Provides a transformer which will be used to write out edge weights.  | 
 void | 
setVertexLabeller(SettableTransformer<V,String> vertex_labels)
Provides a transformer which will be used to write out the vertex labels.  | 
 void | 
setVertexLocationTransformer(SettableTransformer<V,Point2D> vertex_locations)
Provides a transformer which will be used to write out the vertex locations.  | 
protected  String | 
skip(BufferedReader br,
     
Returns the first line read from br for which p 
 returns true, or null if there is no
 such line. | 
| Methods inherited from class java.lang.Object | 
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Field Detail | 
|---|
protectedvertex_factory 
protectededge_factory 
protected SettableTransformer<V,String> vertex_labels
protected SettableTransformer<V,Point2D> vertex_locations
protected SettableTransformer<E,Number> edge_weights
protected static finall_pred 
| Constructor Detail | 
|---|
public PajekNetReader(vertex_factory, edge_factory) 
vertex_factory - the factory to use to create vertex objectsedge_factory - the factory to use to create edge objectspublic PajekNetReader(edge_factory) 
V to be assignment-compatible with
 an Integer value.
edge_factory - the factory to use to create edge objects| Method Detail | 
|---|
public G load(String filename,
               graph_factory)
                          throws IOException 
IOException
public G load(Reader reader,
               graph_factory)
                          throws IOException 
IOException
protected E createAddEdge(StringTokenizer st,
                          V v1,
                          EdgeType directed,
                          Graph<V,E> g,
                          List<V> id,
                           edge_factory) 
protected String skip(BufferedReader br,
                       p)
               throws IOException 
br for which p 
 returns true, or null if there is no
 such line.
IOExceptionpublic SettableTransformer<V,Point2D> getVertexLocationTransformer()
public void setVertexLocationTransformer(SettableTransformer<V,Point2D> vertex_locations)
public SettableTransformer<V,String> getVertexLabeller()
public void setVertexLabeller(SettableTransformer<V,String> vertex_labels)
public SettableTransformer<E,Number> getEdgeWeightTransformer()
public void setEdgeWeightTransformer(SettableTransformer<E,Number> edge_weights)
  | 
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||