Skip to content

Commit

Permalink
fat
Browse files Browse the repository at this point in the history
  • Loading branch information
PrasanthChettri committed May 17, 2023
1 parent ad3d8d5 commit 341e3d3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,17 @@ def create_cluster_graph(S, CHs):
for member in head.members:
G.add_edge(head, member)

# Add edges between BS and CH nodes
for head in CHs:
G.add_edge("BS", head)

# Create a layout for the graph
pos = nx.spring_layout(G)

# Draw nodes
nx.draw_networkx_nodes(G, pos, nodelist=S, node_color='blue', alpha=0.5)
nx.draw_networkx_nodes(G, pos, nodelist=CHs, node_color='red')
nx.draw_networkx_nodes(G, pos, nodelist=["BS"], node_color='green')

# Draw edges
nx.draw_networkx_edges(G, pos)
Expand All @@ -28,4 +33,4 @@ def create_cluster_graph(S, CHs):

# Show the graph
plt.axis('off')
plt.show()
plt.show()

0 comments on commit 341e3d3

Please sign in to comment.