Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You could construct a directed graph (DAG) where each stop belonging to a route is a node and each transition between two stops in a trip is an edge. Then, you could perform a topological sorting of the graph (<a href="http://en.wikipedia.org/wiki/Topological_sorting" rel="nofollow">http://en.wikipedia.org/wiki/Topological_sorting</a>) to get an ordering of the stops. Note that topological sorting only works for graphs that have no cycles, but some trips do in fact have cycles, so you would not want to add an edge if it created a cycle.</p> <p>This happens to be the algorithm used by the OneBusAway application suite for ordering stops: <a href="https://github.com/OneBusAway/onebusaway-application-modules/blob/master/onebusaway-transit-data-federation/src/main/java/org/onebusaway/transit_data_federation/impl/beans/RouteBeanServiceImpl.java#L281" rel="nofollow">https://github.com/OneBusAway/onebusaway-application-modules/blob/master/onebusaway-transit-data-federation/src/main/java/org/onebusaway/transit_data_federation/impl/beans/RouteBeanServiceImpl.java#L281</a></p> <p>Note that sometimes routes will have forks or branches, where there are two sets of stops (one for each branch) that don't interact with each other. A naive topological sort might arbitrarily interleave these stops, but the OBA code uses the following two heuristics to get a more natural ordering:</p> <p>1) Group stops in the same branch together.</p> <p>2) When ordering two branches relative to each other, put the branch closer in distance to the branch point first.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload