Package it.unimi.di.big.mg4j.util
Class DocumentSequenceImmutableSequentialGraph
- java.lang.Object
-
- it.unimi.dsi.big.webgraph.ImmutableGraph
-
- it.unimi.dsi.big.webgraph.ImmutableSequentialGraph
-
- it.unimi.di.big.mg4j.util.DocumentSequenceImmutableSequentialGraph
-
- All Implemented Interfaces:
FlyweightPrototype<it.unimi.dsi.big.webgraph.ImmutableGraph>
public class DocumentSequenceImmutableSequentialGraph extends it.unimi.dsi.big.webgraph.ImmutableSequentialGraph
Exposes a document sequence as a (sequentially accessible) immutable graph, according to some virtual field provided by the documents in the sequence. A suitableVirtualDocumentResolver
is used to associate node numbers to each fragment.More precisely, the graph will have as many nodes as there are documents in the sequence, the k-th document (starting from 0) representing node number k. The successors of a document are obtained by extracting the virtual field from the document, turning each document specifier into a document number (using the given resolver, and discarding unresolved URLs).
Note that the current implementation does not support more than
Integer.MAX_VALUE
successors per node.
-
-
Constructor Summary
Constructors Constructor Description DocumentSequenceImmutableSequentialGraph(DocumentSequence sequence, String fieldName, VirtualDocumentResolver resolver)
Creates an immutable graph from a sequence.DocumentSequenceImmutableSequentialGraph(String... arg)
Creates a new immutable graph with the specified arguments.
-
Method Summary
Modifier and Type Method Description it.unimi.dsi.big.webgraph.ImmutableGraph
copy()
it.unimi.dsi.big.webgraph.NodeIterator
nodeIterator()
long
numNodes()
boolean
randomAccess()
-
Methods inherited from class it.unimi.dsi.big.webgraph.ImmutableSequentialGraph
outdegree, successorBigArray
-
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, store, store, successors, toString, wrap, wrap
-
-
-
-
Constructor Detail
-
DocumentSequenceImmutableSequentialGraph
public DocumentSequenceImmutableSequentialGraph(DocumentSequence sequence, String fieldName, VirtualDocumentResolver resolver)
Creates an immutable graph from a sequence.- Parameters:
sequence
- the sequence whence the immutable graph should be created.fieldName
- the name of the virtual field to be used to get the successors.resolver
- the resolver to be used to map document specs to node numbers.
-
DocumentSequenceImmutableSequentialGraph
public DocumentSequenceImmutableSequentialGraph(String... arg) throws IOException, ClassNotFoundException, IllegalArgumentException, IllegalAccessException, InvocationTargetException, InstantiationException, NoSuchMethodException
Creates a new immutable graph with the specified arguments.- Parameters:
arg
- a 3-element array: the first is aspecification
of aDocumentSequence
, the second is the name of a virtual field, and the third is the filename of aVirtualDocumentResolver
.- Throws:
IOException
ClassNotFoundException
IllegalArgumentException
IllegalAccessException
InvocationTargetException
InstantiationException
NoSuchMethodException
-
-
Method Detail
-
copy
public it.unimi.dsi.big.webgraph.ImmutableGraph copy()
- Specified by:
copy
in interfaceFlyweightPrototype<it.unimi.dsi.big.webgraph.ImmutableGraph>
- Overrides:
copy
in classit.unimi.dsi.big.webgraph.ImmutableSequentialGraph
-
numNodes
public long numNodes()
- Specified by:
numNodes
in classit.unimi.dsi.big.webgraph.ImmutableGraph
-
randomAccess
public boolean randomAccess()
- Overrides:
randomAccess
in classit.unimi.dsi.big.webgraph.ImmutableSequentialGraph
-
nodeIterator
public it.unimi.dsi.big.webgraph.NodeIterator nodeIterator()
- Overrides:
nodeIterator
in classit.unimi.dsi.big.webgraph.ImmutableGraph
-
-