Reputation: 6971
I want to show a node a
pointing to a node b
. b
is in a subgraph.
The following dot graphviz code should work.
digraph
{
a;
subgraph cluster_mysubgraph
{
a->b;
}
}
Alas, while the node a
is declared outside of any subgraph, it is rendered inside mysubgraph
(observed on graphviz 2.36.0 on Ubuntu 14.04):
I've tried variants like pre-declaring b
and the like. No success.
A workaround is to declare a
in another cluster subgraph.
digraph
{
subgraph cluster_pseudo
{
a;
}
subgraph cluster_mysubgraph
{
a->b;
}
}
This prevents a
from appearing inside mysubgraph
, but another subgraph is not really an option.
a
should really be outside of any subgraph.
Upvotes: 0
Views: 605
Reputation: 6971
It looks like the following works:
digraph
{
a;
subgraph cluster_mysubgraph
{
b;
}
a->b;
}
So, there might be some rule like: "declare nodes in subgraph, beware of declaring edge in subgraphs because that tends to make nodes to be attached to that subgraph (unless they are already attached to another)".
It might be so, yet it's easier, when generating a dot file, to generate nodes and edges in one pass and in my case that makes declaring nodes and edges in the same subgraph.
Upvotes: 6