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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T11:44:43+00:00 2026-05-16T11:44:43+00:00

I am using Dijkstra algorithm in a program. Suppose I have a graph with

  • 0

I am using Dijkstra algorithm in a program. Suppose I have a graph with vertices and edges. If we imagine all the edges starting from source vertex “a” are as below

a-->b        
a-->c   and  
a-->d  

and all the edges ending to vertex “f” are:

b-->f
m-->f
e-->f
w-->f

what I need to know from the beginning is that, I want the edge a–>b as my starting edge (assume “a” as start point) so do not need to search for the other neighbors of “a” i.e. (a-->c and a-->d)

Also I only want the paths which end to m–>f (assume “f” as the destination) i.e. I do not want the path containing b-->f,m-->f,e-->f,w-->f

So is it a good idea to trim my initial graph as such it doesn’t contain these edges and then apply Dijkstra on that?

Actually finding these edges needs some searches. I wonder if it is worth (considering time or CPU usage) doing searches and trimming my graph or there is a better way?

  • 1 1 Answer
  • 3 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-16T11:44:44+00:00Added an answer on May 16, 2026 at 11:44 am

    Why not just search for a path from b to m then and add the edges you want after that? If you really need it, you may add a special case to exclude edges containing a and f from ever being added to the stack — you’d have to check if that makes it faster overall, my bet is that it will on small graphs but not on really huge ones (it only changes speed by a constant factor anyways).

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

Sidebar

Related Questions

I have a project where I'm implementing Dijkstra's shortest path algorithm using C++ classes.
I'm working on a Dijkstra algorithm for university using a PriorityQueue to store the
I have implemented a Bellman-Ford algorithm to solve a problem (with a graph), but
I have designed a weighted graph using a normalized adjacency list in mysql. Now
I am using Dijkstra algorithm in PHP. But I got this error Fatal error:
Using Java,I have to fetch multiple sets of values from an XML file to
In the big picture, I'm trying to implement Dijkstra's algorithm using a priority queue.
In Python, I have a Graph class that has a dictionary of vertex objects.
Using TortoiseSVN against VisualSVN I delete a source file that I should not have
I have a project regarding the Dijkstra's algorithm with a canvas to draw the

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.