Class CosinGraph

All Implemented Interfaces:
it.unimi.dsi.lang.FlyweightPrototype<ImmutableGraph>

public class CosinGraph extends ImmutableSequentialGraph
Exposes a COSIN graph as an (offline-only) immutable graph.

This class implements just ImmutableGraph.nodeIterator(), and cannot not be used for random or sequential access.

Note that the COSIN graph must be contained in a single file (you can simply cat the various pieces if necessary). Moreover, this class assumes that successors lists are stored contiguously and in order in the successors file.

  • Field Details

  • Method Details

    • numNodes

      public int numNodes()
      Description copied from class: ImmutableGraph
      Returns the number of nodes of this graph.

      Albeit this method is not optional, it is allowed that this method throws an UnsupportedOperationException if this graph has never been entirely traversed using a node iterator. This apparently bizarre behaviour is necessary to support implementations as ArcListASCIIGraph, which do not know the actual number of nodes until a traversal has been completed.

      Specified by:
      numNodes in class ImmutableGraph
      Returns:
      the number of nodes.
    • nodeIterator

      public NodeIterator nodeIterator(int from)
      Description copied from class: ImmutableGraph
      Returns a node iterator for scanning the graph sequentially, starting from the given node.
      Overrides:
      nodeIterator in class ImmutableSequentialGraph
      Parameters:
      from - the node from which the iterator will iterate.
      Returns:
      a NodeIterator for accessing nodes and successors sequentially.
    • load

      public static ImmutableGraph load(CharSequence basename, it.unimi.dsi.logging.ProgressLogger pm)