Class IntegerListImmutableGraph

  • All Implemented Interfaces:
    it.unimi.dsi.lang.FlyweightPrototype<ImmutableGraph>

    public class IntegerListImmutableGraph
    extends ImmutableSequentialGraph
    Exposes a graph in a simple binary format as an (offline-only) ImmutableGraph.

    This class is a simple example that should help in understanding how to interface WebGraph with external data. We have a graph contained in a file and represented by a list of binary 32-bit integers as follows: first we have the number of nodes, then the number of successors of node 0, then the list in increasing order of successors of node 0, then the number of successors of node 1, then the list in increasing order of successors of node 1, and so on.

    If we want to transform this graph into, say, a BVGraph, we must create a class that exposes the file as an ImmutableGraph and than save it using BVGraph.store(ImmutableGraph,CharSequence) or by calling the main method of BVGraph. A complete implementation is not necessary, as BVGraph uses just nodeIterator(). Since we are just interesting in importing data, we do not implement efficient random access methods, and the only loading method we implement is loadOffline(CharSequence).

    • Method Detail

      • numNodes

        public long numNodes()
        Description copied from class: ImmutableGraph
        Returns the number of nodes of this graph.

        Albeit this method is not optional, it is allowed that this method throws an UnsupportedOperationException if this graph has never been entirely traversed using a node iterator. This apparently bizarre behaviour is necessary to support implementations as ArcListASCIIGraph, which do not know the actual number of nodes until a traversal has been completed.

        Specified by:
        numNodes in class ImmutableGraph
        Returns:
        the number of nodes.
      • load

        public static ImmutableGraph load​(java.lang.CharSequence basename,
                                          it.unimi.dsi.logging.ProgressLogger pl)
      • load

        public static ImmutableGraph load​(java.lang.CharSequence basename)
      • loadSequential

        @Deprecated
        public static ImmutableGraph loadSequential​(java.lang.CharSequence basename,
                                                    it.unimi.dsi.logging.ProgressLogger pl)
        Deprecated.
      • loadSequential

        @Deprecated
        public static ImmutableGraph loadSequential​(java.lang.CharSequence basename)
        Deprecated.
      • loadOffline

        public static ImmutableGraph loadOffline​(java.lang.CharSequence basename,
                                                 it.unimi.dsi.logging.ProgressLogger pl)
                                          throws java.io.IOException
        Throws:
        java.io.IOException
      • loadOffline

        public static ImmutableGraph loadOffline​(java.lang.CharSequence basename)
                                          throws java.io.IOException
        Throws:
        java.io.IOException