Giter Club home page Giter Club logo

ghs-with-kompics's Introduction

GHS-with-Kompics

The GHS algorithm is used for finding the minimum spanning tree in a weighted graph. By considering all the assumptions for this algorithm, a graph will be given to you in a file with the following format GitHub Logo Format: Alt Text

Kompics

you can learn more about kompics in /KopmicsGuidance

GHS Algorithm Sketch

Initially, every singleton node is a fragment, which is the root of the fragment. Each node then looks for the least weight edge connecting to a neighbor. If both nodes pick each other, then a fragment of two nodes is formed at level 1. When two fragments join, the node with higher id across the least weight outgoing edge serves as the new root. However, during absorb, the root of the higher level fragment continues to serve as the new root. The notification about the change of root is sent out using the changeroot message. Communication within a fragment takes place via the edges of the spanning tree. Thus, each node keeps track of its parent and children

Detecting Least Weight Outgoing Edge (lwoe)

Root broadcasts “initiate” in its own fragment, collects the report from other nodes about eligible edges using a convergecast, and determines the least weight outgoing edge. To test if an edge is outgoing, each node sends a test message through a candidate edge. The receiving node may send a reject message (when it belongs to same fragment) or an accept message (when it belongs to a different fragment).

Accept/Reject

Let process i send “test” to process j:

  1. Item 1 Case 1. If name(i) = name(j) then send “reject”
  2. Item 2 Case 2. If name(i) 6= name(j) ∧ level(i) ≤ level(j), then node j sends“accept”
  3. Item 3 Case 3. If name(i) 6= name(j) ∧ level(i) > level(j), then wait until level(j) =level(i) and then send “accept/reject”.

The Major Steps

repeat

  1. Test edges as outgoing or not
  2. Determine least weight outgoing edge - it becomes a tree edge
  3. Send join (or respond to join)
  4. Update level & name & identify new coordinator/root until there are no outgoing edges

Classification of Edges:

  1. Basic: initially all branches are basic
  2. Branch: all tree edges
  3. Rejected: not a tree edge

Once the lwoe has been found, the root broadcasts a changeroot message to its fragment. The node that found the lwoe receives a changeroot message, it sends a join message along that edge indicating willingness to join

Scenario 1: Merge

If i sends a join message to j, where level(i) = level(j) = L and receives a join message from j, then:

  • Edge (i, j) becomes a branch message.
  • Between i and j whoever has the larger id becomes the new root.
  • The name of the fragment will be w(i, j).
  • Its level will be L + 1.
  • The root will broadcast (initiate, L + 1, name) message to the entire combine fragment.

Scenario 2: Absorb

Scenario 2.1:

If i in fragment T at level L sends a join message to j in fragment T' at level L' , where

L < L' , and

T' has not yet found lwoe , then T' absorbs T:

  • Process j sends a join message to i, indicating that T has been absorbed.
  • The root of T' will be the root of the combined fragment.
  • T changes its level to L' and adopts the name of T'.
  • They collectively search for a lwoe.
  • Edge (i, j) becomes a branch message.

Scenario 2.2:

If T'has already chosen a lwoe, then the lwoe cannot be(i, j). That means T'is joining another T''. Once this join is complete, the combined fragment of T'and T'' starts a new search and will send an initiate message to T to signal that T has been absorbed.

ghs-with-kompics's People

Contributors

fatememarzani avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.