Warning: foreach() argument must be of type array|object, bool given in /var/www/html/web/app/themes/studypress-core-theme/template-parts/header/mobile-offcanvas.php on line 20

Express the algorithm devised in Exercise \(22\) in pseudo code.

Short Answer

Expert verified

Procedure adjusted Kruskal(G: weighted connected undirected graph with n vertices; \(S\): set of some edges in \({\bf{G}}\))

\({\bf{T: = }}\)empty graph

\({\bf{T: = }}T \cup S\)

procedure adjusted Kruskal \({\bf{G}}\) : weighted connected undirected graph with \({\bf{n}}\) vertices; \(S\): set

\({\bf{T: = }}\)empty graph

\({\bf{T: = }}T \cup S\)

For\({\bf{i: = 1}}\) to \({\bf{n - m - 1}}\)

(When the edge is added to \({\bf{T}}\)).

\({\bf{r: = }}T \cup \{ e\} \)

return \({\bf{T}}\)

for \({\bf{i: = 1}}\) to \({\bf{n - m - 1}}\)

\({\bf{e: = }}\)edge in \({\bf{G}}\) of minimum weight not forming a simple circuit in \({\bf{T}}\)

(When the edge is added to \({\bf{T}}\)).

\({\bf{T: = }}T \cup \{ e\} \)

return \({\bf{T}}\)

Step by step solution

Achieve better grades quicker with Premium

  • Unlimited AI interaction
  • Study offline
  • Say goodbye to ads
  • Export flashcards

Over 22 million students worldwide already upgrade their learning with Vaia!

01

Definition

A graph is connected if there exists a path between every pair of vertices.

Kruskal's algorithm:

Start from a graph \({\bf{T}}\) that contains only the vertices and no edges. Repeatedly select the edge in the given graph \({\bf{G}}\) with the smallest weight (that doesn't cause a circuit) and add it to the graph \({\bf{T}}\). Once the graph is connected, we have found a minimum spanning tree.

02

Using the Kruskal’s algorithm

One calls the procedure "adjusted Kruskal" and the input is a weighted connected undirected graph with \({\bf{n}}\) vertices and a specified set of edges. procedure adjusted Kruskal (\({\bf{G}}\): weighted connected undirected graph with \({\bf{n}}\) vertices;

\(S\): set of some edges in \({\bf{G}}\)) We initially \({\bf{T}}\) to be an empty graph and then add all edges in \(S\) to \({\bf{T}}\). Let \({\bf{m}}\) represents the number of edges in \(S\). \({\bf{T: = }}\) empty graph \({\bf{T: = }}T \cup S{\bf{m: = }}\) Number of edges in \(S\) A tree with \({\bf{n}}\) vertices contain \({\bf{n - }}1\) edges. Since \({\bf{T}}\) already contains \({\bf{m}}\) edges, we need to add \({\bf{n - }}1{\bf{ - m}}\) or \({\bf{n - m - 1}}\) edges. In each step, we search for the edge \(e\) with the smallest weight among all edges in \({\bf{G}}\) and this edge cannot form a simple circuit in \({\bf{T}}\) (when added to \({\bf{T}}\)). When the edge \(e\) is found, we add it to the tree \({\bf{T}}\). for \({\bf{i: = 1}}\) to \({\bf{n - m - 1}}\;\;\;{\bf{e: = }}\) edge in \({\bf{G}}\) of minimum weight not forming a simple circuit in \({\bf{T}}\) (when the edge is added to \({\bf{T}}\)). \({\bf{T: = }}T \cup \{ e\} \) Finally, when we the tree contains \({\bf{n - }}1\)edges, one has found the spanning tree with minimal weight containing all edges in \(S\). Thus,one then returns the tree \({\bf{T}}\), return \({\bf{T}}\).

One App. One Place for Learning.

All the tools & learning materials you need for study success - in one app.

Get started for free

Most popular questions from this chapter

What is the level of each vertex of the rooted tree in Exercise \(4\)?

Show that the first step of Sollinโ€™s algorithm produces a forest containing at least \(\left\lceil {\frac{n}{2}} \right\rceil \) edges when the input isan undirected graph with \(n\) vertices.

Find the height of \({{\bf{B}}_{\bf{k}}}\). Prove that your answer is correct.

Sollin's algorithm produces a minimum spanning tree from a connected weighted simple graph \({\bf{G = (V,E)}}\) by successively adding groups of edges. Suppose that the vertices in \({\bf{V}}\) are ordered. This produces an ordering of the edges where \({\bf{\{ }}{{\bf{u}}_{\bf{0}}}{\bf{,}}{{\bf{v}}_{\bf{0}}}{\bf{\} }}\) precedes \({\bf{\{ }}{{\bf{u}}_{\bf{1}}}{\bf{,}}{{\bf{v}}_{\bf{1}}}{\bf{\} }}\) if \({{\bf{u}}_{\bf{0}}}\) precedes \({{\bf{u}}_{\bf{1}}}\) or if \({{\bf{u}}_{\bf{0}}}{\bf{ = }}{{\bf{u}}_{\bf{1}}}\) and \({{\bf{v}}_{\bf{0}}}\) precedes \({{\bf{v}}_{\bf{1}}}\). The algorithm begins by simultaneously choosing the edge of least weight incident to each vertex. The first edge in the ordering is taken in the case of ties. This produces a graph with no simple circuits, that is, a forest of trees (Exercise \({\bf{24}}\) asks for a proof of this fact). Next, simultaneously choose for each tree in the forest the shortest edge between a vertex in this tree and a vertex in a different tree. Again the first edge in the ordering is chosen in the case of ties. (This produces a graph with no simple circuits containing fewer trees than were present before this step; see Exercise \({\bf{24}}\).) Continue the process of simultaneously adding edges connecting trees until \({\bf{n - 1}}\) edges have been chosen. At this stage a minimum spanning tree has been constructed.

Show that the addition of edges at each stage of Sollinโ€™s algorithm produces a forest.

Draw a game tree for him if the starting position consists of three piles with one, two, and three stones, respectively. When drawing the tree represent by the same vertex symmetric positions that result from the same move. Find the value of each vertex of the game tree. Who wins the game if both players follow an optimal strategy?

See all solutions

Recommended explanations on Math Textbooks

View all explanations

What do you think about this solution?

We value your feedback to improve our textbook solutions.

Study anywhere. Anytime. Across all devices.

Sign-up for free