Documentation for graphs
Hi, I have been looking a library for nearest path algorithms, I was suggested with this one.
Something I'm not able to found, and is info about graphs, I'm thinking to port code form R to Rust using this library.
At least in R what is use most is graphs, where each one have edges, nodes and a weight, I know the docs says we can do this, but does not describe how to do it.
Could you add some docs to have an example for this pls? I can't found any struct that represents a graph.
I have used A* and Dijkastra algorithms in R for spatial shortest paths.
Thx!
We don't use any fixed graph structure in pathfinding. The graph functions take a "successors" function as argument, and this function is called with the current node as argument, and returns the neighbours and the cost to reach them.
This lets you use whatever you want, for example a proximity matrix where you store the weights to reach one node from another, and use this in your "successors" function to return the list of neighbouring nodes and the cost to reach them.
:O that is so powerful!
I'm reading several examples like this one https://docs.rs/pathfinding/latest/pathfinding/directed/dijkstra/fn.dijkstra.html
I'm checking the return of success seems it returns the neighborhoods but not the weight.
How this is a very standard method, I also think would be good make a doc for it.
aaa, I found it, was in the map! I still suggest write some docs for it :)
Contributions (including documentation ones) are welcome!