Skip to content

An implementation for Prim's minimum spanning tree algorithm using heaps

Notifications You must be signed in to change notification settings

Abdallah-Elshamy/Prim-s-minimum-spanning-tree-algorithm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

Prim-s-minimum-spanning-tree-algorithm

An implementation for Prim's minimum spanning tree algorithm using heaps

The file "edges.text" describes an undirected graph with integer edge costs. It has the format

[one_node_of_edge_1] [other_node_of_edge_1] [edge_1_cost]

[one_node_of_edge_2] [other_node_of_edge_2] [edge_2_cost]

...

For example, the third line of the file is "2 3 -8874", indicating that there is an edge connecting vertex #2 and vertex #3 that has cost -8874.

You should NOT assume that edge costs are positive, nor should you assume that they are distinct.

Your task is to run Prim's minimum spanning tree algorithm on this graph. You should report the overall cost of a minimum spanning tree --- an integer, which may or may not be negative.

Releases

No releases published

Packages

No packages published

Languages