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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T22:23:29+00:00 2026-06-14T22:23:29+00:00

I am working on solving this problem: Professor Gaedel has written a program that

  • 0

I am working on solving this problem:

Professor Gaedel has written a program that he claims implements Dijkstra’s algorithm.
The program produces v.d and v.π for each vertex v in V. Give an
O.(V + E)-time algorithm to check the output of the professor’s program. It should
determine whether the d and π attributes match those of some shortest-paths tree.
You may assume that all edge weights are nonnegative.

v.d is the shortest distance from starting node to v.
v.π is v’s predecessor in the shortest path from starting node to v

My idea is:
For every vertex (i), compare i.d with (i.π).d. If i’s predecessor has a larger d value then we cannot have a shortest-path tree.

I believe this can check if the professor’s output is not a shortest-path tree, but I don’t think it can confirm that the output is a shortest-path tree. I cannot think of a way to do this without more information.

Am I on the right track?

  • 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-14T22:23:31+00:00Added an answer on June 14, 2026 at 10:23 pm

    I think this would work

    Do a DFS, but instead of following the regular graph edges, follow only the π value for each vertex. You’re doing this to produce a topological ordering, so that the first vertex to finish will be the first vertex in the topological ordering. Note that the first vertex in the topo sort you produce will be the “source” vertex that was given to Gaedel’s algorithm.

    Now that you have a topo ordering, you can relax edges in the most efficient order, just like how you would do it on a DAG.

    for each v in topoSortedVerts
        if v.d_verify != v.d_Gaedel
            //fail
    
        for each u in v.adjacencies
            relax(v, u)
    
    if v.d_verify != v.d_Gaedel
        //fail
    

    I think you may also need to make sure all V verts are considered, and that the source vertex matches. Maybe. Also, I guess Gaedel’s predecessor subgraph induced by the π values could be real jacked up and have all kinds of crazy things wrong with it, but I assume it doesn’t.

    It is O(V + E) because the outer loop runs V times, and the inner loop runs E times using aggregate analysis.

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

Sidebar

Related Questions

Summary: How would I go about solving this problem? Hi there, I'm working on
I have been working on this site, http://hidden.xx The problem is that the <body>
I'm working on university scheduling problem and using simple genetic algorithm for this. Actually
Ok, I have been working on solving this problem all day, and I am
I am solving this problem of rotating an array and got algorithm and code
Working on solving a simple problem in C++, want to understand how I could
I'm working on a web application. One of my co-workers has written some asp.net
I hope somebody can assist in pointing out my ignorance by solving this problem...
I'm working on solving the Project Euler problem 25: What is the first term
I have this banner rotator which is working fine except for one problem... This

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.