V
- the graph vertex typeE
- the graph edge typepublic class DOTExporter<V,E> extends Object implements GraphExporter<V,E>
For a description of the format see http://en.wikipedia.org/wiki/DOT_language.
The user can adjust the behavior usingComponentNameProvider
and
ComponentAttributeProvider
instances given through the constructor.Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_GRAPH_ID
Default graph id used by the exporter.
|
protected ComponentNameProvider<E> |
edgeIDProvider
Provides an identifier for an edge.
|
protected ComponentNameProvider<V> |
vertexIDProvider
Provides an identifier for a vertex.
|
Constructor and Description |
---|
DOTExporter()
Constructs a new DOTExporter object with an integer name provider for the vertex IDs and null
providers for the vertex and edge labels.
|
DOTExporter(ComponentNameProvider<V> vertexIDProvider,
ComponentNameProvider<V> vertexLabelProvider,
ComponentNameProvider<E> edgeLabelProvider)
Constructs a new DOTExporter object with the given ID and label providers.
|
DOTExporter(ComponentNameProvider<V> vertexIDProvider,
ComponentNameProvider<V> vertexLabelProvider,
ComponentNameProvider<E> edgeLabelProvider,
ComponentAttributeProvider<V> vertexAttributeProvider,
ComponentAttributeProvider<E> edgeAttributeProvider)
Constructs a new DOTExporter object with the given ID, label, and attribute providers.
|
DOTExporter(ComponentNameProvider<V> vertexIDProvider,
ComponentNameProvider<V> vertexLabelProvider,
ComponentNameProvider<E> edgeLabelProvider,
ComponentAttributeProvider<V> vertexAttributeProvider,
ComponentAttributeProvider<E> edgeAttributeProvider,
ComponentNameProvider<Graph<V,E>> graphIDProvider)
Constructs a new DOTExporter object with the given ID, label, attribute, and graph id
providers.
|
Modifier and Type | Method and Description |
---|---|
void |
exportGraph(Graph<V,E> g,
Writer writer)
Exports a graph into a plain text file in DOT format.
|
ComponentNameProvider<E> |
getEdgeIDProvider()
Get the edge id provider
|
ComponentNameProvider<V> |
getVertexIDProvider()
Get the vertex id provider
|
void |
putGraphAttribute(String key,
String value)
Set a graph attribute.
|
void |
removeGraphAttribute(String key)
Clear a graph attribute.
|
void |
setEdgeIDProvider(ComponentNameProvider<E> edgeIDProvider)
Set the edge id provider.
|
void |
setVertexIDProvider(ComponentNameProvider<V> vertexIDProvider)
Set the vertex id provider
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
exportGraph, exportGraph
public static final String DEFAULT_GRAPH_ID
protected ComponentNameProvider<V> vertexIDProvider
protected ComponentNameProvider<E> edgeIDProvider
public DOTExporter()
public DOTExporter(ComponentNameProvider<V> vertexIDProvider, ComponentNameProvider<V> vertexLabelProvider, ComponentNameProvider<E> edgeLabelProvider)
vertexIDProvider
- for generating vertex IDs. Must not be null.vertexLabelProvider
- for generating vertex labels. If null, vertex labels will not be
written to the file.edgeLabelProvider
- for generating edge labels. If null, edge labels will not be written
to the file.public DOTExporter(ComponentNameProvider<V> vertexIDProvider, ComponentNameProvider<V> vertexLabelProvider, ComponentNameProvider<E> edgeLabelProvider, ComponentAttributeProvider<V> vertexAttributeProvider, ComponentAttributeProvider<E> edgeAttributeProvider)
vertexIDProvider
- for generating vertex IDs. Must not be null.vertexLabelProvider
- for generating vertex labels. If null, vertex labels will not be
written to the file (unless an attribute provider is supplied which also supplies
labels).edgeLabelProvider
- for generating edge labels. If null, edge labels will not be written
to the file.vertexAttributeProvider
- for generating vertex attributes. If null, vertex attributes
will not be written to the file.edgeAttributeProvider
- for generating edge attributes. If null, edge attributes will
not be written to the file.public DOTExporter(ComponentNameProvider<V> vertexIDProvider, ComponentNameProvider<V> vertexLabelProvider, ComponentNameProvider<E> edgeLabelProvider, ComponentAttributeProvider<V> vertexAttributeProvider, ComponentAttributeProvider<E> edgeAttributeProvider, ComponentNameProvider<Graph<V,E>> graphIDProvider)
vertexIDProvider
- for generating vertex IDs. Must not be null.vertexLabelProvider
- for generating vertex labels. If null, vertex labels will not be
written to the file (unless an attribute provider is supplied which also supplies
labels).edgeLabelProvider
- for generating edge labels. If null, edge labels will not be written
to the file.vertexAttributeProvider
- for generating vertex attributes. If null, vertex attributes
will not be written to the file.edgeAttributeProvider
- for generating edge attributes. If null, edge attributes will
not be written to the file.graphIDProvider
- for generating the graph ID. If null the graph is named
DEFAULT_GRAPH_ID
.public void exportGraph(Graph<V,E> g, Writer writer)
exportGraph
in interface GraphExporter<V,E>
g
- the graph to be exportedwriter
- the writer to which the graph to be exportedpublic void removeGraphAttribute(String key)
key
- the graph attribute keypublic void putGraphAttribute(String key, String value)
key
- the graph attribute keyvalue
- the graph attribute valuepublic ComponentNameProvider<V> getVertexIDProvider()
public void setVertexIDProvider(ComponentNameProvider<V> vertexIDProvider)
vertexIDProvider
- the new vertex id provider. Must not be null.public ComponentNameProvider<E> getEdgeIDProvider()
public void setEdgeIDProvider(ComponentNameProvider<E> edgeIDProvider)
edgeIDProvider
- the new edge id provider. Must not be null.Copyright © 2019. All rights reserved.