netkit.graph.io
Class EdgeReaderRN

java.lang.Object
  extended by netkit.graph.io.EdgeReaderRN

public final class EdgeReaderRN
extends java.lang.Object

This class reads in Edge data in RN format. The input format is line oriented and organized into columns. There are three comma separated column elements per line. The first two elements are names of Nodes in the Graph object which are to be connected via an Edge. The third element is a weight for the connecting Edge. In directed Graphs, all Edges in the file use the same single EdgeType. However undirected Graphs have two EdgeTypes, one for each Edge direction. Lines may contain comments which are lines where a '%' or '#' is the first character. Comments are terminated by the end-of-line.

Author:
Kaveh R. Ghazi
See Also:
SchemaReader, EdgeWriterRN, Graph, Node, Edge, EdgeType

Constructor Summary
EdgeReaderRN()
           
 
Method Summary
static void readEdges(java.io.Reader reader, Graph graph, EdgeType et1, EdgeType et2)
          Reads Edges from the supplied Reader and creates the corresponding Edges in the Graph; Edges are validated by the the supplied EdgeTypes and the Nodes these Edges refer to must already exist in the Graph.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EdgeReaderRN

public EdgeReaderRN()
Method Detail

readEdges

public static void readEdges(java.io.Reader reader,
                             Graph graph,
                             EdgeType et1,
                             EdgeType et2)
Reads Edges from the supplied Reader and creates the corresponding Edges in the Graph; Edges are validated by the the supplied EdgeTypes and the Nodes these Edges refer to must already exist in the Graph.

Parameters:
reader - a Reader object containing Edge instances for the graph.
graph - a Graph object into which Edges will be inserted.
et1 - an EdgeType for Edges read from the Reader.
et2 - if not null, an EdgeType for reversed Edges read from Reader; used in undirected graphs.
Throws:
java.lang.RuntimeException - if any of the format constraints of the input are violated.