|
|||||||||
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.labelling.ArcLabelledImmutableGraph
it.unimi.dsi.webgraph.labelling.ArcLabelledImmutableSequentialGraph
it.unimi.dsi.webgraph.examples.IntegerTriplesArcLabelledImmutableGraph
public class IntegerTriplesArcLabelledImmutableGraph
A class exposing a list of triples as an ArcLabelledImmutableGraph
. The triples are
interpreted as labelled arcs: the first element is the source, the second element is the target,
and the third element must be a nonnegative integer that will be saved using a GammaCodedIntLabel
.
This class is mainly a useful example of how to expose of your data via an ArcLabelledImmutableGraph
, and
it is also used to build test cases, but it is not efficient or particularly refined.
A main method reads from standard input a list of TAB-separated triples and writes the corresponding graph
using BVGraph
and BitStreamArcLabelledImmutableGraph
.
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.labelling.ArcLabelledImmutableGraph |
---|
UNDERLYINGGRAPH_PROPERTY_KEY, UNDERLYINGGRAPH_SUFFIX |
Fields inherited from class it.unimi.dsi.webgraph.ImmutableGraph |
---|
GRAPHCLASS_PROPERTY_KEY, PROPERTIES_EXTENSION |
Constructor Summary | |
---|---|
IntegerTriplesArcLabelledImmutableGraph(int[][] triple)
Creates a new arc-labelled immutable graph using a specified list of triples. |
Method Summary | |
---|---|
static void |
main(String[] arg)
|
ArcLabelledNodeIterator |
nodeIterator()
Returns a node iterator for scanning the graph sequentially, starting from the first node. |
ArcLabelledNodeIterator |
nodeIterator(int from)
Throws an UnsupportedOperationException . |
int |
numNodes()
Returns the number of nodes of this graph. |
Label |
prototype()
Returns a prototype of the labels used by this graph. |
Methods inherited from class it.unimi.dsi.webgraph.labelling.ArcLabelledImmutableSequentialGraph |
---|
copy, labelArray, outdegree, randomAccess, successorArray, successors |
Methods inherited from class it.unimi.dsi.webgraph.labelling.ArcLabelledImmutableGraph |
---|
equals, load, load, loadOffline, loadOffline, loadOnce, loadSequential, loadSequential, toString |
Methods inherited from class it.unimi.dsi.webgraph.ImmutableGraph |
---|
basename, hashCode, load, loadMapped, loadMapped, numArcs, outdegrees, store, store |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public IntegerTriplesArcLabelledImmutableGraph(int[][] triple)
Note that it is impossible to specify isolated nodes with indices larger than
the largest node with positive indegree or outdegree, as the number of nodes is computed
by maximising over all indices in triple
.
triple
- a list of triples specifying labelled arcs (see the class documentation);
order is not relevant, but multiple arcs are not allowed.Method Detail |
---|
public Label prototype()
ArcLabelledImmutableGraph
prototype
in class ArcLabelledImmutableGraph
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 ArcLabelledNodeIterator nodeIterator(int from)
ArcLabelledImmutableSequentialGraph
UnsupportedOperationException
.
nodeIterator
in class ArcLabelledImmutableSequentialGraph
from
- the node from which the iterator will iterate.
ArcLabelledNodeIterator
for accessing nodes, successors and their labels sequentially.ImmutableGraph.nodeIterator()
public ArcLabelledNodeIterator nodeIterator()
ImmutableGraph
nodeIterator
in class ArcLabelledImmutableGraph
NodeIterator
for accessing nodes and successors sequentially.public static void main(String[] arg) throws JSAPException, IOException
JSAPException
IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |