V
- the graph vertex typeE
- the graph edge typepublic class GraphMLExporter<V,E> extends Object implements GraphExporter<V,E>
For a description of the format see http://en.wikipedia.org/wiki/ GraphML.
Modifier and Type | Class and Description |
---|---|
static class |
GraphMLExporter.AttributeCategory
Denotes the category of a GraphML-Attribute.
|
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 |
---|
GraphMLExporter()
Constructs a new GraphMLExporter with integer name providers for the vertex and edge
identifiers.
|
GraphMLExporter(ComponentNameProvider<V> vertexIDProvider,
ComponentNameProvider<V> vertexLabelProvider,
ComponentAttributeProvider<V> vertexAttributeProvider,
ComponentNameProvider<E> edgeIDProvider,
ComponentNameProvider<E> edgeLabelProvider,
ComponentAttributeProvider<E> edgeAttributeProvider)
Constructs a new GraphMLExporter.
|
GraphMLExporter(ComponentNameProvider<V> vertexIDProvider,
ComponentNameProvider<V> vertexLabelProvider,
ComponentNameProvider<E> edgeIDProvider,
ComponentNameProvider<E> edgeLabelProvider)
Constructs a new GraphMLExporter.
|
Modifier and Type | Method and Description |
---|---|
void |
exportGraph(Graph<V,E> g,
Writer writer)
Exports a graph in GraphML format.
|
ComponentAttributeProvider<E> |
getEdgeAttributeProvider()
Get the edge attribute provider
|
ComponentNameProvider<E> |
getEdgeIDProvider()
Get the edge id provider
|
String |
getEdgeLabelAttributeName()
Get the attribute name for edge labels
|
ComponentNameProvider<E> |
getEdgeLabelProvider()
Get the edge label provider
|
String |
getEdgeWeightAttributeName()
Get the attribute name for edge weights
|
ComponentAttributeProvider<V> |
getVertexAttributeProvider()
Get the vertex attribute provider
|
ComponentNameProvider<V> |
getVertexIDProvider()
Get the vertex id provider
|
String |
getVertexLabelAttributeName()
Get the attribute name for vertex labels
|
ComponentNameProvider<V> |
getVertexLabelProvider()
Get the vertex label provider
|
boolean |
isExportEdgeWeights()
Whether the exporter will print edge weights.
|
void |
registerAttribute(String name,
GraphMLExporter.AttributeCategory category,
AttributeType type)
Register a GraphML-Attribute
|
void |
registerAttribute(String name,
GraphMLExporter.AttributeCategory category,
AttributeType type,
String defaultValue)
Register a GraphML-Attribute
|
void |
setEdgeAttributeProvider(ComponentAttributeProvider<E> edgeAttributeProvider)
Set the edge attribute provider.
|
void |
setEdgeIDProvider(ComponentNameProvider<E> edgeIDProvider)
Set the edge id provider.
|
void |
setEdgeLabelAttributeName(String edgeLabelAttributeName)
Set the attribute name to use for edge labels.
|
void |
setEdgeLabelProvider(ComponentNameProvider<E> edgeLabelProvider)
Set the edge label provider.
|
void |
setEdgeWeightAttributeName(String edgeWeightAttributeName)
Set the attribute name to use for edge weights.
|
void |
setExportEdgeWeights(boolean exportEdgeWeights)
Set whether the exporter will print edge weights.
|
void |
setVertexAttributeProvider(ComponentAttributeProvider<V> vertexAttributeProvider)
Set the vertex attribute provider.
|
void |
setVertexIDProvider(ComponentNameProvider<V> vertexIDProvider)
Set the vertex id provider
|
void |
setVertexLabelAttributeName(String vertexLabelAttributeName)
Set the attribute name to use for vertex labels.
|
void |
setVertexLabelProvider(ComponentNameProvider<V> vertexLabelProvider)
Set the vertex label provider.
|
void |
unregisterAttribute(String name)
Unregister a GraphML-Attribute
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
exportGraph, exportGraph
protected ComponentNameProvider<V> vertexIDProvider
protected ComponentNameProvider<E> edgeIDProvider
public GraphMLExporter()
public GraphMLExporter(ComponentNameProvider<V> vertexIDProvider, ComponentNameProvider<V> vertexLabelProvider, ComponentNameProvider<E> edgeIDProvider, ComponentNameProvider<E> edgeLabelProvider)
vertexIDProvider
- for generating vertex identifiers. Must not be null.vertexLabelProvider
- for generating vertex labels. If null, vertex labels will not
exported.edgeIDProvider
- for generating edge identifiers. Must not be null.edgeLabelProvider
- for generating edge labels. If null, edge labels will not be
exported.public GraphMLExporter(ComponentNameProvider<V> vertexIDProvider, ComponentNameProvider<V> vertexLabelProvider, ComponentAttributeProvider<V> vertexAttributeProvider, ComponentNameProvider<E> edgeIDProvider, ComponentNameProvider<E> edgeLabelProvider, ComponentAttributeProvider<E> edgeAttributeProvider)
vertexIDProvider
- for generating vertex identifiers. Must not be null.vertexLabelProvider
- for generating vertex labels. If null, vertex labels will not
exported.vertexAttributeProvider
- for generating vertex attributes. If null, no additional
attributes will be exported.edgeIDProvider
- for generating edge identifiers. Must not be null.edgeLabelProvider
- for generating edge labels. If null, edge labels will not be
exported.edgeAttributeProvider
- for generating edge attributes. If null, no additional
attributes will be exported.public void registerAttribute(String name, GraphMLExporter.AttributeCategory category, AttributeType type)
name
- the attribute namecategory
- the attribute categorytype
- the attribute typepublic void registerAttribute(String name, GraphMLExporter.AttributeCategory category, AttributeType type, String defaultValue)
name
- the attribute namecategory
- the attribute categorytype
- the attribute typedefaultValue
- default valuepublic void unregisterAttribute(String name)
name
- the attribute namepublic boolean isExportEdgeWeights()
true
if the exporter prints edge weights, false
otherwisepublic void setExportEdgeWeights(boolean exportEdgeWeights)
exportEdgeWeights
- value to setpublic String getVertexLabelAttributeName()
public void setVertexLabelAttributeName(String vertexLabelAttributeName)
vertexLabelAttributeName
- the attribute namepublic String getEdgeLabelAttributeName()
public void setEdgeLabelAttributeName(String edgeLabelAttributeName)
edgeLabelAttributeName
- the attribute namepublic String getEdgeWeightAttributeName()
public void setEdgeWeightAttributeName(String edgeWeightAttributeName)
edgeWeightAttributeName
- the attribute namepublic ComponentNameProvider<V> getVertexLabelProvider()
public void setVertexLabelProvider(ComponentNameProvider<V> vertexLabelProvider)
vertexLabelProvider
- the vertex label provider to setpublic ComponentNameProvider<E> getEdgeLabelProvider()
public void setEdgeLabelProvider(ComponentNameProvider<E> edgeLabelProvider)
edgeLabelProvider
- the edge label provider to setpublic ComponentAttributeProvider<V> getVertexAttributeProvider()
public void setVertexAttributeProvider(ComponentAttributeProvider<V> vertexAttributeProvider)
vertexAttributeProvider
- the vertex attribute provider to setpublic ComponentAttributeProvider<E> getEdgeAttributeProvider()
public void setEdgeAttributeProvider(ComponentAttributeProvider<E> edgeAttributeProvider)
edgeAttributeProvider
- the edge attribute provider to setpublic void exportGraph(Graph<V,E> g, Writer writer) throws ExportException
exportGraph
in interface GraphExporter<V,E>
g
- the graphwriter
- the writer to export the graphExportException
- in case any error occurs during exportpublic 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 © 2017. All rights reserved.