The objective is to able to create graphs in which a node can be overlapping between two or more subgraphs. Something like in the (erroneous) image below (A->B and A->C are in different subgraphs):
Something similar has been asked in Graphviz: Node in two subgraph and also in Same node in two subgraphs, but there had been no solution. This is something essential in graphs, and there should be an easy way of achieving that.
Overlapping subgraphs is not supported by GraphViz
Related
I want to create a graphviz graph which contains two subgraphs containing nodes which are linked to other nodes in the other graph.
Some nodes need to be aligned horizontally to each other.
I've found out about the newrank=true command and I'm using it to achieve my described goal.
For some reason I've found that really weird behaviour:
If I create two nodes in one cluster and an arrow from one to the other and then another arrow pointing towards a third node in another cluster, graphviz will display two arrows.
digraph g{
newrank=true;
subgraph cluster_d{
A -> B
}
subgraph cluster_v{
C
}
{rank=same; A, B, C }
B -> C
}
I know, that I could simply use rankdir=LR and remove the rank=same, but in a larger graph with more nodes and subgraphs I seem to run into this problem sooner or later anyway.
I just created the artificial example above, to narrow the problem down.
Here is the code in use:
https://hackmd.io/s/B1NXAiTk7#
Why does Graphviz create two arrows between the subgraphs and how can I prevent this?
Related to: Why is graphviz drawing two arrows, and using a weird order?
But there was no satisfying answer and I think I narrowed the problem down.
How do I add an edge to a graphviz neato/fdp graph, that has no influence of the layout. I tried especially weight=0 and w=0 as stated in the documentation, and many other combination with the len attribute and different weights .
I'm aming for a map of nodes with "fixed" position/neighborhood and an overlay of additional relations.
This should be achievable by a two-step approach where you first run graphviz with the nodes and subset of edges you want it to use to compute positions and have it output the node positions (for example, use the -Tdot output). Then add the additional edges and rerun graphviz again.
You may need to pin the nodes, see this question: graphviz - fixed node positions
The tree on which mssp(multiple source shortest path) can be executed, is stated in many papers that it must be an embeded plannar graph. Does this mean that there can be no edges that overlap each other? If so is possible to change such graph into a plannar graph?
The canonical input to MSSP is a doubly connected edge list or something like it that gives the combinatorial topology of the graph but not the geometry. If you have a straight-line graph that's not planar (i.e., it has edges that cross or overlap), then you need to change the graph somehow. One possibility is to introduce a new vertex everywhere there's an intersection; another is to delete problematic edges.
Is it possible to draw an edge from a Node to the center of an existing Edge in graphviz? I would like to duplicate this type of reaction diagram, common in chemical or biological networks.
Thanks!
--Peter
Yes, you can use invisible nodes, like in this example for instance.
Then play with creating subgraphs for A and B where
rank=same
and then an edge where
constraint=false
for the connection from C to the invisible node. This will put the first two above C.
I would like to create graph with 3 sub graphs. Could two of them have left-right orientation and third top-bottom orientation as in this example?
I need also connect a few nodes from one subgraph to another but this should be easy.
This is not possible with graphviz. rankdir is a graph attribute (not subgraph or cluster).