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:
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:
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?
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.