Re: Graph Problem
- From: Martin Lauridsen <martinlauridsen@xxxxxxxxx>
- Date: Tue, 5 May 2009 12:45:43 -0700 (PDT)
On 1 Maj, 18:24, spineybabb...@xxxxxxxxx wrote:
Hi,
This came while i was writing a networking program. Suppose you have a
Graph G, and you are given a set of vertices. What I need to find is
minimum set of edges which connects all those edges ( assume the graph
is unweighted). By connection among edges i mean there should be some
path form one vertex to the other.
I think this can be done by finding shortest path between every two
vertices but that is way too inefficient. I researched a bit but
couldn't find anything that useful. Anyone with any idea?
Thanks in advance!
Indeed it sounds like you want a minimum spanning tree. But you say
that the edges have no weighting. This implies that any spanning tree
will be minimum, since any spanning tree has V-1 egdes.
In the weighted case, look up Kruskal's algorithm.
.
- Follow-Ups:
- Re: Graph Problem
- From: jaiprabhu
- Re: Graph Problem
- References:
- Graph Problem
- From: spineybabbler
- Graph Problem
- Prev by Date: Re: A Good and Clear Description of Recursion Theorem
- Next by Date: Re: Graph Problem
- Previous by thread: Re: Graph Problem
- Next by thread: Re: Graph Problem
- Index(es):
Relevant Pages
|