I have a undirected and unweighted (or all edges are weighted 1) acyclic graph (G=VxE). Some of this graph's nodes are selected as sV (sV is subset of V). Problem is, I want to find the subgraph covering all selected nodes. Naturally some non selected nodes can be covered. But the nodes that are not on the desired subgraph are restricted. These restricted nodes should not be in the solution subgraph unless they are on only the one path between two selected nodes. An example:
A B C D
A - + + -
B + - + -
C + + - +
D - - + -
A, B, C, D are nodes, + represents inclusion of edges. For this graph B and D are selected nodes. The solution I want for this example is as follows: The subgraph consists nodes B,C,D and edges (B,C), (C,D) *. Note that A is not in the subgraph as intended. What kind of approach helps me to find this type of subgraphs? Thanks for ideas.
*(X,Y) represent an edge between nodes X an Y.
I feel like I misunderstood the problem but let's give it a try.
First we have to assume/check that your graph is a connected component http://en.wikipedia.org/wiki/Connected_component_(graph_theory) and then you can start :
Does it perform what you want to do ?