java.lang.Object
org.jgrapht.nio.BaseExporter<V,E>
org.jgrapht.nio.graphml.GraphMLExporter<V,E>
- Type Parameters:
V
- the graph vertex typeE
- the graph edge type
- All Implemented Interfaces:
GraphExporter<V,
E>
Exports a graph as GraphML.
For a description of the format see http://en.wikipedia.org/wiki/ GraphML.
- Author:
- Trevor Harmon, Dimitrios Michail
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Denotes the category of a GraphML-Attribute. -
Field Summary
Fields inherited from class org.jgrapht.nio.BaseExporter
edgeAttributeProvider, edgeIdProvider, graphAttributeProvider, graphIdProvider, vertexAttributeProvider, vertexIdProvider
-
Constructor Summary
ConstructorDescriptionConstructs a new GraphMLExporter with integer id provider for the vertices.GraphMLExporter
(Function<V, String> vertexIdProvider) Constructs a new GraphMLExporter. -
Method Summary
Modifier and TypeMethodDescriptionvoid
exportGraph
(Graph<V, E> g, Writer writer) Exports a graph in GraphML format.Get the attribute name for edge labelsGet the attribute name for edge weightsGet the attribute name for vertex labelsboolean
Whether the exporter will print edge labels.boolean
Whether the exporter will print edge weights.boolean
Whether the exporter will print vertex labels.void
registerAttribute
(String name, GraphMLExporter.AttributeCategory category, AttributeType type) Register a GraphML-Attributevoid
registerAttribute
(String name, GraphMLExporter.AttributeCategory category, AttributeType type, String defaultValue) Register a GraphML-Attributevoid
setEdgeLabelAttributeName
(String edgeLabelAttributeName) Set the attribute name to use for edge labels.void
setEdgeWeightAttributeName
(String edgeWeightAttributeName) Set the attribute name to use for edge weights.void
setExportEdgeLabels
(boolean exportEdgeLabels) Set whether the exporter will print edge labels.void
setExportEdgeWeights
(boolean exportEdgeWeights) Set whether the exporter will print edge weights.void
setExportVertexLabels
(boolean exportVertexLabels) Set whether the exporter will print vertex labels.void
setVertexLabelAttributeName
(String vertexLabelAttributeName) Set the attribute name to use for vertex labels.void
unregisterAttribute
(String name) Unregister a GraphML-AttributeMethods 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
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
-
Constructor Details
-
GraphMLExporter
public GraphMLExporter()Constructs a new GraphMLExporter with integer id provider for the vertices. -
GraphMLExporter
Constructs a new GraphMLExporter.- Parameters:
vertexIdProvider
- for generating vertex identifiers. Must not be null.
-
-
Method Details
-
registerAttribute
public void registerAttribute(String name, GraphMLExporter.AttributeCategory category, AttributeType type) Register a GraphML-Attribute- Parameters:
name
- the attribute namecategory
- the attribute categorytype
- the attribute type
-
registerAttribute
public void registerAttribute(String name, GraphMLExporter.AttributeCategory category, AttributeType type, String defaultValue) Register a GraphML-Attribute- Parameters:
name
- the attribute namecategory
- the attribute categorytype
- the attribute typedefaultValue
- default value
-
unregisterAttribute
Unregister a GraphML-Attribute- Parameters:
name
- the attribute name
-
isExportEdgeWeights
public boolean isExportEdgeWeights()Whether the exporter will print edge weights.- Returns:
true
if the exporter prints edge weights,false
otherwise
-
setExportEdgeWeights
public void setExportEdgeWeights(boolean exportEdgeWeights) Set whether the exporter will print edge weights.- Parameters:
exportEdgeWeights
- value to set
-
isExportVertexLabels
public boolean isExportVertexLabels()Whether the exporter will print vertex labels.- Returns:
true
if the exporter prints vertex labels,false
otherwise
-
setExportVertexLabels
public void setExportVertexLabels(boolean exportVertexLabels) Set whether the exporter will print vertex labels.- Parameters:
exportVertexLabels
- value to set
-
isExportEdgeLabels
public boolean isExportEdgeLabels()Whether the exporter will print edge labels.- Returns:
true
if the exporter prints edge labels,false
otherwise
-
setExportEdgeLabels
public void setExportEdgeLabels(boolean exportEdgeLabels) Set whether the exporter will print edge labels.- Parameters:
exportEdgeLabels
- value to set
-
getVertexLabelAttributeName
Get the attribute name for vertex labels- Returns:
- the attribute name
-
setVertexLabelAttributeName
Set the attribute name to use for vertex labels.- Parameters:
vertexLabelAttributeName
- the attribute name
-
getEdgeLabelAttributeName
Get the attribute name for edge labels- Returns:
- the attribute name
-
setEdgeLabelAttributeName
Set the attribute name to use for edge labels.- Parameters:
edgeLabelAttributeName
- the attribute name
-
getEdgeWeightAttributeName
Get the attribute name for edge weights- Returns:
- the attribute name
-
setEdgeWeightAttributeName
Set the attribute name to use for edge weights.- Parameters:
edgeWeightAttributeName
- the attribute name
-
exportGraph
Exports a graph in GraphML format.- Specified by:
exportGraph
in interfaceGraphExporter<V,
E> - Parameters:
g
- the graphwriter
- the writer to export the graph- Throws:
ExportException
- in case any error occurs during export
-