diff --git a/lib/rgl/adjacency.rb b/lib/rgl/adjacency.rb index 5d7a0ff..80691b7 100644 --- a/lib/rgl/adjacency.rb +++ b/lib/rgl/adjacency.rb @@ -161,6 +161,7 @@ def basic_add_edge(u, v) end # class AdjacencyGraph + module Graph # Convert a general graph to an AdjacencyGraph. If the graph is directed, diff --git a/lib/rgl/bellman_ford.rb b/lib/rgl/bellman_ford.rb index 6effc76..9fb53db 100644 --- a/lib/rgl/bellman_ford.rb +++ b/lib/rgl/bellman_ford.rb @@ -27,6 +27,7 @@ def initialize(graph) end + # This class implements {Graph#bellman_ford_shortest_paths}. class BellmanFordAlgorithm # Initializes Bellman-Ford algorithm for a _graph_ with provided edges weights map. @@ -89,6 +90,7 @@ def relax_edge(u, v) end # class BellmanFordAlgorithm + module Graph # Finds the shortest paths from the _source_ to each vertex of the graph. diff --git a/lib/rgl/bipartite.rb b/lib/rgl/bipartite.rb index c6fd209..f5565d3 100644 --- a/lib/rgl/bipartite.rb +++ b/lib/rgl/bipartite.rb @@ -41,6 +41,7 @@ def bipartite? end # module Graph + class BipartiteBFSIterator < BFSIterator attr_reader :bipartite_sets_map, :found_odd_cycle diff --git a/lib/rgl/dijkstra.rb b/lib/rgl/dijkstra.rb index 3cfad14..bcc3b09 100644 --- a/lib/rgl/dijkstra.rb +++ b/lib/rgl/dijkstra.rb @@ -6,6 +6,7 @@ module RGL + # This class implements {Graph#dijkstra_shortest_path} and {Graph#dijkstra_shortest_paths} class DijkstraAlgorithm # Distance combinator is a lambda that accepts the distance (usually from the source) to vertex _u_ and the weight @@ -103,6 +104,7 @@ def build_edge_weights_map(edge_weights_map) end # class DijkstraAlgorithm + module Graph # Finds the shortest path from the _source_ to the _target_ in the graph. diff --git a/lib/rgl/edge_properties_map.rb b/lib/rgl/edge_properties_map.rb index 6db3738..87cc2f5 100644 --- a/lib/rgl/edge_properties_map.rb +++ b/lib/rgl/edge_properties_map.rb @@ -37,6 +37,7 @@ def report_missing_property(property, u, v) end # EdgePropertiesMap + class NonNegativeEdgePropertiesMap < EdgePropertiesMap private @@ -52,4 +53,4 @@ def report_negative_property(property, u, v) end -end \ No newline at end of file +end diff --git a/lib/rgl/edmonds_karp.rb b/lib/rgl/edmonds_karp.rb index 4953ad8..f0c3fc1 100644 --- a/lib/rgl/edmonds_karp.rb +++ b/lib/rgl/edmonds_karp.rb @@ -116,6 +116,7 @@ def handle_tree_edge(u, v) end # class EdmondsKarpAlgorithm + module Graph # Finds the maximum flow from the _source_ to the _sink_ in the graph. diff --git a/lib/rgl/implicit.rb b/lib/rgl/implicit.rb index aa71da2..85ad563 100644 --- a/lib/rgl/implicit.rb +++ b/lib/rgl/implicit.rb @@ -97,6 +97,7 @@ def edge_iterator(&block) end # class ImplicitGraph + module Graph # Returns a new {ImplicitGraph} which has as vertices all vertices of the diff --git a/lib/rgl/prim.rb b/lib/rgl/prim.rb index b647f78..4cdd8a3 100644 --- a/lib/rgl/prim.rb +++ b/lib/rgl/prim.rb @@ -34,6 +34,7 @@ def minimum_spanning_tree(start_vertex = nil) end # class PrimAlgorithm + module Graph # Finds the minimum spanning tree of the graph. diff --git a/lib/rgl/topsort.rb b/lib/rgl/topsort.rb index 98f5987..6b86276 100644 --- a/lib/rgl/topsort.rb +++ b/lib/rgl/topsort.rb @@ -8,10 +8,10 @@ module RGL # # The topological sort algorithm creates a linear ordering of the vertices # such that if edge (u,v) appears in the graph, then u comes before v in - # the ordering. The graph must be a directed acyclic graph (DAG). + # the ordering. The graph must be a directed acyclic graph. # # The iterator can also be applied to an undirected graph or to a directed graph - # which contains a cycle. In this case, the Iterator does not reach all + # which contains a cycle. In this case, the iterator does not reach all # vertices. The implementation of {Graph#acyclic?} uses this fact. # # @see Graph#topsort_iterator @@ -60,6 +60,7 @@ def at_end? end # class TopsortIterator + module Graph # @return [TopsortIterator] for the graph. diff --git a/lib/rgl/traversal.rb b/lib/rgl/traversal.rb index ce374e0..7d150e6 100644 --- a/lib/rgl/traversal.rb +++ b/lib/rgl/traversal.rb @@ -104,6 +104,7 @@ def next_vertex end # class BFSIterator + module Graph # @return [BFSIterator] starting at vertex _v_. @@ -161,6 +162,7 @@ class DFSVisitor end # class DFSVisitor + module Graph # @return [DFSIterator] staring at vertex _v_.