【发布时间】:2021-11-03 21:03:49
【问题描述】:
如何用库函数显示代码的执行进度?
import networkx as nx
graph=nx.erdos_renyi_graph(100000,.2)
visited = set() # Set to keep track of visited nodes of graph.
def dfs(visited, graph, node): #function for dfs
if node not in visited:
print (node)
visited.add(node)
for neighbour in graph[node]:
dfs(visited, graph, neighbour)
print("Following is the Depth-First Search")
dfs(visited, graph, '5000')
coms=nx.connected_components(graph)
【问题讨论】:
-
你可以使用tqdm
标签: python