es.yrbcn.graph.weighted
Class WeightedBVGraph

java.lang.Object
  extended by it.unimi.dsi.webgraph.ImmutableGraph
      extended by it.unimi.dsi.webgraph.labelling.ArcLabelledImmutableGraph
          extended by it.unimi.dsi.webgraph.labelling.ArcLabelledImmutableSequentialGraph
              extended by es.yrbcn.graph.weighted.WeightedBVGraph
All Implemented Interfaces:
it.unimi.dsi.lang.FlyweightPrototype<ImmutableGraph>

public class WeightedBVGraph
extends ArcLabelledImmutableSequentialGraph

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
static org.apache.log4j.Logger LOGGER
           
 
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
WeightedBVGraph(WeightedArc[] arclist)
          Creates a new arc-labelled immutable graph using a specified list of triples.
 
Method Summary
static void main(String[] arg)
           
 ArcLabelledNodeIterator nodeIterator()
           
 ArcLabelledNodeIterator nodeIterator(int from)
           
 int numNodes()
           
 Label prototype()
           
 
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, numArcs, store, store
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

LOGGER

public static final org.apache.log4j.Logger LOGGER
Constructor Detail

WeightedBVGraph

public WeightedBVGraph(WeightedArc[] arclist)
Creates a new arc-labelled immutable graph using a specified list of triples.

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.

Parameters:
arclist - a list of triples specifying labelled arcs (see the class documentation); order is not relevant, but multiple arcs are not allowed.
Method Detail

prototype

public Label prototype()
Specified by:
prototype in class ArcLabelledImmutableGraph

numNodes

public int numNodes()
Specified by:
numNodes in class ImmutableGraph

nodeIterator

public ArcLabelledNodeIterator nodeIterator(int from)
Overrides:
nodeIterator in class ArcLabelledImmutableSequentialGraph

nodeIterator

public ArcLabelledNodeIterator nodeIterator()
Overrides:
nodeIterator in class ArcLabelledImmutableGraph

main

public static void main(String[] arg)
                 throws JSAPException,
                        IOException
Throws:
JSAPException
IOException