'Understand node ordering of contraction hierarchies
Looking at wiki's description on node ordering of contraction hierarchies https://en.wikipedia.org/wiki/Contraction_hierarchies
I can't seem to understand how they come up with this "correct" order.
I have followed some heuristics from several papers on the subject. Those most include edge difference and increasing cost of neighbors when contraction happens. (also mentioned on wiki)
Following those heuristics my algorithms looks like:
- First run over all nodes in the graph and compute edge difference (look out/ingoing edges and subtract number of edges made through contraction).
- Use this list for the contraction phrase. Get the node with min value. At contraction, add +1 to the cost to it's adjacency nodes.
I come up with the following contraction order which is not the same as wiki papers.
node order list after edge difference = {-1, -1 ,-1 ,-1 ,-1, -1}, c = contracted.
Contract node 0, add +1 to node 1 as it's a neighbor. node order list now = {c, 0 ,-1 ,-1 ,-1, -1}
Contract node 2, add +1 to node 1 and 3. node order list now = {c, 1 ,c ,0 ,-1, -1}
Contract node 4, add +1 to node 3 and 5. node order list now = {c, 1 ,c ,1 ,c, 0}
Contract node 5, no neighbors. node order list now = {c, 1 ,c ,1 ,c, c}
Contract node 1, no neighbors. node order list now = {c, c ,c ,1 ,c, c}
Contract node 3, no neighbors. node order list now = {c, c ,c ,c ,c, c}
This only gives two shortcuts, one between 1 and 3 and the other one between 3 and 5, but missing one from 1 to 5. Wiki's example gives 3 shortcuts including the last mentioned.
What am I missing?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|

