vlarmet / cppRouting

Algorithms for Routing and Solving the Traffic Assignment Problem
108 stars 9 forks source link

Unique nodes: makegraph only checks x coordinates, and not y coordinates #22

Closed delphinekw closed 5 months ago

delphinekw commented 5 months ago

Hello and thanks for the great package on network analysis!

I am going through your tutorial with my own data, and stumbled upon the following error: "Nodes should be unique in the coordinates data frame"

I have checked my data, and I don't think I have duplicate nodes. The function makegraph throws an error if two nodes have identical x coordinates, but does not check if the y coordinates are different.

I would argue that one should replace the following line in the function definition: sum(duplicated(coords[, 1])) > 0 with: sum(duplicated(coords[, c(1,2)])) > 0

What do you think? Am I maybe missing something?

delphinekw commented 5 months ago

Never mind sorry, it is checking for the ID, not the x coordinate