Java: Count all possible Paths between two Vertices

Level : Advanced
Mentor: Shailendra Chauhan
Type : GuidedLab
Points : 10
Duration : 00:40:00

Lab Details

Problem Statement:

Count the total number of ways or paths that exist between two vertices in a directed graph.

These paths don’t contain a cycle, the simple enough reason is that a cycle contains an infinite

number of paths and hence they create a problem

For the following Graph:


Count paths between A and E


Total paths between A and E are 4
The 4 paths between A and E are:
A -> E
A -> B -> E
A -> C -> E
A -> B -> D -> C -> E
Self-paced Membership
  • 22+ Video Courses
  • 800+ Hands-On Labs
  • 400+ Quick Notes
  • 55+ Skill Tests
  • 45+ Interview Q&A Courses
  • 10+ Real-world Projects
  • Career Coaching Sessions
  • Email Support
Upto 60% OFF
Know More
Still have some questions? Let's discuss.
Accept cookies & close this