Class ArcRelabelledImmutableGraph

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

    public class ArcRelabelledImmutableGraph
    extends ArcLabelledImmutableGraph
    Exhibits an arc-labelled immutable graph as another arc-labelled immutable graph changing only the kind of labels. Labels of the source graphs are mapped to labels of the exhibited graph via a suitable strategy provided at construction time.
    • Constructor Detail

      • ArcRelabelledImmutableGraph

        public ArcRelabelledImmutableGraph​(ArcLabelledImmutableGraph wrappedGraph,
                                           Label newLabelPrototype,
                                           ArcRelabelledImmutableGraph.LabelConversionStrategy conversionStrategy)
        Creates a relabelled graph with given label prototype.
        Parameters:
        wrappedGraph - the graph we are going to relabel.
        newLabelPrototype - the prototype for the new type of labels.
        conversionStrategy - the strategy to convert the labels of the wrapped graph into the new labels.
    • 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 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.
      • randomAccess

        public boolean randomAccess()
        Description copied from class: ImmutableGraph
        Checks whether this graph provides random access to successor lists.
        Specified by:
        randomAccess in class ImmutableGraph
        Returns:
        true if this graph provides random access to successor lists.
      • outdegree

        public int outdegree​(int x)
        Description copied from class: ImmutableGraph
        Returns the outdegree of a node.
        Specified by:
        outdegree in class ImmutableGraph
        Parameters:
        x - a node.
        Returns:
        the outdegree of the given node.
      • main

        public static void main​(java.lang.String[] arg)
                         throws com.martiansoftware.jsap.JSAPException,
                                java.io.IOException,
                                java.lang.IllegalArgumentException,
                                java.lang.SecurityException,
                                java.lang.IllegalAccessException,
                                java.lang.reflect.InvocationTargetException,
                                java.lang.NoSuchMethodException,
                                java.lang.ClassNotFoundException,
                                java.lang.InstantiationException
        Throws:
        com.martiansoftware.jsap.JSAPException
        java.io.IOException
        java.lang.IllegalArgumentException
        java.lang.SecurityException
        java.lang.IllegalAccessException
        java.lang.reflect.InvocationTargetException
        java.lang.NoSuchMethodException
        java.lang.ClassNotFoundException
        java.lang.InstantiationException