Package it.unimi.dsi.webgraph
Class ImmutableSequentialGraph
- java.lang.Object
-
- it.unimi.dsi.webgraph.ImmutableGraph
-
- it.unimi.dsi.webgraph.ImmutableSequentialGraph
-
- All Implemented Interfaces:
it.unimi.dsi.lang.FlyweightPrototype<ImmutableGraph>
- Direct Known Subclasses:
ArcListASCIIGraph
,ASCIIGraph
,CosinGraph
,ErdosRenyiGraph
,IncrementalImmutableSequentialGraph
,IntegerListImmutableGraph
,ScatteredArcsASCIIGraph
,Transform.BatchGraph
public abstract class ImmutableSequentialGraph extends ImmutableGraph
An abstract immutable graph that throws anUnsupportedOperationException
on all random-access methods.The main purpose of this class is to be used as a base for the numerous anonymous classes that do not support random access. Note that we override
ImmutableGraph
's implementation ofnodeIterator(int)
: here we just callImmutableGraph.nodeIterator()
and skip to the desired node. This makesnodeIterator()
andnodeIterator(0)
equivalent, which is usually what you want.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class it.unimi.dsi.webgraph.ImmutableGraph
ImmutableGraph.LoadMethod
-
-
Field Summary
-
Fields inherited from class it.unimi.dsi.webgraph.ImmutableGraph
GRAPHCLASS_PROPERTY_KEY, NUMBER_OF_THREADS_PROPERTY, PROPERTIES_EXTENSION
-
-
Constructor Summary
Constructors Constructor Description ImmutableSequentialGraph()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ImmutableGraph
copy()
Throws anUnsupportedOperationException
.NodeIterator
nodeIterator(int from)
Returns a node iterator for scanning the graph sequentially, starting from the given node.int
outdegree(int x)
Throws anUnsupportedOperationException
.boolean
randomAccess()
Returns false.int[]
successorArray(int x)
Throws anUnsupportedOperationException
.-
Methods inherited from class it.unimi.dsi.webgraph.ImmutableGraph
basename, equals, hasCopiableIterators, hashCode, load, load, load, loadMapped, loadMapped, loadOffline, loadOffline, loadOnce, loadSequential, loadSequential, nodeIterator, numArcs, numNodes, outdegrees, splitNodeIterators, store, store, successors, toString
-
-
-
-
Method Detail
-
successorArray
public int[] successorArray(int x)
Throws anUnsupportedOperationException
.- Overrides:
successorArray
in classImmutableGraph
- Parameters:
x
- a node.- Returns:
- an array whose first elements are the successors of the node; the array must not be modified by the caller.
-
outdegree
public int outdegree(int x)
Throws anUnsupportedOperationException
.- Specified by:
outdegree
in classImmutableGraph
- Parameters:
x
- a node.- Returns:
- the outdegree of the given node.
-
randomAccess
public boolean randomAccess()
Returns false.- Specified by:
randomAccess
in classImmutableGraph
- Returns:
- false.
-
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 classImmutableGraph
- Parameters:
from
- the node from which the iterator will iterate.- Returns:
- a
NodeIterator
for accessing nodes and successors sequentially.
-
copy
public ImmutableGraph copy()
Throws anUnsupportedOperationException
.- Specified by:
copy
in interfaceit.unimi.dsi.lang.FlyweightPrototype<ImmutableGraph>
- Specified by:
copy
in classImmutableGraph
- Returns:
- a flyweight copy of this immutable graph.
- See Also:
FlyweightPrototype
-
-