问题描述
- 一段matlab的代码翻译成java的
-
def find_all_paths(graph, start, end, path=):
path = path +
if start == end:
return
if not graph.has_key(start):
return
paths =
for node in graph:
if node not in path:
newpaths = find_all_paths(graph, node, end, path)
for newpath in newpaths:
paths.append(newpath)
return paths
麻烦帮忙翻译成java语言的, 没法翻译的地方麻烦帮忙加点注释, 非常感谢
时间: 2024-11-29 19:35:53