How to draw a box around a set of nodes? I am coding in Python.

Hi all,

I have used pydot, networkx, and gv in Python to plot the graphs using graphviz. I have two questions:

1- In my graph, there are nodes with the same name and I want to show them as seperate nodes in the graph, how can I do that?
2- I want to draw a rectangular around a set of my nodes. How can I do that?

Thanks in advance,
Nasim

How to draw a box around a set of nodes? I am coding in Python.

Hi all,
I have used pydot, networkx, and gv in Python to plot the graphs using graphviz. I have two questions:
1- In my graph, there are nodes with the same name and I want to show them as seperate nodes in the graph, how can I do that?
2- I want to draw a rectangular around a set of my nodes. How can I do that?
Thanks in advance,
Nasim

 

How to draw a box around a set of nodes? I am coding in Python.

1- In my graph, there are nodes with the same name and I want to show them as seperate nodes in the graph, how can I do that?
 
The name of the node is its unique identifier. The appearance of the node depends on its label attribute. By default, the name is used as the label, but you can always do
n1 [label="same name"]
n2 [label="same name"]
 
causing n1 and n2 to appear the same.

2- I want to draw a rectangular around a set of my nodes. How can I do that?
 
Enclose them in a cluster subgraph, e.g.,
 
subgraph cluster0 {
  a -> b
}
 
A cluster subgraph is any subgraph whose name starts with "cluster". They must properly nest.
 

Recent comments