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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T21:39:54+00:00 2026-06-03T21:39:54+00:00

I need to write algorithms finding the lightest path tree in directed and weighted

  • 0

I need to write algorithms finding the lightest path tree in directed and weighted graph.
(should be efficient as possible)
I’m getting a vertex S and need to build a paths tree from S to all vertex that can be approach from S so the paths in the tree are the lightest ( path weight is the path without the ends)

I thought about first calculating all the distances from S And then for each path there will be a new weight:
The weight minus The ends
And then on the graph with the new weights to run dijkstra…

Will it work? Is it efficient enough? How to calculate the distances?

  • 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-03T21:39:57+00:00Added an answer on June 3, 2026 at 9:39 pm

    Your comments suggest you are actually looking for the shortest path from a single source – to all vertices.

    Have a look at how Dijkstra’s algorithm works. The algorithm starts with a tree of size 1 (the source alone), and iteratively adds vertices to the tree. In the end, the tree created by dijkstra’s algorithm, represent the shortest path from the source to each of the nodes in the graph.

    Note that dijkstra’s algorithm, needs a weight function on edges, while your weight function is on vertices. It can be solved easily by defining a new weight function w':E->R: w'(u,v) = w(u) (it works since you don’t want to count the end).

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

Sidebar

Related Questions

I need to write code which should find distance of chars. I think i
Possible Duplicate: Graph implementation C++ Hi I was wondering about a quick to write
I need to write an algorithm that reads keyboard stream until it gets a
I need to write a round robin algorithm to schedule load to n endpoints?
I need to write a simple source control system and wonder what algorithm I
I need to write, in JavaScript (I am using jQuery), a function that is
I need to write a small console app (patch) that turns off the print
I need to write a shell script to be scheduled to run daily to
I need to write an app that reads a config file with info on
I need to write a large amount of data in my application. Data arrive

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.