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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T06:57:52+00:00 2026-05-11T06:57:52+00:00

Finding routes for a car is pretty easy: you store a weighted graph of

  • 0

Finding routes for a car is pretty easy: you store a weighted graph of all the roads and you could use Djikstra’s algorithm [1]. A bus route is less obvious. With a bus you have to represent things like ‘wait 10 minutes for the next bus’ or ‘walk one block to another bus stop’ and feed those into your pathfinding algorithm.

It’s not even always simple for cars. In some cities, some roads are one-way-only into the city in the morning, and one-way-only out of the city in the evening. Some advanced GPSs know how to avoid busy routes during rush hour.

How would you efficiently represent this kind of time-dependent graph and find a route? There is no need for a provably optimal solution; if the traveler wanted to be on time, they would buy a car. 😉

[1] A wonderful algorithm to mention in an example because everyone’s heard of it, though A* is a likelier choice for this application.

  • 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. 2026-05-11T06:57:53+00:00Added an answer on May 11, 2026 at 6:57 am

    I have been involved in development of one journy planner system for Stockholm Public Transportation in Sweden. It was based on Djikstra’s algorithm but with termination before every node was visited in the system. Today when there are reliable coordinates available for each stop, I guess the A* algorithm would be the choise.

    Data about upcoming trafic was extracted from several databases regularly and compiled into large tables loaded into memory of our search server cluster.

    One key to a sucessfull algorith was using a path cost function based on travel and waiting time multiplied by diffrent weightes. Known in Swedish as “kresu’-time these weighted times reflect the fact that, for example, one minute’s waiting time is typically equivalent in “inconvenience” to two minutes of travelling time.

    KRESU Weight table

    • x1 – Travel time
    • x2 – Walking between stops
    • x2 – Waiting at a stop during the journey. Stops under roof, with shops, etc can get a slightly lower weight and crowded stations a higher to tune the algorithm.
    • The weight for the waiting time at the first stop is a function of trafic intensity and can be between 0.5 to 3.

    Data structure

    Area A named area where you journey can start or end. A Bus Stop could be an area with two Stops. A larger Station with several platforms could be one area with one stop for each platform. Data: Name, Stops in area

    Stops An array with all bus stops, train and underground stations. Note that you usually need two stops, one for each direction, because it takes some time to cross the street or walk to the other platform. Data: Name, Links, Nodes

    Links A list with other stops you can reach by walking from this stop. Data: Other Stop, Time to walk to other Stop

    Lines/Tours You have a number on the bus and a destination. The bus starts at one stop and passes several stops on its way to the destination. Data: Number, Name, Destination

    Nodes Usually you have a timetable with the least the time for when it should be at the first and last stop in a Tour. Each time a bus/train passes a stop you add a new node to the array. This table can have millions of values per day. Data: Line/Tour, Stop, Arrival Time, Departure Time, Error margin, Next Node in Tour

    Search Array with the same size as the Nodes array used to store how you got there and the path cost. Data: Back-link with Previous Node (not set if Node is unvisited), Path Cost (infinit for unvisited)

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

Sidebar

Related Questions

Finding articles with ANY of a set of tags is a relatively simple join,
For finding the nearest neighbor, Space Partitioning is one of the algorithms. How does
I'm having trouble finding any resource for adding ctrl-z undo capability to a Flex
Possible Duplicate: Finding the Variable Name passed to a Function in C# In C#,
Possible Duplicates: Finding duplicate files and removing them. In Python, is there a concise
I am actually finding that chkContactType.Items is empty when I step through the code.
I'm finding it difficult to find a decent example on how to implement a
I'm finding this problem every now and then in my production website, and it
I'm finding that with dynamic linking, even with SxS, Windows Update will come along
I remember finding a C++ (or maybe plain C) library which does thread pooling,

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.