lib/rgl/prim.rb in rgl-0.5.9 vs lib/rgl/prim.rb in rgl-0.5.10
- old
+ new
@@ -1,10 +1,12 @@
require 'rgl/dijkstra'
require 'rgl/adjacency'
module RGL
+ # Implements {https://en.wikipedia.org/wiki/Prim%27s_algorithm Prim's algorithm}.
+ # @see Graph#prim_minimum_spanning_tree
class PrimAlgorithm
# Replacement for default distance combinator that is used in Dijkstra's algorithm. While building a minimum
# spanning tree (MST) we're interested not in the distance from the source (the vertex that is added first to the
# MST) to a vertex, but rather in the distance between already completed part of the MST (that includes all examined
@@ -34,10 +36,10 @@
module Graph
# Finds the minimum spanning tree of the graph.
#
- # Returns an AdjacencyGraph that represents the minimum spanning tree of the graph's connectivity component that
+ # Returns an {AdjacencyGraph} that represents the minimum spanning tree of the graph's connectivity component that
# contains the starting vertex. The algorithm starts from an arbitrary vertex if the _start_vertex_ is not given.
# Since the implementation relies on the Dijkstra's algorithm, Prim's algorithm uses the same visitor class and emits
# the same events.
#
# Raises ArgumentError if edge weight is undefined.