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

  • Home
  • SEARCH
  • 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 8606027
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T02:59:39+00:00 2026-06-12T02:59:39+00:00

i am using slightly modified Dijkstra algorithm in my app but it`s quite slow

  • 0

i am using slightly modified Dijkstra algorithm in my app but it`s quite slow and i know there have to be a lot better approach. My input data are bus stops with specified travel times between each other ( ~ 400 nodes and ~ 800 paths, max. result depth = 4 (max 4 bus changes or nothing).

Input data (bus routes) :

bus_id | location-from | location-to | travel-time | calendar_switch_for_today
XX | A | B | 12 | 1
XX | B | C | 25 | 1
YY | C | D | 5  | 1
ZZ | A | D | 15 | 0

dijkstraResolve(A,D, '2012-10-10') -> (XX,A,B,12),(XX,B,C,25),(YY,C,D,5) 
=> one bus change, 3 bus stops to final destination
* A->D cant be used as calendar switch is OFF

As you can imagine, in more complicated graphs where e.g. main city(node) does have 170 connections to different cities is Dijkstra slower (~ more then 5 seconds) because compute all neighbours first one by one as it`s not “trying” to reach target destination by some other way…

Could you recommend me any other algorithm which could fit well ?

I was looking on :

  • http://xlinux.nist.gov/dads//HTML/bellmanford.html (is it faster ?)

  • http://jboost.sourceforge.net/examples.html (i do not see
    straightforward example here…)

Would be great to have (just optional things) :
– option to prefer minimal number of bus changes or minimal time
– option to look on alternatives way (if travel time is similar)

Thank you for tips

  • 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-12T02:59:40+00:00Added an answer on June 12, 2026 at 2:59 am

    Sounds like you’re looking for A*. It’s a variant of Djikstra’s which uses a heuristic to speed up the search. Under certain reasonable assumptions, A* is the fastest optimal algorithm. Just make sure to always break ties towards the endpoint.

    There are also variants of A* which can provide near-optimal paths in much shorter time. See for example here and here.


    Bellman-Ford (as suggested in your question) tends to be slower than either Djikstra’s or A* – it is primarily used when there are negative edge-weights, which there are not here.

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

Sidebar

Related Questions

I am using the Android Hackbook app. I have slightly modified the code to
I'm using a slightly modified Soh Tanaka's Smart Columns , but in his example
~ I am using a very slightly modified version of the jQuery tooltip script
This is a slightly tricky question. I am using NSDateFormatter on the iPhone but
I'm using slightly modified sample code provided by the YUI team. When my source
I am using a slightly modified version of this code . to create a
I am using a slightly modified version of the Sun's example JTreeTable backed by
I have a slightly modified AccountController that should write a row into a table
I'm using a slightly modified version of Valum's upload [ github link ], I've
I am using a slightly modified version of the DotZlib which is part of

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.