style=filled;
color=lightgrey;
node [style=filled,color=white];
label = "cluster1"
I think the name actually has to begin with "cluster" for
Graphviz to recognize it as a cluster.
>
> My other question is, how I can access to kind of information for a subgraph
>
> style=filled;
> color=lightgrey;
> node [style=filled,color=white];
> label = "cluster1"
See example below. There seems to be some issue (perhaps a bug
in PyGraphviz) in setting default attributes for subgraphs.
So you may not be able to get exacdtly what you want or expect
there. I'll see if I can figure out what the problem is.
import pygraphviz as p
G = p.AGraph(directed=True)
G.add_node(1)
G.add_node(2)
G.add_node(3)
G.add_node(4)
G.add_edge(1,3)
G.node_attr['color']='red'
G.node_attr['style']='filled'
G.graph_attr['label']='a graph'
G1 = G.subgraph(nbunch=[1,2],
name="cluster1",
style='filled',
color='lightgrey',
label='cluster 1 label')
# this doesn't work correctly
#G1.node_attr['style']='filled'
#G1.node_attr['color']='blue'
attributes={}
attributes.update(style='filled',
color='yellow',
label='cluster 2 label')
G2 = G.subgraph(nbunch=[3,4],name="cluster2",**attributes)
Aric