My problem is the following.
I have a "backup" node and others nodes. From theses nodes, I need to generate a common path to the backup node which is minimal (unweighted and undirected graph) I don't need a solution everytime. Just how I can know if I can generate this path or not.
I was thinking about splitting the graph into some sub-graphs and searching for minimal "subpath".
But I'm not so good in graph theory. I use Python and C++.
Thanks you from advance.
(Sorry If there is already a question like this, I have searched, but not found)
so the problem is not about "shortest", it's about whether they are connected or not.
you can do
bfs
ordfs
starting from the "backup" node, each node you've reached can generate a path to the "backup" node.check out:
http://en.wikipedia.org/wiki/Breadth-first_search
http://en.wikipedia.org/wiki/Depth-first_search