Class Digraph6GraphReader
- All Implemented Interfaces:
GraphReader<Integer,
Integer>
'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:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionRead a graph from a file.Read a graph from an I/O reader.Read a graph from a file, given a path to it.final IntGraphBuilder
readIntoBuilder
(Reader reader) Read a graph from an I/O reader into aGraphBuilder
.
-
Constructor Details
-
Digraph6GraphReader
public Digraph6GraphReader()Create a new reader.
-
-
Method Details
-
readGraph
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
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
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
-
readIntoBuilder
Description copied from interface:GraphReader
Read a graph from an I/O reader into aGraphBuilder
.- Specified by:
readIntoBuilder
in interfaceGraphReader<Integer,
Integer> - Parameters:
reader
- an I/O reader that contain a graph description- Returns:
- a graph builder containing the vertices and edge read from the reader
-