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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T13:15:56+00:00 2026-05-28T13:15:56+00:00

I have a directed acyclic graph and need to find the shortest paths with

  • 0

I have a directed acyclic graph and need to find the shortest paths with resource constraints. My constraint is that the paths selected must have a minimum number of a set resource consumed.

Currently I am using Yen’s K Shortest Path algorithm to calculate K shortest paths and then only accept those that satisfy my constraint. The issue here is in guessing K, as if it is incorrectly chosen, it is possible that no feasible paths will be found.

I have found quite a lot of literature on this topic, this provides a good overview I think. However, I am struggling to make sense of it and find a concise algorithm that is able to be implemented (I am using Python, however any clear algorithmic ideas would be great).

I understand that this problem is NP-Complete, and as such I am interested in any good approximation algorithms as well as exact approaches.

Anyone have any good recommendations?

  • 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-28T13:15:57+00:00Added an answer on May 28, 2026 at 1:15 pm

    What you can do is to transform your graph (V,E) into (V',E') where

    • P(v) is the price of the original node v
    • R is the maximum resource use.
    • V' = {(v,k) | v in V and k in [0..R]}
    • E'((v,k),(w,l)) = E(v,w) and k+P(w)=l

    Then you do a dijkstra search from (v0,P(v0)). If it was possible to find a path to v1, given the limit, the shortest distance to it, will be the shortest among the (v1,k) vertices.

    You obviously don’t create the actual expanded graph. What would be going on in your modified dijkstra is that in addition to the distance so far, you would keep the resource use so far as well. You would only follow a path if it didn’t exceed the limit. And instead of keeping a dist[v] you would keep dist[v,k] representing the shortest path to v so far, using exactly k resources.

    If your resource bound is very large, this can potentially grow as big. Hence the NP completeness. However if your resource bound is small, or you don’t mind rounding of to nearest 10, 100 or 1000, it will run in fast polynomial time.
    Especially if you implement the optimization of stopping once you’ve reached a useable (v1,k).

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

Sidebar

Related Questions

I have an XML file that encodes a directed acyclic graph (DAG) that represents
I have a large directed acyclic graph that I would like to visualize in
I have a d3 force-directed graph that contains a group of nodes: var node
I have an acyclic directed graph. I would like to assign levels to each
Suppose that you have a directed graph with nonnegative, integer edge lengths that are
I have a graph with an s and t vertex that I need to
Let's assume that a graph in question is a DAG (directed acyclic graph). Question
I have a large (100,000+ nodes) Directed Acyclic Graph (DAG) and would like to
I have a directed graph described by A -> B meaning that there exists
I have a directed graph whose vertices have costs. I would like to find

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.