class

Graphlb::Algorithms::Prims

Inherits Reference / Object

Prim's algorithm is an algorithm for finding the Minimum spanning tree in a graph, i.e the tree with the lowest weight

Given a graph and source vertex dijkstra function finds the shortest distance from the source vertex to all other vertices in the graph

Instance methods

path_constructor(prev, source, target)

constructs a path from source vertex to target vertex Returns the shortest path, if it exists, as an Array of vertices.

Source
run(graph, source)

returns a hashes, which contains the information about the previous vertex of all the vertives present inside the graph

Source