Algorithms for updating minimal spanning trees best dating chat
You can get ideas like this to work without this assumption but it becomes harder to state your theorems or write your algorithms precisely.Lemma: Let X be any subset of the vertices of G, and let edge e be the smallest edge connecting X to G-X. Proof: Suppose you have a tree T not containing e; then I want to show that T is not the MST. Then because T is a spanning tree it contains a unique path from u to v, which together with e forms a cycle in G.
(Problem 4.3 of Baase is related to this assumption).
Kruskal's algorithm: sort the edges of G in increasing order by length keep a subgraph S of G, initially empty for each edge e in sorted order if the endpoints of e are disconnected in S add e to S return S Note that, whenever you add an edge (u,v), it's always the smallest connecting the part of S reachable from u with the rest of G, so by the lemma it must be part of the MST.
This algorithm is known as a greedy algorithm, because it chooses at each step the cheapest edge to add to S.
You want a set of lines that connects all your offices with a minimum total cost.
It should be a spanning tree, since if a network isn't a tree you can always remove some edges and save money.