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 6042413
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T06:47:15+00:00 2026-05-23T06:47:15+00:00

I’m facing a path finding problem in which I have to find every possible

  • 0

I’m facing a path finding problem in which I have to find every possible path from one point to another. It would be very easy if it was just that – I’d use a breadth-first algorithm, just like the one explained here.

The problem is that, in this case, every edge has a maximum number of times that can be used. Let’s see it with an example:

Example graph

In this case, I can go 15 times from A to D. The first 10 times, the path would be A -> B -> C -> D. The remaining 5 times, the path would be A -> C -> D.

So far I’ve been able to implement a solution (using python) but it’s quite slow for medium problems (about 30 nodes). I have an unweighted graph (as I don’t mind the length of the path) with the possible connections between the different nodes, and separately I have a matrix with the usage limit of each edge.

So, inside a loop:

  • I find a single possible path.
  • I update the matrix of usages. The usage of that path would be the minimum of the usages of the edges (as in, you can use a path as many times as the part of the path with the minimum limit).
  • For each edge whose usage reaches 0, it means it can no longer be used, so I delete it from the graph.
  • Loop until all paths are found.

As I said, this works, but it’s quite slow. I’ve been able to increase the overall performance by sorting the list of edges for each node based on the number of times it can use, but it’s still slow.

Any clues?

  • 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-05-23T06:47:16+00:00Added an answer on May 23, 2026 at 6:47 am

    You could present your problem as a maximum flow problem. Instead of saying that you can travel A to B 10 times, you might say A to B may accomodate a flow of 10 m^3/s. And your graph is a network of pipes that may accomodate a total flow of 15m^3/s from A to D. So you may start with a look at the algorithms listed here on wikipedia.

    There are some points that are unclear to me in your problem. Depending on your answer, it might not qualify as a flow problem.

    1. If you increase the A to C capacity to 6, the maximum flow from A to D is still 15, but there are several ways to realise that (either 6 directly to C and 9 through B or 5 and 10). Are you satisfied with any of these answers or do you want them all ? In the same spirit, if there were another path from A to C (say through a node E) would you accept it to be ignored in the results, as C to D is saturated anyway.
    2. If there were a cycle in a graph (say an edge from C back to B) would you count going through this cycle never, once, twice or more as different solutions.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to replace javascript w/ HTML if JavaScript is not enabled on
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Seemingly simple, but I cannot find anything relevant on the web. What is the
Does anyone know how can I replace this 2 symbol below from the string
this is what i have right now Drawing an RSS feed into the php,
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have just tried to save a simple *.rtf file with some websites and
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but

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.