Package it.unimi.dsi.big.webgraph
Class UnionImmutableGraph
java.lang.Object
it.unimi.dsi.big.webgraph.ImmutableGraph
it.unimi.dsi.big.webgraph.UnionImmutableGraph
- All Implemented Interfaces:
FlyweightPrototype<ImmutableGraph>
An immutable graph representing the union of two given graphs. Here by “union”
we mean that an arc will belong to the union iff it belongs to at least one of the two graphs (the number of
nodes of the union is taken to be the maximum among the number of nodes of each graph).
-
Nested Class Summary
Nested classes/interfaces inherited from class it.unimi.dsi.big.webgraph.ImmutableGraph
ImmutableGraph.LoadMethod
-
Field Summary
Fields inherited from class it.unimi.dsi.big.webgraph.ImmutableGraph
GRAPHCLASS_PROPERTY_KEY, NUMBER_OF_THREADS_PROPERTY, PROPERTIES_EXTENSION
-
Constructor Summary
ConstructorDescriptionCreates the union of two given graphs. -
Method Summary
Modifier and TypeMethodDescriptioncopy()
Returns a flyweight copy of this immutable graph.boolean
Whether the node iterators returned by this graph supportNodeIterator.copy(long)
.nodeIterator
(long from) Returns a node iterator for scanning the graph sequentially, starting from the given node.long
numNodes()
Returns the number of nodes of this graph.long
outdegree
(long x) Returns the outdegree of a node.boolean
Checks whether this graph provides random access to successor lists.long[][]
successorBigArray
(long x) Returns a reference to a big array containing the successors of a given node.Methods inherited from class it.unimi.dsi.big.webgraph.ImmutableGraph
basename, equals, hashCode, intNumNodes, load, load, load, loadMapped, loadMapped, loadOffline, loadOffline, loadOnce, loadSequential, loadSequential, nodeIterator, numArcs, outdegrees, splitNodeIterators, store, store, successors, toString, wrap, wrap
-
Constructor Details
-
UnionImmutableGraph
Creates the union of two given graphs.- Parameters:
g0
- the first graph.g1
- the second graph.
-
-
Method Details
-
copy
Description copied from class:ImmutableGraph
Returns a flyweight copy of this immutable graph.- Specified by:
copy
in interfaceFlyweightPrototype<ImmutableGraph>
- Specified by:
copy
in classImmutableGraph
- Returns:
- a flyweight copy of this immutable graph.
- See Also:
-
nodeIterator
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.
-
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 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.
-
randomAccess
public boolean randomAccess()Description copied from class:ImmutableGraph
Checks whether this graph provides random access to successor lists.- Specified by:
randomAccess
in classImmutableGraph
- Returns:
- true if this graph provides random access to successor lists.
-
hasCopiableIterators
public boolean hasCopiableIterators()Description copied from class:ImmutableGraph
Whether the node iterators returned by this graph supportNodeIterator.copy(long)
.- Overrides:
hasCopiableIterators
in classImmutableGraph
- Returns:
- true if this graph provides copiable iterators.
-
successorBigArray
public long[][] successorBigArray(long x) Description copied from class:ImmutableGraph
Returns a reference to a big array containing the successors of a given node.The returned big array may contain more entries than the outdegree of
x
. However, only those with indices from 0 (inclusive) to the outdegree ofx
(exclusive) contain valid data.- Overrides:
successorBigArray
in classImmutableGraph
- Parameters:
x
- a node.- Returns:
- a big array whose first elements are the successors of the node; the array must not be modified by the caller.
-
outdegree
public long outdegree(long x) Description copied from class:ImmutableGraph
Returns the outdegree of a node.- Specified by:
outdegree
in classImmutableGraph
- Parameters:
x
- a node.- Returns:
- the outdegree of the given node.
-