# -*- coding: utf-8 -*-
"""
Created on Wed Nov 23 21:11:34 2022
@author: 123
"""
import networkx as nx
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
df=np.load('C:/Users/123/Desktop/liu.npy',allow_pickle=True)
edges=list(zip(df[:,0], df[:,1]))
G=nx.Graph()
G.add_edges_from(edges)
pos=nx.spring_layout(G)#决定画的形状
# pos=nx.random_layout(G)
Gdegree=nx.degree(G)
Gdegree=dict(Gdegree)
Gdegree=pd.DataFrame({'name':list(Gdegree.keys()),'degree':list(Gdegree.values())})
plt.figure(figsize=(40,40))
nx.draw_networkx_nodes(G,pos,alpha=0.5,node_size=20,node_color='#ff0000')
nx.draw_networkx_edges(G, pos=pos, width=0.3, alpha=0.1)#边的样式
# nx.draw_networkx_labels(G,pos,font_size=10)
plt.axis('off')
plt.savefig(r'C:/Users/123/Desktop/1.png')
plt.show()