def _get_nodes_in_all_shortest_paths_helper(graph, nodes, weight=None):
for u, v in product(nodes, repeat=2):
try:
paths = all_shortest_paths(graph, u, v, weight=weight)
for path in paths:
yield path
except nx.exception.NetworkXNoPath:
continue
评论列表
文章目录