Package it.unimi.dsi.webgraph.scratch
Class GeneralizedDumbelGraph
java.lang.Object
it.unimi.dsi.webgraph.ImmutableGraph
it.unimi.dsi.webgraph.scratch.GeneralizedDumbelGraph
- All Implemented Interfaces:
it.unimi.dsi.lang.FlyweightPrototype<ImmutableGraph>
A graph with two parameters: a positive integer (k) and an integer value between 1 and k2. The graph is
bidirectional and made by two k-cliques with the specified number of edges in between them.
-
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
ConstructorsConstructorDescriptionGeneralizedDumbelGraph
(int k, int bridge) GeneralizedDumbelGraph
(String... strings) -
Method Summary
Modifier and TypeMethodDescriptioncopy()
Returns a flyweight copy of this immutable graph.static void
int
numNodes()
Returns the number of nodes of this graph.int
outdegree
(int x) Returns the outdegree of a node.boolean
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, hasCopiableIterators, hashCode, load, load, load, loadMapped, loadMapped, loadOffline, loadOffline, loadOnce, loadSequential, loadSequential, nodeIterator, nodeIterator, numArcs, outdegrees, splitNodeIterators, store, store, successors, toString
-
Constructor Details
-
GeneralizedDumbelGraph
public GeneralizedDumbelGraph(int k, int bridge) -
GeneralizedDumbelGraph
-
-
Method Details
-
copy
Description copied from class:ImmutableGraph
Returns a flyweight copy of this immutable graph.- 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:
-
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.
-
outdegree
public int outdegree(int 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.
-
successorArray
public int[] successorArray(int x) Description copied from class:ImmutableGraph
Returns a reference to an array containing the successors of a given node.The returned 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:
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.
-
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.
-
main
-