Class IntegerListImmutableGraph
- java.lang.Object
-
- it.unimi.dsi.big.webgraph.ImmutableGraph
-
- it.unimi.dsi.big.webgraph.ImmutableSequentialGraph
-
- it.unimi.dsi.big.webgraph.examples.IntegerListImmutableGraph
-
- All Implemented Interfaces:
it.unimi.dsi.lang.FlyweightPrototype<ImmutableGraph>
public class IntegerListImmutableGraph extends ImmutableSequentialGraph
Exposes a graph in a simple binary format as an (offline-only)ImmutableGraph.This class is a simple example that should help in understanding how to interface WebGraph with external data. We have a graph contained in a file and represented by a list of binary 32-bit integers as follows: first we have the number of nodes, then the number of successors of node 0, then the list in increasing order of successors of node 0, then the number of successors of node 1, then the list in increasing order of successors of node 1, and so on.
If we want to transform this graph into, say, a
BVGraph, we must create a class that exposes the file as anImmutableGraphand than save it usingBVGraph.store(ImmutableGraph,CharSequence)or by calling the main method ofBVGraph. A complete implementation is not necessary, asBVGraphuses justnodeIterator(). Since we are just interesting in importing data, we do not implement efficient random access methods, and the only loading method we implement isloadOffline(CharSequence).
-
-
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
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static ImmutableGraphload(java.lang.CharSequence basename)static ImmutableGraphload(java.lang.CharSequence basename, it.unimi.dsi.logging.ProgressLogger pl)static ImmutableGraphloadOffline(java.lang.CharSequence basename)static ImmutableGraphloadOffline(java.lang.CharSequence basename, it.unimi.dsi.logging.ProgressLogger pl)static ImmutableGraphloadSequential(java.lang.CharSequence basename)Deprecated.static ImmutableGraphloadSequential(java.lang.CharSequence basename, it.unimi.dsi.logging.ProgressLogger pl)Deprecated.NodeIteratornodeIterator()Returns a node iterator for scanning the graph sequentially, starting from the first node.longnumNodes()Returns the number of nodes of this graph.-
Methods inherited from class it.unimi.dsi.big.webgraph.ImmutableSequentialGraph
copy, nodeIterator, outdegree, randomAccess, successorBigArray
-
Methods inherited from class it.unimi.dsi.big.webgraph.ImmutableGraph
basename, equals, hasCopiableIterators, hashCode, intNumNodes, load, loadMapped, loadMapped, loadOnce, numArcs, outdegrees, splitNodeIterators, store, store, successors, toString, wrap, wrap
-
-
-
-
Method Detail
-
numNodes
public long numNodes()
Description copied from class:ImmutableGraphReturns the number of nodes of this graph.Albeit this method is not optional, it is allowed that this method throws an
UnsupportedOperationExceptionif 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:
numNodesin classImmutableGraph- Returns:
- the number of nodes.
-
nodeIterator
public NodeIterator nodeIterator()
Description copied from class:ImmutableGraphReturns a node iterator for scanning the graph sequentially, starting from the first node.- Overrides:
nodeIteratorin classImmutableGraph- Returns:
- a
NodeIteratorfor accessing nodes and successors sequentially.
-
load
public static ImmutableGraph load(java.lang.CharSequence basename, it.unimi.dsi.logging.ProgressLogger pl)
-
load
public static ImmutableGraph load(java.lang.CharSequence basename)
-
loadSequential
@Deprecated public static ImmutableGraph loadSequential(java.lang.CharSequence basename, it.unimi.dsi.logging.ProgressLogger pl)
Deprecated.
-
loadSequential
@Deprecated public static ImmutableGraph loadSequential(java.lang.CharSequence basename)
Deprecated.
-
loadOffline
public static ImmutableGraph loadOffline(java.lang.CharSequence basename, it.unimi.dsi.logging.ProgressLogger pl) throws java.io.IOException
- Throws:
java.io.IOException
-
loadOffline
public static ImmutableGraph loadOffline(java.lang.CharSequence basename) throws java.io.IOException
- Throws:
java.io.IOException
-
-