資源簡介
張曉峰UE報告.zip

代碼片段和文件信息
“““
**********************
#尋找路徑
**********************
“““
import?networkx?as?nx
import?matplotlib.pyplot?as?plt
from?collections?import??Counter
graph=nx.DiGraph()
nodes_list=[123456789101112131415161718192021222324]
edges_list=[(12)(13)(21)(26)(31)(312)(34)(43)(411)(45)(54)(59)(56)(65)(62)(68)(78)(718)
????????????(86)(89)(87)(816)(95)(910)(98)(1011)(109)(1015)(1016)(1017)(114)(1110)(1112)(1114)
????????????(123)(1211)(1213)(1312)(1324)(1411)(1415)(1423)(1510)(1514)(1522)(1519)(168)(1610)(1617)(1618)
????????????(1710)(1716)(1719)(187)(1816)(1820)(1915)(1917)(1915)(1920)(2018)(2019)(2021)(2022)(2120)(2122)(2124)
????????????(2215)(2223)(2220)(2221)(2314)(2322)(2324)(2413)(2421)(2423)]
#edges_list=[(12)(13)(26)(34)(45)(56)(59)(68)(78)(89)]
edge_length?=?[1?+?0.1*i?for?i?in?range(len(edges_list))]
for?i?e?in?enumerate(edges_list):?graph.add_edge(*e?weight?=?edge_length[i])
#graph.add_edge()
for?n?in?nodes_list:
????graph.add_node(n)
nx.draw_networkx(graph)
plt.draw()
plt.show()
path_iter=nx.all_simple_paths(graph110)
pathes?=?[]
for?p?in?path_iter:
????pathes.append(p)
print(pathes)
print(len(pathes[1]))
m1=[0]*76
print(m1)
path_matrix=[]
print(len(pathes)-1)
for?i?in?range(0len(pathes)-1):
????for?j?in?range(0len(pathes[i])-1):
????????if?pathes[i][j]==1?and?pathes[i][j+1]==2:
????????????m1[0]=1
????????elif?pathes[i][j]==1?and?pathes[i][j+1]==3:
????????????m1[1]=1
????????elif?pathes[i][j]==2?and?pathes[i][j+1]==1:
????????????m1[2]=1
????????elif?pathes[i][j]==2?and?pathes[i][j+1]==6:
????????????m1[3]=1
????????elif?pathes[i][j]==3?and?pathes[i][j+1]==1:
????????????m1[4]=1
????????elif?pathes[i][j]==3?and?pathes[i][j+1]==4:
????????????m1[5]=1
????????elif?pathes[i][j]==3?and?pathes[i][j+1]==12:
????????????m1[6]=1
????????elif?pathes[i][j]==4?and?pathes[i][j+1]==3:
????????????m1[7]=1
????????elif?pathes[i][j]==4?and?pathes[i][j+1]==5:
????????????m1[8]=1
????????elif?pathes[i][j]==4?and?pathes[i][j+1]==11:
????????????m1[9]=1
????????elif?pathes[i][j]==5?and?pathes[i][j+1]==4:
????????????m1[10]=1
????????elif?pathes[i][j]==5?and?pathes[i][j+1]==6:
????????????m1[11]=1
????????elif?pathes[i][j]==5?and?pathes[i][j+1]==9:
????????????m1[12]=1
????????elif?pathes[i][j]==6?and?pathes[i][j+1]==2:
????????????m1[13]=1
????????elif?pathes[i][j]==6?and?pathes[i][j+1]==5:
????????????m1[14]=1
????????elif?pathes[i][j]==6?and?pathes[i][j+1]==8:
????????????m1[15]=1
????????elif?pathes[i][j]==7?and?pathes[i][j+1]==8:
????????????m1[16]=1
????????elif?pathes[i][j]==7?and?pathes[i][j+1]==18:
????????????m1[17]=1
????????elif?pathes[i][j]==8?and?pathes[i][j+1]==6:
????????????m1[18]=1
????????elif?pathes[i][j]==8?and?pathes[i][j+1]==7:
????????????m1[19]=1
????????elif?pat
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2018-09-25?08:18??張曉峰UE報告\
?????目錄???????????0??2018-09-24?17:16??張曉峰UE報告\UE代碼\
?????文件???????10652??2018-09-24?21:33??張曉峰UE報告\UE代碼\ue.py
?????文件??????180106??2018-09-24?21:43??張曉峰UE報告\UE算法.docx
?????目錄???????????0??2018-09-25?08:17??張曉峰UE報告\參考代碼\
?????目錄???????????0??2018-09-25?08:17??張曉峰UE報告\參考代碼\matlab\
?????文件???????26112??2017-01-02?17:13??張曉峰UE報告\參考代碼\matlab\1.xls
?????文件????????1157??2016-12-30?15:26??張曉峰UE報告\參考代碼\matlab\Dijkstra.m
?????文件????????1130??2017-01-13?23:34??張曉峰UE報告\參考代碼\matlab\book.m
?????文件????????1464??2017-01-07?23:28??張曉峰UE報告\參考代碼\matlab\example1.m
?????文件????????1303??2017-01-07?23:45??張曉峰UE報告\參考代碼\matlab\example2.m
?????文件????????2598??2018-09-22?15:35??張曉峰UE報告\參考代碼\matlab\example3.m
?????文件????????6253??2018-09-24?08:38??張曉峰UE報告\參考代碼\用戶平衡尋找路徑.py
?????目錄???????????0??2018-09-24?17:14??張曉峰UE報告\數據表格\
?????文件????????9746??2018-09-23?10:35??張曉峰UE報告\數據表格\單車道通行能力.xlsx
?????文件????????9651??2018-09-23?10:42??張曉峰UE報告\數據表格\自由流時間.xlsx
?????文件????????9056??2018-09-14?20:36??張曉峰UE報告\數據表格\節點信息純表.xlsx
?????文件????????9755??2018-09-23?10:34??張曉峰UE報告\數據表格\路段信息表.xlsx
- 上一篇:F41 bios3.13
- 下一篇:電子相冊管理系統源碼
評論
共有 條評論