Class: GraphMatching::Algorithm::MCMGeneral

Inherits:
MatchingAlgorithm show all
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

#g

Instance Method Summary collapse

Methods inherited from MatchingAlgorithm

#assert

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

#matchObject

Raises:



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