it.unimi.di.mg4j.graph
Class DocumentSequenceImmutableGraph
java.lang.Object
it.unimi.dsi.webgraph.ImmutableGraph
it.unimi.dsi.webgraph.ImmutableSequentialGraph
it.unimi.di.mg4j.graph.DocumentSequenceImmutableGraph
- All Implemented Interfaces:
- FlyweightPrototype<ImmutableGraph>
public class DocumentSequenceImmutableGraph
- extends ImmutableSequentialGraph
Exposes a document sequence as a (sequentially accessible) immutable graph, according to some
virtual field provided by the documents in the sequence. A suitable VirtualDocumentResolver
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).
Methods inherited from class it.unimi.dsi.webgraph.ImmutableGraph |
basename, equals, hashCode, load, load, load, loadMapped, loadMapped, loadOffline, loadOffline, loadOnce, loadSequential, loadSequential, numArcs, outdegrees, store, store, successors, toString |
DocumentSequenceImmutableGraph
public DocumentSequenceImmutableGraph(DocumentSequence sequence,
int virtualField,
VirtualDocumentResolver resolver)
- Creates an immutable graph from a sequence.
- Parameters:
sequence
- the sequence whence the immutable graph should be created.virtualField
- the number of the virtual field to be used to get the successors from.resolver
- the resolver to be used to map document specs to node numbers.
DocumentSequenceImmutableGraph
public DocumentSequenceImmutableGraph(String... arg)
throws IOException,
ClassNotFoundException
- Creates a new immutable graph with the specified arguments.
- Parameters:
arg
- a 3-element array: the first is the basename of a DocumentSequence
, the second is an integer specifying the virtual
field number, the third is the basename of a VirtualDocumentResolver
.
- Throws:
IOException
ClassNotFoundException
copy
public ImmutableGraph copy()
- Specified by:
copy
in interface FlyweightPrototype<ImmutableGraph>
- Overrides:
copy
in class ImmutableSequentialGraph
numNodes
public int numNodes()
- Specified by:
numNodes
in class ImmutableGraph
randomAccess
public boolean randomAccess()
- Overrides:
randomAccess
in class ImmutableSequentialGraph
nodeIterator
public NodeIterator nodeIterator()
- Overrides:
nodeIterator
in class ImmutableGraph