import networkx as nx
import matplotlib.pyplot as plt
def adMmatrix2Img(matrix):
G=nx.Graph()
n = len(matrix)
point = []
for i in range(n):
point.append(i)
G.add_nodes_from(point)
edglist=[]
for i in range(n):
for k in range(i+1,n):
if matrix[i][k] > 0:
edglist.append((i,k))
G.add_edges_from(edglist)
position = nx.circular_layout(G)
nx.draw_networkx_nodes(G,position, nodelist=point, node_color="y")
nx.draw_networkx_edges(G,position)
nx.draw_networkx_labels(G,position)
plt.show()
if __name__=='__main__':
matrix = [[0, 2, 1, 1, 1, 1, 1, 2, 0, 0, 1, 1],
[2, 0, 1, 1, 1, 1, 1, 2, 0, 0, 1, 1],
[1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0],
[1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0],
[1, 1,