Suppose that we have a complete graph with n=5 vertices:


We want to identify the set of all the paths (acyclic), for example, from 1 to 4: 1->2->3>4 or 1->3->4 or 1->4 etc. Needless to say, for small n, the paths can be manually identified. I have a large n and my graph is not complete. So, the question is: how one can identify all the (acyclic) paths from s to t in a directed graph.

  • 4
    $\begingroup$ FindPath[g, s, t, Infinity, All]? $\endgroup$ – Carl Woll Oct 6 '18 at 0:45
  • $\begingroup$ @CarlWoll: Thanks for your answer. It works for me. I hope you would not mind if I have a follow question. Therefore, I edited my question to formulate the main question. Thanks again. $\endgroup$ – Tugrul Temel Oct 6 '18 at 13:17
  • $\begingroup$ @CarlWoll: I will post a separate question not to confuse others with my previous question. $\endgroup$ – Tugrul Temel Oct 6 '18 at 13:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.