it.unimi.dsi.webgraph
Class ShiftedByOneArcListASCIIGraph

java.lang.Object
  extended by it.unimi.dsi.webgraph.ImmutableGraph
      extended by it.unimi.dsi.webgraph.ImmutableSequentialGraph
          extended by it.unimi.dsi.webgraph.ArcListASCIIGraph
              extended by it.unimi.dsi.webgraph.ShiftedByOneArcListASCIIGraph
All Implemented Interfaces:
FlyweightPrototype<ImmutableGraph>

public final class ShiftedByOneArcListASCIIGraph
extends ArcListASCIIGraph

An ArcListASCIIGraph with fixed shift -1. Very useful to read graphs specified as pairs of arcs with node numbering starting from one.

Using ArcListASCIIGraph with MatLab-like sparse matrix files

The main intended usage of this class is that of interfacing easily with MatLab-like sparse matrix files. Note that for this to happen it is necessary to shift by one all indices. Assume you have a file named example.arcs:

  1 2
  2 3
  3 2
  
Then, the command
  java it.unimi.dsi.webgraph.BVGraph -1 -g ShiftedByOneArcListASCIIGraph dummy bvexample <example.arcs
  
will generate a BVGraph as expected (e.g, there is an arc from 0 to 1).


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
protected ShiftedByOneArcListASCIIGraph(InputStream is, int shift)
           
 
Method Summary
static ImmutableGraph load(CharSequence basename)
           
static ImmutableGraph load(CharSequence basename, ProgressLogger unused)
           
static ImmutableGraph loadOffline(CharSequence basename)
           
static ImmutableGraph loadOffline(CharSequence basename, ProgressLogger unused)
           
static ArcListASCIIGraph loadOnce(InputStream is)
           
static ImmutableGraph loadSequential(CharSequence basename)
           
static ImmutableGraph loadSequential(CharSequence basename, ProgressLogger unused)
           
static void store(ImmutableGraph graph, CharSequence basename, ProgressLogger unused)
           
 
Methods inherited from class it.unimi.dsi.webgraph.ArcListASCIIGraph
loadOnce, main, nodeIterator, numNodes, store, store
 
Methods inherited from class it.unimi.dsi.webgraph.ImmutableSequentialGraph
copy, outdegree, randomAccess, successorArray
 
Methods inherited from class it.unimi.dsi.webgraph.ImmutableGraph
basename, equals, hashCode, load, loadMapped, loadMapped, nodeIterator, numArcs, outdegrees, store, store, successors, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ShiftedByOneArcListASCIIGraph

protected ShiftedByOneArcListASCIIGraph(InputStream is,
                                        int shift)
                                 throws NumberFormatException,
                                        IOException
Throws:
NumberFormatException
IOException
Method Detail

loadSequential

public static ImmutableGraph loadSequential(CharSequence basename)
                                     throws IOException
Throws:
IOException

loadSequential

public static ImmutableGraph loadSequential(CharSequence basename,
                                            ProgressLogger unused)
                                     throws IOException
Throws:
IOException

loadOffline

public static ImmutableGraph loadOffline(CharSequence basename)
                                  throws IOException
Throws:
IOException

loadOffline

public static ImmutableGraph loadOffline(CharSequence basename,
                                         ProgressLogger unused)
                                  throws IOException
Throws:
IOException

loadOnce

public static ArcListASCIIGraph loadOnce(InputStream is)
                                  throws IOException
Throws:
IOException

load

public static ImmutableGraph load(CharSequence basename)
                           throws IOException
Throws:
IOException

load

public static ImmutableGraph load(CharSequence basename,
                                  ProgressLogger unused)
                           throws IOException
Throws:
IOException

store

public static void store(ImmutableGraph graph,
                         CharSequence basename,
                         ProgressLogger unused)
                  throws IOException
Throws:
IOException