Class ArcRelabelledImmutableGraph
- java.lang.Object
-
- it.unimi.dsi.big.webgraph.ImmutableGraph
-
- it.unimi.dsi.big.webgraph.labelling.ArcLabelledImmutableGraph
-
- it.unimi.dsi.big.webgraph.labelling.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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceArcRelabelledImmutableGraph.LabelConversionStrategyA way to convert a label into another label.-
Nested classes/interfaces inherited from class it.unimi.dsi.big.webgraph.ImmutableGraph
ImmutableGraph.LoadMethod
-
-
Field Summary
Fields Modifier and Type Field Description static ArcRelabelledImmutableGraph.LabelConversionStrategyINT_LABEL_CONVERSION_STRATEGYA conversion strategy that converts between any two classes extendingAbstractIntLabel.-
Fields inherited from class it.unimi.dsi.big.webgraph.labelling.ArcLabelledImmutableGraph
UNDERLYINGGRAPH_PROPERTY_KEY, UNDERLYINGGRAPH_SUFFIX
-
Fields inherited from class it.unimi.dsi.big.webgraph.ImmutableGraph
GRAPHCLASS_PROPERTY_KEY, NUMBER_OF_THREADS_PROPERTY, PROPERTIES_EXTENSION
-
-
Constructor Summary
Constructors Constructor Description ArcRelabelledImmutableGraph(ArcLabelledImmutableGraph wrappedGraph, Label newLabelPrototype, ArcRelabelledImmutableGraph.LabelConversionStrategy conversionStrategy)Creates a relabelled graph with given label prototype.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ArcRelabelledImmutableGraphcopy()Returns a flyweight copy of this immutable graph.static voidmain(java.lang.String[] arg)ArcLabelledNodeIteratornodeIterator(long from)Returns a node iterator for scanning the graph sequentially, starting from the given node.longnumNodes()Returns the number of nodes of this graph.longoutdegree(long x)Returns the outdegree of a node.Labelprototype()Returns a prototype of the labels used by this graph.booleanrandomAccess()Checks whether this graph provides random access to successor lists.ArcLabelledNodeIterator.LabelledArcIteratorsuccessors(long x)Returns a lazy iterator over the successors of a given node.-
Methods inherited from class it.unimi.dsi.big.webgraph.labelling.ArcLabelledImmutableGraph
equals, labelBigArray, load, load, loadOffline, loadOffline, loadOnce, loadSequential, loadSequential, nodeIterator, toString
-
Methods inherited from class it.unimi.dsi.big.webgraph.ImmutableGraph
basename, hasCopiableIterators, hashCode, intNumNodes, load, loadMapped, loadMapped, numArcs, outdegrees, splitNodeIterators, store, store, successorBigArray, wrap, wrap
-
-
-
-
Field Detail
-
INT_LABEL_CONVERSION_STRATEGY
public static final ArcRelabelledImmutableGraph.LabelConversionStrategy INT_LABEL_CONVERSION_STRATEGY
A conversion strategy that converts between any two classes extendingAbstractIntLabel.
-
-
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
-
copy
public ArcRelabelledImmutableGraph copy()
Description copied from class:ImmutableGraphReturns a flyweight copy of this immutable graph.- Specified by:
copyin interfaceit.unimi.dsi.lang.FlyweightPrototype<ImmutableGraph>- Specified by:
copyin classArcLabelledImmutableGraph- Returns:
- a flyweight copy of this immutable graph.
- See Also:
FlyweightPrototype
-
nodeIterator
public ArcLabelledNodeIterator nodeIterator(long from)
Description copied from class:ArcLabelledImmutableGraphReturns a node iterator for scanning the graph sequentially, starting from the given node.- Overrides:
nodeIteratorin classArcLabelledImmutableGraph- Parameters:
from- the node from which the iterator will iterate.- Returns:
- an
ArcLabelledNodeIteratorfor accessing nodes, successors and their labels sequentially. - See Also:
ImmutableGraph.nodeIterator()
-
successors
public ArcLabelledNodeIterator.LabelledArcIterator successors(long x)
Description copied from class:ImmutableGraphReturns a lazy iterator over the successors of a given node. The iteration terminates when -1 is returned.- Specified by:
successorsin classArcLabelledImmutableGraph- Parameters:
x- a node.- Returns:
- a lazy iterator over the successors of the node.
-
prototype
public Label prototype()
Description copied from class:ArcLabelledImmutableGraphReturns 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:
prototypein classArcLabelledImmutableGraph- Returns:
- a prototype for the labels of this graph.
-
numNodes
public long numNodes()
Description copied from class:ImmutableGraphReturns the number of nodes of this graph.Albeit this method is not optional, it is allowed that this method throws an
UnsupportedOperationExceptionif this graph has never been entirely traversed using anode iterator. This apparently bizarre behaviour is necessary to support implementations asArcListASCIIGraph, which do not know the actual number of nodes until a traversal has been completed.- Specified by:
numNodesin classImmutableGraph- Returns:
- the number of nodes.
-
randomAccess
public boolean randomAccess()
Description copied from class:ImmutableGraphChecks whether this graph provides random access to successor lists.- Specified by:
randomAccessin classImmutableGraph- Returns:
- true if this graph provides random access to successor lists.
-
outdegree
public long outdegree(long x)
Description copied from class:ImmutableGraphReturns the outdegree of a node.- Specified by:
outdegreein classImmutableGraph- 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.JSAPExceptionjava.io.IOExceptionjava.lang.IllegalArgumentExceptionjava.lang.SecurityExceptionjava.lang.IllegalAccessExceptionjava.lang.reflect.InvocationTargetExceptionjava.lang.NoSuchMethodExceptionjava.lang.ClassNotFoundExceptionjava.lang.InstantiationException
-
-