prolog graph depth first search
问题 I've seen other questions about depth first search but my problem is slightly different and I really don't get it. In prolog, I represent my undirected graph like this: [0-[1,5], 1-[0,2], 2-[1,3], 3-[2,0], 5-[0]] Which is a set of key-value, where the key represents the node and the list: -[] represents its neighbors. I don't know how to do a depth first search with this model. I've tried many solution. I want a really basic recursive algorithm like this one: dfs(v, visited): if visited[v]