Class IntegerTriplesArcLabelledImmutableGraph

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

    public class IntegerTriplesArcLabelledImmutableGraph
    extends ArcLabelledImmutableSequentialGraph
    A class exposing a list of triples as an ArcLabelledImmutableGraph. The triples are interpreted as labelled arcs: the first element is the source, the second element is the target, and the third element must be a nonnegative integer that will be saved using a GammaCodedIntLabel.

    This class is mainly a useful example of how to expose of your data via an ArcLabelledImmutableGraph, and it is also used to build test cases, but it is not efficient or particularly refined.

    A main method reads from standard input a list of TAB-separated triples and writes the corresponding graph using BVGraph and BitStreamArcLabelledImmutableGraph.

    • Constructor Detail

      • IntegerTriplesArcLabelledImmutableGraph

        public IntegerTriplesArcLabelledImmutableGraph​(int[][] triple)
        Creates a new arc-labelled immutable graph using a specified list of triples.

        Note that it is impossible to specify isolated nodes with indices larger than the largest node with positive indegree or outdegree, as the number of nodes is computed by maximising over all indices in triple.

        Parameters:
        triple - a list of triples specifying labelled arcs (see the class documentation); order is not relevant, but multiple arcs are not allowed.
    • Method Detail

      • prototype

        public Label prototype()
        Description copied from class: ArcLabelledImmutableGraph
        Returns a prototype of the labels used by this graph. The prototype can be used to produce new copies, but must not be modified by the caller.
        Specified by:
        prototype in class ArcLabelledImmutableGraph
        Returns:
        a prototype for the labels of this graph.
      • numNodes

        public long 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.
      • main

        public static void main​(java.lang.String[] arg)
                         throws com.martiansoftware.jsap.JSAPException,
                                java.io.IOException
        Throws:
        com.martiansoftware.jsap.JSAPException
        java.io.IOException