helix.graph.io
Class DimacsReader
java.lang.Object
helix.graph.io.AbstractGraphReader
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
DimacsReader
public DimacsReader(Reader reader,
GraphFactory factory)
- default constructor
DimacsReader
public DimacsReader(Reader reader,
GraphFactory factory,
Logger logger)
- constructor with logging addition
read
public Graph read()
throws IOException
- Specified by:
read
in interface GraphReader
- Specified by:
read
in class AbstractGraphReader
- Throws:
IOException