|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectit.unimi.dsi.webgraph.ImmutableGraph
it.unimi.dsi.webgraph.UnionImmutableGraph
public class UnionImmutableGraph
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.webgraph.ImmutableGraph |
---|
ImmutableGraph.LoadMethod |
Field Summary |
---|
Fields inherited from class it.unimi.dsi.webgraph.ImmutableGraph |
---|
GRAPHCLASS_PROPERTY_KEY, PROPERTIES_EXTENSION |
Constructor Summary | |
---|---|
protected |
UnionImmutableGraph(ImmutableGraph g0,
ImmutableGraph g1)
Creates the union of two given graphs. |
Method Summary | |
---|---|
UnionImmutableGraph |
copy()
Returns a flyweight copy of this immutable graph. |
NodeIterator |
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. |
int |
outdegree(int x)
Returns the outdegree of a node. |
boolean |
randomAccess()
Checks whether this graph provides random access to successor lists. |
int[] |
successorArray(int x)
Returns a reference to an array containing the successors of a given node. |
Methods inherited from class it.unimi.dsi.webgraph.ImmutableGraph |
---|
basename, equals, hashCode, load, load, load, loadMapped, loadMapped, loadOffline, loadOffline, loadOnce, loadSequential, loadSequential, nodeIterator, numArcs, outdegrees, store, store, successors, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
protected UnionImmutableGraph(ImmutableGraph g0, ImmutableGraph g1)
g0
- the first graph.g1
- the second graph.Method Detail |
---|
public UnionImmutableGraph copy()
ImmutableGraph
copy
in interface FlyweightPrototype<ImmutableGraph>
copy
in class ImmutableGraph
FlyweightPrototype
public NodeIterator nodeIterator(int from)
ImmutableGraph
This implementation just calls the random-access methods (ImmutableGraph.successors(int)
and
ImmutableGraph.outdegree(int)
). More specific implementations may choose to maintain some extra state
to make the enumeration more efficient.
nodeIterator
in class ImmutableGraph
from
- the node from which the iterator will iterate.
NodeIterator
for accessing nodes and successors sequentially.public int numNodes()
ImmutableGraph
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.
numNodes
in class ImmutableGraph
public boolean randomAccess()
ImmutableGraph
randomAccess
in class ImmutableGraph
public int[] successorArray(int x)
ImmutableGraph
The returned array may contain more entries than the outdegree of x
.
However, only those with indices from 0 (inclusive) to the outdegree of x
(exclusive)
contain valid data.
This implementation just unwraps the iterator returned by ImmutableGraph.successors(int)
. Subclasses
are encouraged to override this implementation.
Warning: all implementations must guarantee that a distinct array is returned for each node. The caller, in turn, must treat the array as a read-only object.
successorArray
in class ImmutableGraph
x
- a node.
public int outdegree(int x)
ImmutableGraph
outdegree
in class ImmutableGraph
x
- a node.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |