Number: 2049
Title: subgraph id used in edge does not find cluster - instead creates new node
Submitter: Erik Eidt
Date: Wed Oct 6 14:06:38 2010
Subsys: Dot
Version:
System: *-*-Windows 7
Severity: major
Problem:
I'm trying to reference a cluster as a head or tail of an edge.

The documentation seems to indicate this is possible.

Also, see the similar sample in the gallery: http://www.graphviz.org/Gallery/undirected/fdpclust.html

When I reference the cluster by its id (e.g. cluster_A) I get a new node cluster_A instead of a reference to the subgraph named cluster_A.

I've tried this on both these versions, same results, no joy on reference to the cluster itself 2.26.3 (201000126.1600) 2.27.20101005.0445 (20101005.0445)

I'm using dot.exe, from the command line.
Input:

digraph G {
	n1->n2
	subgraph cluster_A {
		n1
		n2
	}
	n3->n4
	subgraph cluster_B {
		n3
		n4
	}
	n5->cluster_B
	cluster_A->n6
}
Output file: b1049.svg
Comments:
Thanks!

[erg] This actually qualifies as a request for a new feature. At present, only fdp supports the notion of compound graphs, where an edge can connect to a cluster.

dot provides a hack that often gives you what you want. You set compound=true. All of the edges still go from nodes to nodes, but an edge can specify a cluster as a logical head and tail, to the edge drawing is clipped in the appropriate way. Obviously, you need to specify which are the nodes actually used for the edges, and it does not allow nested clusters to have such edges.

For example, for your graph, try


digraph G {
    compound=true
    n1->n2
    subgraph cluster_A {
        n1
        n2
    }
    n3->n4
    subgraph cluster_B {
        n3
        n4
    }
    n5->n4 [lhead=cluster_B]
    n1->n6 [ltail=cluster_A]
}

Owner: *
Status: Request