lib/rgl/connected_components.rb in rgl-0.5.9 vs lib/rgl/connected_components.rb in rgl-0.5.10
- old
+ new
@@ -36,11 +36,11 @@
depth_first_search(vis) { |v| }
yield comp unless comp.empty?
end
- # This GraphVisitor is used by strongly_connected_components to compute
+ # This {GraphVisitor} is used by {#strongly_connected_components} to compute
# the strongly connected components of a directed graph.
#
class TarjanSccVisitor < DFSVisitor
attr_reader :comp_map
@@ -101,11 +101,11 @@
end # class TarjanSccVisitor
# This is Tarjan's algorithm for strongly connected components, from his
# paper "Depth first search and linear graph algorithms". It calculates
# the components in a single application of DFS. We implement the
- # algorithm with the help of the DFSVisitor TarjanSccVisitor.
+ # algorithm with the help of the {DFSVisitor} {TarjanSccVisitor}.
#
# === Definition
#
# A _strongly connected component_ of a directed graph G=(V,E) is a
# maximal set of vertices U which is in V, such that for every pair of
@@ -126,13 +126,13 @@
# ISSN = "0097-5397 (print), 1095-7111 (electronic)",
# bibdate = "Thu Jan 23 09:56:44 1997",
# bibsource = "Parallel/Multi.bib, Misc/Reverse.eng.bib",
# }
#
- # The output of the algorithm is recorded in a TarjanSccVisitor _vis_.
- # vis.comp_map will contain numbers giving the component ID assigned to
- # each vertex. The number of components is vis.num_comp.
- #
+ # The output of the algorithm is recorded in a {TarjanSccVisitor} _vis_.
+ # +vis.comp_map+ will contain numbers giving the component ID assigned to
+ # each vertex. The number of components is +vis.num_comp+.
+ # @return [TarjanSccVisitor]
def strongly_connected_components
raise NotDirectedError,
"strong_components only works for directed graphs." unless directed?
vis = TarjanSccVisitor.new(self)