V
- the graph vertex typeE
- the graph edge typepublic class GmlExporter<V,E> extends Object implements GraphExporter<V,E>
For a description of the format see http://www. infosun.fmi.uni-passau.de/Graphlet/GML/.
The behavior of the exporter such as whether to print vertex labels, edge labels, and/or edge
weights can be adjusted using the setParameter
method.
When exporting labels, the exporter escapes them as Java strings.
Modifier and Type | Class and Description |
---|---|
static class |
GmlExporter.Parameter
Parameters that affect the behavior of the
GmlExporter exporter. |
Modifier and Type | Field and Description |
---|---|
protected ComponentNameProvider<E> |
edgeIDProvider
Provides an identifier for an edge.
|
protected ComponentNameProvider<V> |
vertexIDProvider
Provides an identifier for a vertex.
|
Constructor and Description |
---|
GmlExporter()
Creates a new GmlExporter object with integer name providers for the vertex and edge IDs and
null providers for the vertex and edge labels.
|
GmlExporter(ComponentNameProvider<V> vertexIDProvider,
ComponentNameProvider<V> vertexLabelProvider,
ComponentNameProvider<E> edgeIDProvider,
ComponentNameProvider<E> edgeLabelProvider)
Constructs a new GmlExporter object with the given ID and label providers.
|
Modifier and Type | Method and Description |
---|---|
void |
exportGraph(Graph<V,E> g,
Writer writer)
Exports an graph into a plain text GML format.
|
ComponentNameProvider<E> |
getEdgeIDProvider()
Get the edge id provider
|
ComponentNameProvider<V> |
getVertexIDProvider()
Get the vertex id provider
|
boolean |
isParameter(GmlExporter.Parameter p)
Return if a particular parameter of the exporter is enabled
|
void |
setEdgeIDProvider(ComponentNameProvider<E> edgeIDProvider)
Set the edge id provider.
|
void |
setParameter(GmlExporter.Parameter p,
boolean value)
Set the value of a parameter of the exporter
|
void |
setVertexIDProvider(ComponentNameProvider<V> vertexIDProvider)
Set the vertex id provider
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
exportGraph, exportGraph
protected ComponentNameProvider<V> vertexIDProvider
protected ComponentNameProvider<E> edgeIDProvider
public GmlExporter()
public GmlExporter(ComponentNameProvider<V> vertexIDProvider, ComponentNameProvider<V> vertexLabelProvider, ComponentNameProvider<E> edgeIDProvider, ComponentNameProvider<E> edgeLabelProvider)
vertexIDProvider
- for generating vertex IDs. Must not be null.vertexLabelProvider
- for generating vertex labels. If null, vertex labels will be
generated using the toString() method of the vertex object.edgeIDProvider
- for generating vertex IDs. Must not be null.edgeLabelProvider
- for generating edge labels. If null, edge labels will be generated
using the toString() method of the edge object.public void exportGraph(Graph<V,E> g, Writer writer)
exportGraph
in interface GraphExporter<V,E>
writer
- the writerg
- the graphpublic boolean isParameter(GmlExporter.Parameter p)
p
- the parametertrue
if the parameter is set, false
otherwisepublic void setParameter(GmlExporter.Parameter p, boolean value)
p
- the parametervalue
- the value to setpublic 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 © 2018. All rights reserved.