I have an graph with the following attributes:
- Undirected
- Not weighted
- Each vertex has a minimum of 2 and maximum of 6 edges connected to it.
- Vertex count will be < 100
- Graph is static and no vertices/edges can be added/removed or edited.
I'm looking for paths between a random subset of the vertices (at least 2). The paths should simple paths that only go through any vertex once.
My end goal is to have a set of routes so that you can start at one of the subset vertices and reach any of the other subset vertices. Its not necessary to pass through all the subset nodes when following a route.
All of the algorithms I've found (Dijkstra,Depth first search etc.) seem to be dealing with paths between two vertices and shortest paths.
Is there a known algorithm that will give me all the paths (I suppose these are subgraphs) that connect these subset of vertices?
edit:
I've created a (warning! programmer art) animated gif to illustrate what i'm trying to achieve: https://i.sstatic.net/O228a.gif
There are two stages pre-process and runtime.
pre-process
- I have a graph and a subset of the vertices (blue nodes)
- I generate all the possible routes that connect all the blue nodes
runtime
- I can start at any blue node select any of the generated routes and travel along it to reach my destination blue node.
So my task is more about creating all of the subgraphs (routes) that connect all blue nodes, rather than creating a path from A->B.