Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8506299
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T02:33:22+00:00 2026-06-11T02:33:22+00:00

I want to find all possible paths in a directed cyclic graph. I have

  • 0

I want to find all possible paths in a directed cyclic graph. I have written a program which does so, but I notice that if the number of nodes grow above 40 or 50, it starts taking infinite time.

Theoretically speaking how many paths are possible for a directed cyclic graph of N nodes. Is it like factorial(N) or something? Can you give me a guess for the following example with 119 nodes. Of course, I am going over loops only once, so you can ignore the cyclic paths.

Graph Image

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T02:33:24+00:00Added an answer on June 11, 2026 at 2:33 am

    Let’s just take this common pattern that shows in your graph:

    A ---> B
    |     /|
    |    / v
    |   /  C
    |  /   |
    | /    |
    vv    /
    D <---
    

    Excuse the ASCII art. So you have three paths here: A -> D, A -> B -> D, and A -> B -> C -> D.

    Now say you have the exact same figure emanating from D to another node G:

    D ---> E
    |     /|
    |    / v
    |   /  F
    |  /   |
    | /    |
    vv    /
    G <---
    

    You have the same analogous three paths as before: D -> G, D -> E -> G, and D -> E -> F -> G.

    Now, how many paths are there from A to G?

    To get from A to G, you have to get from A to D. You can do this in one of three ways. Then you have to get from D to G. You can do this in one of three ways. These two choices (A to D and D to G) are independent of each other. Thus you have 3 * 3 = 9 possible paths from A to G.

    If you keep repeating the figure, you multiply the number of possible paths by 3 with each repetition. So with three figures, 27 paths; with four figures, 81 paths; etc.

    That’s exponential growth. Put differently: you’ll have to find another way to do what it is you’re doing, if you want to be efficient about it.

    EDIT: To get a rough estimate: only counting those figures, not even looking at the complex jumbles in the middle, I get 3 * 3 * 3 * 3 * (2^8) * (4^8) * 3 * 3 * 2 * 3 = 73383542784 possible paths, through just those simple nodes.

    EDIT: You seem to be doing code analysis. Without knowing exactly what you want to do, what I recommend is consolidating whatever information you’re gathering along those nodes that must be reached (e.g. nodes A, D, and G in my example figures). Then do a search until you get to the next node that must be reached, and gather your info there as well. This will prevent exponential blow-up.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have 10 currencies I am analysing, and I want to find all possible
First of all, I have never written a property editor from scratch, but had
I have a random undirected social graph. I want to find a Hamiltonian path
I want to find all possible routes from point A to point B (not
I have a script where I want to find all direct subdirectories that is
I want find all Saturdays and Sundays in A given month. How can I
I want to find all the demo words using PHP and regEx. $input ='demo';
I want to find all foreign keys in a table, and for each foreign
I want to find all items in one collection that do not match another
I want to find all stylesheet definitions in a XHTML file with lxml.etree.findall .

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.