- 博客(4)
- 收藏
- 关注
原创 python 将数据写入txt文件中
edge=[0,1,2,3,4,5]file = open(r'text1.txt', mode='w')file.write('\n') #将回车写入txt文件中file.write(' ') #将空格写入txt文件中file.write('abc') #将abc写入 txt文件中file.write(str(edge[0])) #将数组数据第0号元素写入tx...
2019-09-10 16:11:53
18024
原创 python使用matplotlib画图
matplotlib安装先下载matplotlib包下载网址https://www.lfd.uci.edu/~gohlke/pythonlibs/pip install numpy+mklPip install scipy…为了画频谱图,安装第三方库先后顺序如下(后者因为依赖前者,所以必须按顺序):1.numpy+mkl2.scipy3.six4.python_dateutil...
2019-09-10 15:58:08
184
原创 python算法将有向图邻接矩阵形式变成邻接链表形式
GF = [[0,4,6,0,0], [0,0,2,3,0],[0,0,0,0,4],[0,0,0,0,5],[0,0,0,0,0]]g={}for i in range(len(GF)): a=[] for j in range(len(GF)): if GF[i][j]!=0: a.appe...
2019-09-10 15:49:05
1875
原创 python算法有向图的最大流和最小割及割边输出
import copyfrom collections import dequedef hasPath(Gf, s, t, path):# BFS algorithmV = len(Gf)visited = list(range(V))for i in range(V):visited[i] = Falsevisited[s] = Truequeue = deque([s])w...
2019-09-10 14:22:53
2098
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人