Giter Site home page Giter Site logo

samuelklam / minimum-spanning-trees Goto Github PK

View Code? Open in Web Editor NEW
0.0 3.0 0.0 464 KB

Computing MSTs with Prim's Algorithm

C++ 98.02% Makefile 1.98%
minimum-spanning-trees mst prims-algorithm prims-implementation heap algorithms adjacency-matrix adjacency-lists

minimum-spanning-trees's Introduction

Minimum Spanning Trees (MST)

This repo calculates the expected (average) weight of the MST using Prim's algorithm as a function of n (up to 131072) from the following complete, undirected graphs.

  1. Complete graphs on n vertices, where the weight of each edge is a real number chosen uniformly at random on [0, 1].
  2. Complete graphs on n vertices, where the vertices are points chosen uniformly at random inside the unit square (That is, the points are (x,y), with x and y each a real number chosen uniformly at random from [0, 1].) The weight of an edge is the Euclidean distance between its endpoints.
  3. Complete graphs on n vertices, where the vertices are points chosen uniformly at random inside the unit cube (3 dimensions) and hypercube (4 dimensions). As with the unit square case above, the weight of an edge is just the Euclidean distance between its endpoints.

For a full write-up refer to: minimum-spanning-tree-writeup.pdf.

Usage

In the command line:

$ make
$ ./randmst 0 numpoints numtrials dimension

The flag 0 can be used for testing, debugging, or extensions. The value numpoints is n, the number of points; the value numtrials is the number of runs to be done; the value dimension gives the dimension.

The output is: average numpoints numtrials dimension, where average is the average MST weight over the trials.

minimum-spanning-trees's People

Contributors

bujo0 avatar samuelklam avatar

Watchers

 avatar  avatar  avatar

minimum-spanning-trees's Issues

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.