A Maple Package implementing Kruskal's Algorithms for Finding a Minimum Spanning Tree (for a connected and weighted graph)
Jay Pedersen University of Nebraska at Omaha Student E-mail: jayped007@gmail.com
Code Version 1.0, Date 2007-07-10, Maple Version 11 Project: Implement Kruskal's Algorithm for determining a minimum-cost spanning tree for a connected and weighted graph.
Please report any errors to Jay Pedersen at emaile jaypd007@gmail.com.
References
Kruskal's Minimum Spanning Tree algorithm is a well-known algorithm. One place where it is
defined is in 'Algorithms Sequential and Parallel' by Russ Miller and Laurence Boxer, page 331
(c) 2005, ISBN 1-58450-412-9.
Maple programming is described in "maple 9; Introductory Programming Guide"
from Maplesoft; ISBN 189451143-3. This is also available from the maplesoft website.
Input Format (for Network definition)
The algorithm takes as input a list containing a network definition.
The list contains edge definitions for the network; with 3 values in each.
The first 2 values define the nodes (vertices) for the edge and the 3rd value is
the cost for traveling across the edge.
For example; the following definition defines a network with 4 nodes (vertices)
and 6 edges (arcs, connections).
net := [
[1, 2, 1],
[1, 3, 3],
[2, 3, 2],
[3, 2, 4],
[2, 4, 5],
[3, 4, 9]
];
Algorithm Code
Example Usage
Usage: The routine Kruskals_Algorithm is invoked to determine a minimum spanning tree
paths from the source node to destination nodes on the network that it is given.
Syntax: Kruskals_Algorithm(network, display_graph); Arguments: Network - list defining the network (see "Input Format" section). display_graph - true/false, if true => graphically display min spanning tree
Legal Notice: The copyright for this application is owned by the author(s). Neither Maplesoft nor the author are responsible for any errors contained within and are not liable for any damages resulting from the use of this material. This application is intended for non-commercial, non-profit use only. Contact the author for permission if you wish to use this application in for-profit activities.