Skip to content

An implementation of GHS Minimum Spanning Tree algorithm in python

Notifications You must be signed in to change notification settings

amir-ni/GHS-MST

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GHS Minimum Spanning Tree in python

This repository holds a simple simulation of distributed Minimum Spanning Tree using GHS algorithm in python3.

GHS algorithm

The GHS algorithm of Gallager, Humblet and Spira is one of the best-known algorithms in distributed computing theory. This algorithm can construct the minimum spanning tree in asynchronous Message-passing model.

  • The algorithm should run on a connected undirected graph.
  • The graph should have distinct finite weights assigned to each edge.

For more details about GHS click here.

How to run

  1. First clone this repository.
  2. Put desired graph data in a txt file with the correct format as instructed below
  3. Run the program using Main.py "input file" (e.g. Main.py "input.txt")

When finished, each node prints it's neighbours that their common edge is a branch in the MST.

Input format

Each edge have a weight and a delay parameter.

Each line represents one edge of the graph in the following format:

  • <source_nid> <destination_nid> <weight> <delay>

A sample input is available in "input.txt" which it's representation is shown below. input graph

About

An implementation of GHS Minimum Spanning Tree algorithm in python

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages