java.lang.Object
org.jgrapht.nio.graph6.Graph6Sparse6Exporter<V,E>
- Type Parameters:
V
- graph vertex typeE
- graph edge type
- All Implemented Interfaces:
GraphExporter<V,
E>
Exporter which exports graphs in graph6 or sparse6 format. A description of the format can be
found here. graph6 and sparse6
are formats for storing undirected graphs in a compact manner, using only printable ASCII
characters. Files in these formats have text format and contain one line per graph. graph6 is
suitable for small graphs, or large dense graphs. sparse6 is more space-efficient for large
sparse graphs. Typically, files storing graph6 graphs have the 'g6' extension. Similarly, files
storing sparse6 graphs have a 's6' file extension. sparse6 graphs support loops and multiple
edges, graph6 graphs do not.
In particular, the length of a Graph6 string representation of a graph depends only on the number of vertices. However, this also means that graphs with few edges take as much space as graphs with many edges. On the other hand, Sparse6 is a variable length format which can use dramatically less space for sparse graphs but can have a much larger storage size for dense graphs.
- Author:
- Joris Kinable
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Format type: graph6 (g6) or sparse6(s6) -
Field Summary
Modifier and TypeFieldDescriptionstatic final Graph6Sparse6Exporter.Format
The default format used by the exporter. -
Constructor Summary
ConstructorDescriptionConstructs a new exporter with a given vertex ID provider.Constructs a new exporter with a given vertex ID provider. -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.jgrapht.nio.GraphExporter
exportGraph, exportGraph
-
Field Details
-
DEFAULT_GRAPH6SPARSE6_FORMAT
The default format used by the exporter.
-
-
Constructor Details
-
Graph6Sparse6Exporter
public Graph6Sparse6Exporter()Constructs a new exporter with a given vertex ID provider. -
Graph6Sparse6Exporter
Constructs a new exporter with a given vertex ID provider.- Parameters:
format
- the format to use
-
-
Method Details
-
exportGraph
Description copied from interface:GraphExporter
Export a graph using the givenWriter
.It is the callers responsibility to ensure the
Writer
is closed after this method returned.- Specified by:
exportGraph
in interfaceGraphExporter<V,
E> - Parameters:
g
- the graph to exportwriter
- the output writer- Throws:
ExportException
- in case any error occurs
-