Class: GraphMatching::Algorithm::MCMGeneral
- Inherits:
-
MatchingAlgorithm
- Object
- MatchingAlgorithm
- GraphMatching::Algorithm::MCMGeneral
- Defined in:
- lib/graph_matching/algorithm/mcm_general.rb
Overview
‘MCMGeneral` implements Maximum Cardinality Matching in general graphs (as opposed to bipartite).
Defined Under Namespace
Classes: LFlag
Instance Attribute Summary
Attributes inherited from MatchingAlgorithm
Instance Method Summary collapse
-
#initialize(graph) ⇒ MCMGeneral
constructor
A new instance of MCMGeneral.
- #match ⇒ Object
Methods inherited from MatchingAlgorithm
Constructor Details
#initialize(graph) ⇒ MCMGeneral
Returns a new instance of MCMGeneral.
20 21 22 23 |
# File 'lib/graph_matching/algorithm/mcm_general.rb', line 20 def initialize(graph) assert(graph).is_a(Graph::Graph) super end |
Instance Method Details
#match ⇒ Object
25 26 27 28 29 |
# File 'lib/graph_matching/algorithm/mcm_general.rb', line 25 def match return Matching.new if g.empty? raise DisconnectedGraph unless g.connected? e(g) end |