nl.uu.cs.treewidth.input
Class DgfReader

java.lang.Object
  extended by nl.uu.cs.treewidth.input.DgfReader
All Implemented Interfaces:
GraphInput

public class DgfReader
extends java.lang.Object
implements GraphInput

A GraphInput that can read the DIMACS graph file format called DGF.

Can read either from file or a given Reader.

Specification of the file format can be found in the docs directory of the SVN repository. The code of getInput is also well commented. (TODO Maybe an URL to docs?)

Example usage:

 GraphInput input = new DgfReader( "myGraph.dgf" );
 NGraph g = null;
 try {
     g = input.get();
 } catch (InputException e) { ... }
 

Author:
tw team

Nested Class Summary
 
Nested classes/interfaces inherited from interface nl.uu.cs.treewidth.input.GraphInput
GraphInput.InputData
 
Constructor Summary
DgfReader(java.io.Reader reader)
          Note:
DgfReader(java.lang.String filename)
          Note: the file will not be opened immediately, but in get().
 
Method Summary
 NGraph<GraphInput.InputData> get()
          Return a graph.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DgfReader

public DgfReader(java.lang.String filename)
Note: the file will not be opened immediately, but in get(). (This can be used to your advantage, but might come as a surprise.)

Parameters:
filename - The file to read.

DgfReader

public DgfReader(java.io.Reader reader)
Note:

Parameters:
reader - The Reader to read from.
Method Detail

get

public NGraph<GraphInput.InputData> get()
                                 throws InputException
Description copied from interface: GraphInput
Return a graph. Implementing classes will have additional interface to give meaning to this call.

Specified by:
get in interface GraphInput
Returns:
A graph; entirely up to implementing classes what to return.
Throws:
InputException