Skip to content

Instantly share code, notes, and snippets.

@karussell
Last active January 21, 2019 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save karussell/1c6a387d8cb7a7f7d0accc16c199b11c to your computer and use it in GitHub Desktop.
Save karussell/1c6a387d8cb7a7f7d0accc16c199b11c to your computer and use it in GitHub Desktop.

Overview comments on #1247 on certain things not in the java docs:

  • we introduce a way to store the original first and last edge so that we do not need to store the turn cost multiple times (e.g. for every new shortcut)
  • The EdgeBasedNodeContractor plays the key part of this algorithm:
    • Assume source and target nodes s and t connected like *->s-->x-->t->* and you want to contract x (center node). In order to determine if a shortcut s->t is required the contractor implements the AggressiveStrategy class that searches from all incoming edges of s to all outgoing edges of t
    • The unidirectional, edge-based Dijkstra search is done in the separate WitnessPathSearcher class, handling lots of special cases (see EdgeBasedNodeContractorTest for more details)
    • General CH concept: if there is a witness path with weight w1 and a bridge path with w2, and it is w1<w2; only then you do not need to add a shortcut when contracting x
  • The current default for query time is the A* algorithm unlike the node-based CH where this is slightly slower. AStarBidirectionEdgeCHNoSOD has special methods like bwdSearchCanBeStopped
  • Why is s->a->x->t a witness path and not a bridge path? Simply because we'll handle adding shortcut when s=a. This could be used for node-based preparation too, to further reduce adding shortcuts. Currently we explicitly skip x there, which might lead to a new shortcut in the case of s->a->x->t.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment