LdDl / ch

Contraction Hierarchies (with bidirectional version of Dijkstra's algorithm) technique for computing shortest path in graph.
Apache License 2.0
46 stars 5 forks source link

[DOCUMENTATION] Convenient code blocks and naming #20

Closed LdDl closed 2 years ago

LdDl commented 2 years ago

What is your docs question about? Ask it Well, there are many code with some unclear priority queue stuff, such as:

...distance.distance = vertex.distance.distance + cost
...distance.contractionID = contractionID 
...distance.sourceID = sourceID

What do you suggest?

  1. Refactor code to make in clear for developer. E.g. merge relaxEdges() and dijkstra() function in one (something like dijkstra_witness)
  2. Make some kind of wiki-code in comments' sections E.g. explain what this code does
    // checkID Checks if both source's and target's contraction ID are not equal
    func (graph *Graph) checkID(source, target int64) bool {
    s := graph.Vertices[source].distance
    t := graph.Vertices[target].distance
    return s.contractionID != t.contractionID || s.sourceID != t.sourceID
    }

Additional context nope