-
-
Save anonymous/55aebea4bfe41a271624 to your computer and use it in GitHub Desktop.
Issue attachments for pydot/pydot-ng#89: https://github.com/pydot/pydot-ng/issues/89
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def GraphDirectedCluster(): | |
graph = pydot.Dot(graph_type='digraph') | |
e = pydot.Node("e") | |
graph.add_node(e) | |
clusterA = pydot.Cluster("A") | |
a = pydot.Node("a") | |
b = pydot.Node("b") | |
clusterA.add_node(a) | |
clusterA.add_node(b) | |
clusterA.add_edge(pydot.Edge(a,b)) | |
graph.add_subgraph(clusterA) | |
clusterC = pydot.Cluster("C") | |
C = pydot.Node("C") | |
D = pydot.Node("D") | |
clusterC.add_node(C) | |
clusterC.add_node(D) | |
clusterC.add_edge(pydot.Edge(C,D)) | |
clusterA.add_subgraph(clusterC) | |
clusterB = pydot.Cluster("B") | |
d = pydot.Node("d") | |
f = pydot.Node("f") | |
clusterB.add_node(d) | |
clusterB.add_node(f) | |
clusterB.add_edge(pydot.Edge(d,f)) | |
graph.add_subgraph(clusterB) | |
graph.add_edge(pydot.Edge(d,D)) | |
graph.add_edge(pydot.Edge(e,clusterB)) | |
graph.add_edge(pydot.Edge(clusterC,clusterB)) | |
print(graph.to_string()) | |
graph.write_png('directedGraphCluster.png') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment