Package it.unimi.dsi.webgraph.cosin
Class CosinGraph
java.lang.Object
it.unimi.dsi.webgraph.ImmutableGraph
it.unimi.dsi.webgraph.ImmutableSequentialGraph
it.unimi.dsi.webgraph.cosin.CosinGraph
- All Implemented Interfaces:
it.unimi.dsi.lang.FlyweightPrototype<ImmutableGraph>
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.
-
Nested Class Summary
Nested classes/interfaces inherited from class it.unimi.dsi.webgraph.ImmutableGraph
ImmutableGraph.LoadMethod
-
Field Summary
FieldsFields inherited from class it.unimi.dsi.webgraph.ImmutableGraph
GRAPHCLASS_PROPERTY_KEY, NUMBER_OF_THREADS_PROPERTY, PROPERTIES_EXTENSION
-
Method Summary
Modifier and TypeMethodDescriptionstatic ImmutableGraph
load
(CharSequence basename, it.unimi.dsi.logging.ProgressLogger pm) nodeIterator
(int from) Returns a node iterator for scanning the graph sequentially, starting from the given node.int
numNodes()
Returns the number of nodes of this graph.Methods inherited from class it.unimi.dsi.webgraph.ImmutableSequentialGraph
copy, outdegree, randomAccess, successorArray
Methods inherited from class it.unimi.dsi.webgraph.ImmutableGraph
basename, equals, hasCopiableIterators, hashCode, load, load, loadMapped, loadMapped, loadOffline, loadOffline, loadOnce, loadSequential, loadSequential, nodeIterator, numArcs, outdegrees, splitNodeIterators, store, store, successors, toString
-
Field Details
-
ASSERTS
public static final boolean ASSERTS- See Also:
-
-
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 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:
numNodes
in classImmutableGraph
- Returns:
- the number of nodes.
-
nodeIterator
Description copied from class:ImmutableGraph
Returns a node iterator for scanning the graph sequentially, starting from the given node.- Overrides:
nodeIterator
in classImmutableSequentialGraph
- Parameters:
from
- the node from which the iterator will iterate.- Returns:
- a
NodeIterator
for accessing nodes and successors sequentially.
-
load
-