Saral Shiksha Yojna
Courses/Distributed Systems

Distributed Systems

CS3.401
Prof. Kishore KothapalliMonsoon 2025-264 credits

GHS Rules A/B/C + Fragment Levels + Test/Accept/Reject

NotesStory
Unit 10 — Distributed Minimum Spanning Tree (GHS Algorithm)

MST Without A Manager

You can compute a minimum spanning tree centrally in linear or near-linear time with Prim or Kruskal. Distributed is harder: each node knows only its own edges and their weights. No global view. No central coordinator.

GHS (Gallager, Humblet, Spira 1983) gives a distributed algorithm with messages — provably optimal among comparison-based distributed MST algorithms.

Two Properties That Make MSTs Easy

Cut property: for any non-empty proper subset of vertices, the lightest edge crossing the cut is in the MST. This rules edges IN.

Cycle property: for any cycle in , the heaviest edge is NOT in the MST. This rules edges OUT.

GHS is built on the cut property. Every fragment grows by adding its minimum-weight outgoing edge (MWOE) — which is guaranteed by the cut property to be in the MST.

Fragments

A fragment is a subtree of some MST. Initially every node is its own fragment (level 0, name = node id). Fragments grow by combining.

Each fragment has a (name, level) pair. The core edge is the most recently used combining edge; its weight becomes the new fragment name.

The key lemma: if is a fragment and is its MWOE (lightest edge with exactly one endpoint in ), then is still a fragment. Adding the MWOE extends along a guaranteed MST edge.

GHS = Distributed Kruskal

Prim grows one fragment by repeatedly adding its MWOE. Kruskal starts with single-node fragments and merges them by MWOE. GHS is the distributed analogue of Kruskal — many fragments grow in parallel, merging by mutual MWOE choice.

The Three Combining Rules — High-Yield

Two fragments (level ) and (level ) connected via 's MWOE :

  • Rule A (Absorption): is absorbed into . New fragment takes 's name and level. Smaller rushes into bigger.
  • Rule B (Merger): AND 's MWOE is also (mutual choice) → merge into a new fragment of level and name — the new core edge.
  • Rule C (Wait): otherwise → wait until A or B becomes applicable.

Intuition:

  • Smaller fragments should rush into larger ones (don't slow them down).
  • Equal fragments merge only if BOTH chose the same edge (avoid races).
  • Larger fragments wait for smaller ones to grow up.

Memorise these three rules. Every GHS exam question hinges on them.

Test / Accept / Reject

To find its MWOE, a fragment node inspects its basic edges (not yet classified) in increasing weight order. For each edge , sends test ⟨⟩ to . replies:

  • reject if (same fragment, internal edge — not a candidate).
  • accept if AND (different fragment, eligible).
  • defer if ( might actually be in 's fragment but the *initiate* announcing the merger hasn't reached yet — wait until 's level catches up before answering definitively).

The defer case is the subtle one. Without it, GHS would prematurely mark cross-fragment edges, missing later merges.

Reporting And ChangeRoot

After test/accept/reject, each fragment knows its candidate MWOE locally. Each node reports the minimum (report ⟨⟩) of its own candidate and its children's reports up toward the core. The two endpoints of the core edge each receive a report from their subtree.

The side whose minimum is smaller initiates a changeroot message, which travels along bestch pointers to the node incident on the actual MWOE. That node then sends a **connect ⟨⟩** along the MWOE — triggering Rule A or B at the neighbour fragment.

Termination

When both endpoints of the core edge have reported (no outgoing edges found anywhere), the algorithm halts. Only one fragment remains — the MST.

Max Level And Complexity

Level grows only when two equal-level fragments merge (Rule B). A level- fragment contains nodes (by induction). With total nodes, **max level .**

Complexity:

  • Messages: . The term comes from initiates sent down at each of up to level increases.
  • Time: .

Optimal among comparison-based distributed MST algorithms.

A Worked Example (4 Nodes)

Edges: A-B (1), B-C (2), C-D (3), A-D (5), A-C (4), B-D (6).

Phase 0: 4 fragments (all level 0).

MWOE per fragment: A → B (weight 1); B → A (1); C → B (2); D → C (3).

A and B: same level (0), mutual MWOE (both choose AB) → Rule B. Merge to {A, B}, level 1, name = 1 (core edge).

C's MWOE is BC (2), target is {A, B} (now level 1). C is level 0 < 1 → Rule A. C absorbs into {A, B}; now {A, B, C} level 1.

D's MWOE is CD (3), target is {A, B, C} level 1. D is level 0 → Rule A. D absorbs.

Now {A, B, C, D} level 1. No outgoing edges remain. Terminate. MST = {AB, BC, CD}. Total weight = 1 + 2 + 3 = 6.

What You Walk In Carrying

MST definition + uniqueness condition. Cut property (foundation of GHS). Cycle property (rules edges out). Fragment definition + MWOE lemma. Initial state (all level-0 single nodes). Three combining rules — A absorbs, B merges, C waits. Test/Accept/Reject mechanism + defer case. Five message types (connect, initiate, test, accept/reject, report, changeroot). Max level proof. Complexity — optimal. The 4-node worked example.