class Graphlb::Algorithms::Prims
- Graphlb::Algorithms::Prims
- Reference
- Object
Overview
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
Defined in:
graphlb/spanning_trees/prims.crInstance Method Summary
-
#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.
-
#run(graph, source)
returns a hashes, which contains the information about the previous vertex of all the vertives present inside the graph
Instance Method Detail
def 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.
def run(graph, source)
#
returns a hashes, which contains the information about the previous vertex of all the vertives present inside the graph