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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T19:56:10+00:00 2026-06-13T19:56:10+00:00

I have a directed acyclic graph (DAG) with a weight associated with each node.

  • 0

I have a directed acyclic graph (DAG) with a weight associated with each node. I want to find the top ‘n’ (e.g. 5) most weighty paths, where a path’s weight is defined as the sum of all the weights of it’s nodes. How can I accomplish this?

Accuracy is desirable, but can be sacrificed for performance. Potentially, the graph can have 10,000+ nodes and/or edges.

Edit: Weights will be numbers greater than or equal to zero.

  • 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-13T19:56:12+00:00Added an answer on June 13, 2026 at 7:56 pm
    1. Topologically sort the graph.
    2. Associate each graph’s node with n-element priority queue (min-heap).
    3. For each node (in sorted order), pop path weights from the priority queue, add node’s weight, and pass them to every descendant. When a node receives weight from its parent, it should insert it into associated priority queue.
    4. For each leaf node, pop path weights from the priority queue, add node’s weight, and insert them into one common priority queue. After last node is processed, this priority queue contains weights for ‘n’ most weighty paths. If along with weight, you store back pointers, you can restore these paths.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a directed acyclic graph and need to find the shortest paths with
I have a directed-graph, each node is a complex data type. Does anyone know
I have an acyclic directed graph. I would like to assign levels to each
I have a large (100,000+ nodes) Directed Acyclic Graph (DAG) and would like to
I have a directed graph with two directed paths in it. I want an
I have an XML file that encodes a directed acyclic graph (DAG) that represents
I have a d3 force-directed graph that contains a group of nodes: var node
I have a directed, positive weighted graph. Each edge have a cost of use.
I have the following directed graph implementation Nodes nod[] List<Arcs> arc[] So the node
Let's assume that a graph in question is a DAG (directed acyclic graph). Question

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.