title: Find all paths between nodes in an undirected graph
body: <p>I have defined the following network:</p>
  <pre><code>connected(d,f).
  connected(d,a).
  connected(d,b).
  connected(d,c).
  connected(c,a).
  connected(c,b).
  connected(c,e).
  connected(b,e).
  
  connected(X,Y) :- 
      edge(X,Y).
  connected(X,Y) :- 
      edge(Y,X).
  </code></pre>
  <p>I need to find all paths between two specified nodes and write them out. I have found a previous post that gives a way to check if there is a path between two nodes but I cannot think of a way how to write out the paths.</p>
  <pre><code>path(A,B) :-   % two nodes are connected, if
    walk(A,B,[]) % - if we can walk from one to the other,
    .            % first seeding the visited list with the empty list
  
  walk(A,B,V) :-       % we can walk from A to B...
    edge(A,X) ,        % - if A is connected to X, and
    not(member(X,V)) , % - we haven't yet visited X, and
    (                  % - either
      B = X            %   - X is the desired destination
    ;                  %   OR
      walk(X,B,[A|V])  %   - we can get to it from X
    )                  %
    .                  % Easy!
  </code></pre>