我正在尝试在python中重写此函数以查找图形的两个节点之间的所有路径并在Fortran 90中创建子例程:
public interface MutableLiveList<T> extends List<T> {
public interface ChangeListener {
void onChange(MutableLiveList<T> list);
}
void addChangeListener(ChangeListener listener);
void removeChangeListener(ChangeListener listener);
}
我有两个问题:
我想知道在Fortran中def find_all_paths2(graph, start, end):
path = []
paths = []
queue = [(start, end, path)]
while queue:
start, end, path = queue.pop()
print queue
path = path + [start]
if start == end:
paths.append(path)
for node in set(graph[start]).difference(path):
queue.append((node, end, path))
return paths
数组的最有效方法是什么? (我需要预留一个巨大的内存空间吗?)
Fortran中是否存在相当于append
的内置函数?