Class DOTSubgraph<V,E>

java.lang.Object
org.jgrapht.nio.dot.DOTSubgraph<V,E>
Type Parameters:
V - the vertex type
E - the edge type

public class DOTSubgraph<V,E> extends Object
A DOTSubgraph is a container class for a subgraph and its attributes. It may be used in DOT export and can be parametrized to export or not vertices and/or edges.

For example, for a subgraph named "subg" with DefaultEdges (1, 2) and (2, 3) between Integer vertices 1, 2, and 3, with the subgraph attribute pencolor set to transparent, and the cluster attribute shape set to point, the DOT export of the subgraph will be:

     subgraph subg {
         subg [ shape="point" ]
         pencolor=transparent;
         1;
         2;
         3;
         1 -- 2;
         2 -- 3;
     }
 
Author:
Nicolas Rol <nicolas.rol at rte-france.com>
See Also:
  • Constructor Details

    • DOTSubgraph

      public DOTSubgraph(AsSubgraph<V,E> subgraph, Map<String,Attribute> subgraphAttributes, Map<String,Attribute> clusterAttributes, boolean exportVertices, boolean exportEdges)
      Constructs a new DOTSubgraph with specified subgraph, attributes, and export options.
      Parameters:
      subgraph - the subgraph to be exported
      subgraphAttributes - attributes for the subgraph
      clusterAttributes - attributes for the cluster
      exportVertices - whether to export vertices
      exportEdges - whether to export edges
    • DOTSubgraph

      public DOTSubgraph(AsSubgraph<V,E> subgraph, Map<String,Attribute> subgraphAttributes, Map<String,Attribute> clusterAttributes)
      Constructs a new DOTSubgraph with specified subgraph, attributes.
      Parameters:
      subgraph - the subgraph to be exported
      subgraphAttributes - attributes for the subgraph
      clusterAttributes - attributes for the cluster
  • Method Details

    • getSubgraph

      public AsSubgraph<V,E> getSubgraph()
      Get the subgraph.
      Returns:
      the subgraph
    • getSubgraphAttributes

      public Map<String,Attribute> getSubgraphAttributes()
      Get the subgraph attributes in a preserved order.
      Returns:
      the subgraph attributes.
    • getClusterAttributes

      public Map<String,Attribute> getClusterAttributes()
      Get the cluster attributes in a preserved order.
      Returns:
      the cluster attributes.
    • vertexSet

      public Set<V> vertexSet()
      Get the vertices of the subgraph.
      Returns:
      the vertices of the subgraph
    • edgeSet

      public Set<E> edgeSet()
      Get the edges of the subgraph.
      Returns:
      the edges of the subgraph
    • isExportVertices

      public boolean isExportVertices()
      Whether to export the subgraph vertices in the DOT export.

      If true, vertices will be included in the DOT export by writing their identifiers one by one on successive lines, with the same formalism as the main graph's vertices.

      For example, for a subgraph with DefaultEdges (1, 2) and (2, 3) between Integer vertices 1, 2, and 3, the DOT export of the vertices will be:

               1;
               2;
               3;
       

      Returns:
      true if vertices should be exported, false otherwise.
    • isExportEdges

      public boolean isExportEdges()
      Whether to export the subgraph edges in the DOT export.

      If true, edges will be included in the DOT export by writing the identifiers of their respective source and target vertices on successive lines, with the same formalism as the main graph's edges.

      For example, for a subgraph with DefaultEdges (1, 2) and (2, 3) between Integer vertices 1, 2, and 3, the DOT export of the edges will be:

               1 -- 2;
               2 -- 3;
       

      Returns:
      true if edges should be exported, false otherwise.