nidi3 / graphviz-java

Use graphviz with pure java
Apache License 2.0
937 stars 107 forks source link

Clusters #123

Closed AmanGotchu closed 5 years ago

AmanGotchu commented 5 years ago

Is it possible to assign a group of nodes with their own set of edges in a cluster without defining "cluster specific" edges?

How are clusters used in this library?

nidi3 commented 5 years ago

Can you give an example of what you want do achieve? Can you do this with the native dot implementation or would it not be possible?

AmanGotchu commented 5 years ago

https://graphviz.gitlab.io/_pages/Gallery/directed/cluster.html

Yep, its possible with native DOT -> Graphviz implementation. Just not sure if this library has support for it.

nidi3 commented 5 years ago

Just use .cluser():

Graph g = graph().with(
    graph("1").cluster().graphAttr().with(Label.of("#1")).with(node("a0").link("a1")),
    graph("2").cluster().graphAttr().with(Label.of("#2")).with(node("b0").link("b1")),
    node("start").link("a0", "b0"));
AmanGotchu commented 5 years ago

Is this possible with MutableGraphs?

nidi3 commented 5 years ago

.setCluster()

AmanGotchu commented 5 years ago

I'm able to create clusters and add them to my overall graph, but I can't find a way to set the rank of specific clusters inside the overall graph so only some (potentially all) start at the same spot.

nidi3 commented 5 years ago

How would you do it in DOT?

jeremydouglass commented 5 years ago

a way to set the rank of specific clusters inside the overall graph so only some (potentially all) start at the same spot

Do you mean like swim lanes?

https://www.google.com/search?q=swim+lanes+graphviz

AmanGotchu commented 5 years ago

Swim lanes are similar to what I want. I ended up figuring it out though! I had to make all edges that connect different clusters "constraint"="false"

nidi3 commented 5 years ago

So, closing the issue.