N
- the network node typeE
- the network edge typepublic class GmlExporter<N extends PlannerGraph.Node,E extends PlannerGraph.Edge> extends GraphExporter<N,E>
GraphExporter.ClusterProvider<N,E>, GraphExporter.ComponentAttributeProvider<T>, GraphExporter.ComponentNameProvider<T>, GraphExporter.ExporterContext
Constructor and Description |
---|
GmlExporter(GraphExporter.ComponentNameProvider<N> vertexIDProvider,
GraphExporter.ComponentAttributeProvider<N> vertexAttributeProvider,
GraphExporter.ComponentAttributeProvider<E> edgeAttributeProvider,
Map<String,Attribute> graphAttributes)
Constructs a new GmlExporter object with the given ID, label, attribute, and graph ID
providers.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
isValidId(String idCandidate)
Test if the ID candidate is a valid ID.
|
protected void |
renderCluster(GraphExporter.ExporterContext context,
String clusterId,
N head,
Set<N> nodeSet,
Map<String,Attribute> attributes)
Render a sub cluster.
|
protected void |
renderEdge(GraphExporter.ExporterContext context,
boolean isDirected,
N source,
N target,
Map<String,Attribute> attributes)
Render an edge.
|
protected void |
renderFooter(GraphExporter.ExporterContext context)
Render the footer.
|
protected void |
renderGraphAttributes(GraphExporter.ExporterContext context,
Map<String,Attribute> attributes)
Render the global graph attributes.
|
protected void |
renderHeader(GraphExporter.ExporterContext context,
com.google.common.graph.ImmutableNetwork<N,E> graph)
Render the header.
|
protected void |
renderNode(GraphExporter.ExporterContext context,
N node,
Map<String,Attribute> attributes)
Render a node.
|
exportGraph, getClusterAttributeProvider, getClusterProvider, getEdgeAttributeProvider, getGraphAttributes, getVertexAttributeProvider, getVertexID, getVertexIDProvider, getVertexIds, renderClusters, renderEdges, renderNodes
public GmlExporter(@Nonnull GraphExporter.ComponentNameProvider<N> vertexIDProvider, @Nonnull GraphExporter.ComponentAttributeProvider<N> vertexAttributeProvider, @Nonnull GraphExporter.ComponentAttributeProvider<E> edgeAttributeProvider, @Nonnull Map<String,Attribute> graphAttributes)
vertexIDProvider
- for generating vertex IDs. Must not be null.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.graphAttributes
- map of global graph-wide attributesprotected boolean isValidId(String idCandidate)
isValidId
in class GraphExporter<N extends PlannerGraph.Node,E extends PlannerGraph.Edge>
idCandidate
- the ID candidate.true
if it is valid; false
otherwise.protected void renderHeader(GraphExporter.ExporterContext context, com.google.common.graph.ImmutableNetwork<N,E> graph)
GraphExporter
renderHeader
in class GraphExporter<N extends PlannerGraph.Node,E extends PlannerGraph.Edge>
context
- the contextgraph
- the graphprotected void renderGraphAttributes(GraphExporter.ExporterContext context, Map<String,Attribute> attributes)
GraphExporter
renderGraphAttributes
in class GraphExporter<N extends PlannerGraph.Node,E extends PlannerGraph.Edge>
context
- the contextattributes
- the attributes of the graphprotected void renderNode(GraphExporter.ExporterContext context, N node, Map<String,Attribute> attributes)
GraphExporter
renderNode
in class GraphExporter<N extends PlannerGraph.Node,E extends PlannerGraph.Edge>
context
- the contextnode
- the node to be renderedattributes
- the attributes of the nodeprotected void renderEdge(GraphExporter.ExporterContext context, boolean isDirected, N source, N target, Map<String,Attribute> attributes)
GraphExporter
renderEdge
in class GraphExporter<N extends PlannerGraph.Node,E extends PlannerGraph.Edge>
context
- the contextisDirected
- true iff edge is directedsource
- the source node of the edgetarget
- the target node of the edgeattributes
- the attributes of the edgeprotected void renderCluster(GraphExporter.ExporterContext context, String clusterId, N head, Set<N> nodeSet, Map<String,Attribute> attributes)
GraphExporter
renderCluster
in class GraphExporter<N extends PlannerGraph.Node,E extends PlannerGraph.Edge>
context
- the contextclusterId
- id of the cluster, can be used for naming purposeshead
- head node representative of the clusternodeSet
- set of nodes making up the clusterattributes
- the attributes of the sub clusterprotected void renderFooter(GraphExporter.ExporterContext context)
GraphExporter
renderFooter
in class GraphExporter<N extends PlannerGraph.Node,E extends PlannerGraph.Edge>
context
- the context