Class FileSourceNCol

All Implemented Interfaces:
FileSource, Source

public class FileSourceNCol
extends FileSourceBase
Reader for the "ncol" graph format.

The ncol graph format is a simple format where each line describes an edge by giving two node names and an optional third parameters giving the edge weight. The nodes are created implicitly.

Also, the format does not specify any direction for edges. By default all edges are undirected. It is specified in the format that you will never have directed edges and that the lines:

     node1Name node2Name
 
and
     node2Name node1Name
 
Cannot both appear at the same time in a file.

This format only contains edges. To ensure the "add node" events are sent before an edge referencing two nodes is created via an "add edge" event, this reader has a hash set of already encountered nodes. The hash set allows to issue "add node" events only when a node is encountered for the first time.

This hash set consumes memory, but is the only way to ensure "add node" events are correctly issued. If this input is directly connected to a graph, as graphs can create non-existing nodes automatically, you can disable the hash set of nodes using the constructor FileSourceNCol(boolean), and giving "false" for the first argument.

The usual file name extension for this format is ".ncol".