java.lang.Object
org.jgrapht.nio.BaseExporter<V,E>
org.jgrapht.nio.dimacs.DIMACSExporter<V,E>
- Type Parameters:
V
- the graph vertex typeE
- the graph edge type
- All Implemented Interfaces:
GraphExporter<V,E>
public class DIMACSExporter<V,E> extends BaseExporter<V,E> implements GraphExporter<V,E>
Exports a graph into DIMACS format.
For a description of the format see
http://dimacs.rutgers.edu/Challenges. Note that there are a lot of different formats based on
each different challenge, see DIMACSFormat
for the supported formats. The exporter uses
the DIMACSFormat.MAX_CLIQUE
by default.
- Author:
- Dimitrios Michail
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
DIMACSExporter.Parameter
Parameters that affect the behavior of theDIMACSExporter
exporter. -
Field Summary
Fields Modifier and Type Field Description static DIMACSFormat
DEFAULT_DIMACS_FORMAT
The default format used by the exporter.Fields inherited from class org.jgrapht.nio.BaseExporter
edgeAttributeProvider, edgeIdProvider, graphAttributeProvider, graphIdProvider, vertexAttributeProvider, vertexIdProvider
-
Constructor Summary
Constructors Constructor Description DIMACSExporter()
Constructs a new exporter.DIMACSExporter(java.util.function.Function<V,java.lang.String> vertexIdProvider)
Constructs a new exporter with a given vertex ID provider.DIMACSExporter(java.util.function.Function<V,java.lang.String> vertexIdProvider, DIMACSFormat format)
Constructs a new exporter with a given vertex ID provider. -
Method Summary
Modifier and Type Method Description void
exportGraph(Graph<V,E> g, java.io.Writer writer)
Export a graph using the givenWriter
.DIMACSFormat
getFormat()
Get the format of the exporterboolean
isParameter(DIMACSExporter.Parameter p)
Return if a particular parameter of the exporter is enabledvoid
setFormat(DIMACSFormat format)
Set the format of the exportervoid
setParameter(DIMACSExporter.Parameter p, boolean value)
Set the value of a parameter of the exporterMethods inherited from class org.jgrapht.nio.BaseExporter
getEdgeAttribute, getEdgeAttributeProvider, getEdgeAttributes, getEdgeId, getEdgeIdProvider, getGraphAttribute, getGraphAttributeProvider, getGraphId, getGraphIdProvider, getVertexAttribute, getVertexAttributeProvider, getVertexAttributes, getVertexId, getVertexIdProvider, setEdgeAttributeProvider, setEdgeIdProvider, setGraphAttributeProvider, setGraphIdProvider, setVertexAttributeProvider, setVertexIdProvider
-
Field Details
-
DEFAULT_DIMACS_FORMAT
The default format used by the exporter.
-
-
Constructor Details
-
DIMACSExporter
public DIMACSExporter()Constructs a new exporter. -
DIMACSExporter
Constructs a new exporter with a given vertex ID provider.- Parameters:
vertexIdProvider
- for generating vertex IDs. Must not be null.
-
DIMACSExporter
public DIMACSExporter(java.util.function.Function<V,java.lang.String> vertexIdProvider, DIMACSFormat format)Constructs a new exporter with a given vertex ID provider.- Parameters:
vertexIdProvider
- for generating vertex IDs. Must not be null.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
-
isParameter
Return if a particular parameter of the exporter is enabled- Parameters:
p
- the parameter- Returns:
true
if the parameter is set,false
otherwise
-
setParameter
Set the value of a parameter of the exporter- Parameters:
p
- the parametervalue
- the value to set
-
getFormat
Get the format of the exporter- Returns:
- the format of the exporter
-
setFormat
Set the format of the exporter- Parameters:
format
- the format to use
-