- 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>
public class Graph6Sparse6Exporter<V,E> extends java.lang.Object implements 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
Nested Classes Modifier and Type Class Description static class
Graph6Sparse6Exporter.Format
Format type: graph6 (g6) or sparse6(s6)
-
Field Summary
Fields Modifier and Type Field Description static Graph6Sparse6Exporter.Format
DEFAULT_GRAPH6SPARSE6_FORMAT
The default format used by the exporter.
-
Constructor Summary
Constructors Constructor Description Graph6Sparse6Exporter()
Constructs a new exporter with a given vertex ID provider.Graph6Sparse6Exporter(Graph6Sparse6Exporter.Format format)
Constructs a new exporter with a given vertex ID provider.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
exportGraph(Graph<V,E> g, java.io.Writer writer)
Export a graph using the givenWriter
.-
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 Detail
-
DEFAULT_GRAPH6SPARSE6_FORMAT
public static final Graph6Sparse6Exporter.Format DEFAULT_GRAPH6SPARSE6_FORMAT
The default format used by the exporter.
-
-
Constructor Detail
-
Graph6Sparse6Exporter
public Graph6Sparse6Exporter()
Constructs a new exporter with a given vertex ID provider.
-
Graph6Sparse6Exporter
public Graph6Sparse6Exporter(Graph6Sparse6Exporter.Format format)
Constructs a new exporter with a given vertex ID provider.- Parameters:
format
- the format to use
-
-
Method Detail
-
exportGraph
public void exportGraph(Graph<V,E> g, java.io.Writer writer) throws ExportException
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
-
-