ArticleslgStudy

computer science

Mega-Merger

Mega-Merger is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Mega-Merger rather than just read about it. In short: Mega-merger is a distributed algorithm aimed at solving the election problem in generic connected undirected graph. Introduction Mega-Merger was developed by Robert Gray Gallager at MIT in 1983.

Key takeaways

  • Mega-Merger belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Mega-Merger to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Mega-Merger from memory before moving on to harder problems.

Reference excerpt

Mega-merger is a distributed algorithm aimed at solving the election problem in generic connected undirected graph.

Introduction Mega-Merger was developed by Robert Gray Gallager at MIT in 1983. It applies a distributed divide and conquer approach mixed with a rank-based conquer strategy. The algorithm is usually presented through a village-city analogy. Each node in the graph indicates a village, while the edges that connect them are the roads and a rooted spanning tree in a sub-graph is a city. The whole graph is then a mega-city. Mega-Merger pushes villages to bind together to form cities according to each other's rank and edges. Cities are then formed by alliances or by conquering/absorption.

Pre-requisites Mega-Merger builds a minimum spanning tree over connected graphs provided:

Total reliability: No message is lost in transmission. UI (unique initiator): A single node starts the protocol. Bi-directional communications channels: Each edge is bi-directional, communications can travel in both directions. No further restrictions are necessary.

Algorithm The algorithm assigns to each village a name and a rank, the former usually unique. The latter states the number of friendly mergers that the city has gone through, and the larger it is, the more powerful a city is considered. Moreover, to each edge is assigned a weight: each village/city C has a minimum-weight edge emerge(C,C′) also called merge link, that is the edge whose traversal has minimum cost. The algorithm proceeds in consecutive stages until a mega-city is formed. Each city C computes its own merge link and sends a request for merging across emerge(C,C′). The request is handled by C′ in the following ways:

Friendly merge: rank(C)=rank(C′)∧emerge(C,C′)=emerge(C′,C): If the cities share the same merge link and have same rank, a friendly merge occurs, and the two cities merge into one. A new name is picked for the newly created city, a ruling village is picked and the path from the previous ruler to the node in the merge link is re-oriented such that it leads to the new leader. The new city also has its rank increased by one. Notice as this is the only way two cities can increase each other's rank. Absorption: rank(C)<rank(C′): If the requesting city has a lower rank, the city in the receiving end enacts an absorption process: C is absorbed like in the friendly merge, but loses its name and the resulting city has the rank of C′. Suspension: rank(C)=rank(C′)∧emerge(C,C′)≠emerge(C′,C)∨rank(C)>rank(C′): In such cases C′ freezes the request: it waits to either be absorbed by rule 2 or to merge and increase its rank above the one of C in order to be able to enact rule 1 and absorb C.

Outside messages No nodes in the graph have a list of villages belonging to their village, hence each time a city wants to look for edges leading outside of it, it has to adopt an ask-reply protocol. The city ruler sends a broadcast message through its spanning tree, and each node x receiving it sends requests to its neighbors, excluding the edges to its child(ren) and parent. The response protocol is as follows:

x.city=y.city: clearly the edge is an intra-edge in C. x and y exchange negative responses. x.city≠y.city∧x.rank<y.rank: x is asking to a city of higher rank. By rule 2 we can assert that no absorption occurs, and y indeed belongs to another city. x.city≠y.city∧x.rank>y.rank: in this case y will delay the answer as by rule 3.

Properties Mega-Merger holds several properties:

Monotonic rank: Each city C, mega-city excluded, will eventually rise in rank. By rule 1 C could friendly merge, raising its rank by 1; by rule 2 and 3 C will have a merge link (by hypothesis C is not the mega-city) it will either ask a higher-rank city C′, getting absorbed and increasing its rank, or wait until C′ reaches its level and operate a friendly merge. rank(C)=K⟹|C|≥2k: we have a level increase each time a friendly merge is operated. We compute by induction: on the base case, rank(C)=0, exactly one village is in C. On the inductive case, two cities C′,C″s.t.rank(C′)=rank(C″)=k operate a friendly merge, hence |C′−C″|=|C′|+|C″|=2k+2k=2k+1 by inductive hypothesis. max⁡rank(C)≤log⁡n: by the previous rule cities are built up on an exponential base 2, hence the inverse log2n. Deadlock prevention: Mega-Merger doesn't incur in any deadlock. As shown by rule 3 a city C can wait for a lower-rank city to answer on merge link e: in order to incur in a deadlock such city C′ would have to wait on C″, and C″ on C‴, and so on until a cycle is detected on Cn waiting on C on a merge link e′. But by hypothesis e is the merge-link of C, hence such chain cannot exist. The other deadlock-inducing situation is a request from C to C′ where C′ has a different merge link than C. Still, as shown by monotonic rank either C′ will grow its rank to absorb C, or will consume all its merge links to be the only city in the graph with C. Trivially in such case the two merge links would coincide and C′ would be forced into absorption by rule 2.

Termination Termination is granted by deadlock prevention and total reliability.

Cost The cost analysis has two components, the stage-cost and the stage upper-bound. A city C enacts a stage by requesting a merge link from its villages and applying one of the above rules according to the desired situation. We can divide this stage in five steps:

Broadcast request for merge link to the ≤n nodes in the tree. Each node forwards an outside? message to its ≤n neighbors and waits for their ≤n answers. The nodes then send the answers back to the city ruler by convergecast for a total of ≤n messages. The root then decides on a merge link and sends a message to the elected node. Trivially this message will need to travel height(Tree)≤n nodes. These five phases of request, outside discovery, communication and delivery have a total cost of n+2n+n+n≤5n. As for the wasted messages in the outside? between internal nodes, each node x has at most deg(x)−2 internal edges, or deg(x)−1 if x is a leaf, for a total of 2m−n wasted internal messages. Now for the number of stages. By the previously presented property on the cities size, each city of level k has ≥2k, hence the largest reachable rank is log2n. Since cities can merge/be absorbed only once per stage, we have a total of 2m+n+5nlog⁡ntotal messages.

… excerpt ends here. Continue reading the full article.

Worked examples

Example 1 — a first encounter with Mega-Merger

Start with the simplest possible case. Write down what Mega-Merger claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Mega-Merger before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Mega-Merger ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Mega-Merger

In research
Mega-Merger appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Mega-Merger in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Mega-Merger is common in secondary-school and first-year university syllabi. It links to neighbouring topics Distributed algorithms, Distributed computing, so understanding it makes those chapters shorter.
In everyday life
Look for Mega-Merger outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Mega-Merger” →

How to study Mega-Merger in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Mega-Merger means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Mega-Merger out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Mega-Merger in simple terms?

Mega-merger is a distributed algorithm aimed at solving the election problem in generic connected undirected graph. Introduction Mega-Merger was developed by Robert Gray Gallager at MIT in 1983.

Why does Mega-Merger matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Mega-Merger?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Mega-Merger.

Tags

  • Distributed algorithms
  • Distributed computing

Keep exploring