it.unimi.di.mg4j.graph
Class DocumentSequenceImmutableGraph

java.lang.Object
  extended by it.unimi.dsi.webgraph.ImmutableGraph
      extended by it.unimi.dsi.webgraph.ImmutableSequentialGraph
          extended by 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).


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, PROPERTIES_EXTENSION
 
Constructor Summary
DocumentSequenceImmutableGraph(DocumentSequence sequence, int virtualField, VirtualDocumentResolver resolver)
          Creates an immutable graph from a sequence.
DocumentSequenceImmutableGraph(String... arg)
          Creates a new immutable graph with the specified arguments.
 
Method Summary
 ImmutableGraph copy()
           
 NodeIterator nodeIterator()
           
 int numNodes()
           
 boolean randomAccess()
           
 
Methods inherited from class it.unimi.dsi.webgraph.ImmutableSequentialGraph
nodeIterator, outdegree, successorArray
 
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
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

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
Method Detail

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