Package com.jgalgo.io

Class Digraph6GraphReader

  • All Implemented Interfaces:
    GraphReader<Integer,​Integer>

    public final class Digraph6GraphReader
    extends Object
    Read a graph in 'digraph6' format.

    'digraph6' is a format for storing directed graphs in a compact manner, using only printable ASCII characters. Files in these format have text type and contain one line per graph. It is suitable for small graphs, or large dense graphs. The format support graphs with vertices numbered 0..n-1 only, where n is the number of vertices, and edges numbered 0..m-1 only, where m is the number of edges. A digraph6 file contains a bit vector with n^2 bits representing the edges of the graph. All bytes of a digraph6 file are in the range 63..126, which are the printable ASCII characters, therefore a bit vector is represented by a sequence of bytes in which each byte encode only 6 bits.

    The format does not support specifying the ids of the edges, therefore the reader will number them from 0 to m-1 in the order in the bit vector. The order, and the format details can be found here.

    The 'digraph6' format support directed graphs only, for undirected graphs the 'graph6' format should be used.

    Parallel edges are not supported by the format.

    File with a graph in 'digraph6' format usually have the extension .d6.

    Author:
    Barak Ugav
    See Also:
    Digraph6GraphWriter
    • Constructor Detail

      • Digraph6GraphReader

        public Digraph6GraphReader()
        Create a new reader.
    • Method Detail

      • readGraph

        public IntGraph readGraph​(Reader reader)
        Description copied from interface: GraphReader
        Read a graph from an I/O reader.
        Parameters:
        reader - an I/O reader that contain a graph description
        Returns:
        a new graph read from the reader
      • readGraph

        public IntGraph readGraph​(File file)
        Description copied from interface: GraphReader
        Read a graph from a file.
        Parameters:
        file - a file that contain a graph description
        Returns:
        a new graph read from the file
      • readGraph

        public IntGraph readGraph​(String path)
        Description copied from interface: GraphReader
        Read a graph from a file, given a path to it.
        Parameters:
        path - a path to a file that contain a graph description
        Returns:
        a new graph read from the file