Я хотел создать график, похожий на этот.
![enter image description here](https://i.stack.imgur.com/cne6N.png)
Но для моего кода я получаю график, подобный приведенному ниже
![enter image description here](https://i.stack.imgur.com/WSmtO.png)
Я ввел следующий код, импортируя graphviz. Я прошу кого-нибудь помочь мне внести изменения в него, чтобы получить требуемый код.
from graphviz import Graph
g = Graph('G', filename='cluster.gv')
a=['1','2','3','4']
b=['5','6','7','8']
with g.subgraph(name='cluster_0') as c:
c.attr(color='lightgrey')
c.node_attr.update(style='filled', color='red')
for i in a:
c.node(str(i),shape='circle')
c.attr(label='partition #1')
with g.subgraph(name='cluster_1') as c:
c.attr(color='lightgrey')
c.node_attr.update(style='filled', color='blue')
for i in b:
c.node(str(i),shape='circle')
c.attr(label='partition #2')
g.edge('1','5')
g.edge('1','3')
g.edge('2','7')
g.edge('5','8')
g.view()
Заранее спасибо