N
- the network node typeE
- the network edge typepublic class DotExporter<N extends PlannerGraph.Node,E extends PlannerGraph.Edge> extends GraphExporter<N,E>
GraphExporter.ClusterProvider<N,E>, GraphExporter.ComponentAttributeProvider<T>, GraphExporter.ComponentNameProvider<T>, GraphExporter.ExporterContext
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_GRAPH_ID
Default graph id used by the exporter.
|
Constructor and Description |
---|
DotExporter(GraphExporter.ComponentNameProvider<N> vertexIDProvider,
GraphExporter.ComponentAttributeProvider<N> vertexAttributeProvider,
GraphExporter.ComponentAttributeProvider<E> edgeAttributeProvider,
Map<String,Attribute> graphAttributes,
GraphExporter.ClusterProvider<N,E> clusterProvider,
GraphExporter.ComponentAttributeProvider<N> clusterAttributeProvider)
Constructs a new DotExporter object with the given ID, label, attribute, and graph ID
providers.
|
Modifier and Type | Method and Description |
---|---|
String |
getLabel(Attribute label) |
String |
getLabel(Attribute name,
Attribute expression) |
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)
Compute 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.
|
protected void |
renderNodes(GraphExporter.ExporterContext context)
Render all nodes in the given network.
|
exportGraph, getClusterAttributeProvider, getClusterProvider, getEdgeAttributeProvider, getGraphAttributes, getVertexAttributeProvider, getVertexID, getVertexIDProvider, getVertexIds, renderClusters, renderEdges
public static final String DEFAULT_GRAPH_ID
public DotExporter(@Nonnull GraphExporter.ComponentNameProvider<N> vertexIDProvider, @Nonnull GraphExporter.ComponentAttributeProvider<N> vertexAttributeProvider, @Nonnull GraphExporter.ComponentAttributeProvider<E> edgeAttributeProvider, @Nonnull Map<String,Attribute> graphAttributes, @Nonnull GraphExporter.ClusterProvider<N,E> clusterProvider, @Nonnull GraphExporter.ComponentAttributeProvider<N> clusterAttributeProvider)
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 attributesclusterProvider
- for partitioning the graph into clusters if warrantedclusterAttributeProvider
- for providing attributes to clustersprotected 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 renderNodes(GraphExporter.ExporterContext context)
GraphExporter
renderNodes
in class GraphExporter<N extends PlannerGraph.Node,E extends PlannerGraph.Edge>
context
- the contextprotected 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)
renderFooter
in class GraphExporter<N extends PlannerGraph.Node,E extends PlannerGraph.Edge>
context
- the context