helix.graph.io
Class DimacsReader

java.lang.Object
  extended by helix.graph.io.AbstractGraphReader
      extended by helix.graph.io.DimacsReader
All Implemented Interfaces:
GraphReader
Direct Known Subclasses:
DimacsExtendedReader

public class DimacsReader
extends AbstractGraphReader

Extended Dimacs format :
[c [comment]] : comment line : may appear anywhere
[p [label]] : problem line : label is kept in graph registry as Label
[n [label]]+ : vertex line : label is kept in vertex registry as Label
e index1 index2 [label] : edge line : indexi are 1-based index refereing to
vertices (see below). label is kept in edge registry as Label

note: the 'n' lines are optional (if you don't need to store anything in vertices) Vertices will be created as needed when reading the 'e index1 index2' lines.
However, for efficiency, it is advisable to put indices in decreasing order (i.e. higher values coming first).
If the 'n' lines are present, then the indices in 'e' lines refer to the order where vertices have been read (starting at 1 for the first vertex).

Author:
viari

Constructor Summary
DimacsReader(Reader reader, GraphFactory factory)
          default constructor
DimacsReader(Reader reader, GraphFactory factory, Logger logger)
          constructor with logging addition
 
Method Summary
 Graph read()
           
 
Methods inherited from class helix.graph.io.AbstractGraphReader
getLogger
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DimacsReader

public DimacsReader(Reader reader,
                    GraphFactory factory)
default constructor


DimacsReader

public DimacsReader(Reader reader,
                    GraphFactory factory,
                    Logger logger)
constructor with logging addition

Method Detail

read

public Graph read()
           throws IOException
Specified by:
read in interface GraphReader
Specified by:
read in class AbstractGraphReader
Throws:
IOException