此代码在python official essays on graph theory中给出。这里的代码: def find_all_paths(graph, start, end, path=[]):
path = path + [start]
if start == end:
return [path]
if not graph.has_key(
我需要能编写发现两个节点之间的最长路径Lisp的功能,无需任何重温节点。但是,如果开始和结束节点相同,则可以重新访问此节点。该功能需要同时是递归和深度优先搜索。 我一直试图在这个以获取小时,并不能拿出一个解决方案。我知道该函数的总体概述,但无法正确编程。在一些代码,主要是伪代码: (defun longest-path (start end net &optional (current-path