File mwm_general.rb
has 579 lines of code (exceeds 250 allowed). Consider refactoring. Open
require_relative '../graph/weighted_graph'
require_relative '../matching'
require_relative 'matching_algorithm'
module GraphMatching
Class MWMGeneral
has 40 methods (exceeds 20 allowed). Consider refactoring. Open
class MWMGeneral < MatchingAlgorithm
# If b is a top-level blossom,
# label[b] is 0 if b is unlabeled (free);
# 1 if b is an S-vertex/blossom;
# 2 if b is a T-vertex/blossom.
Method calc_delta
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
def calc_delta(max_cardinality)
delta = nil
delta_type = nil
delta_edge = nil
delta_blossom = nil
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method add_blossom
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
def add_blossom(base, k)
v, w = @edges[k].to_a
bb = @in_blossom[base]
bv = @in_blossom[v]
bw = @in_blossom[w]
Method match
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def match(max_cardinality)
return Matching.new if g.num_edges == 0
# Iterative *stages*. Each stage augments the matching.
# There can be at most n stages, where n is num. vertexes.
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method add_blossom
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def add_blossom(base, k)
v, w = @edges[k].to_a
bb = @in_blossom[base]
bv = @in_blossom[v]
bw = @in_blossom[w]
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method calc_delta
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def calc_delta(max_cardinality)
delta = nil
delta_type = nil
delta_edge = nil
delta_blossom = nil
Method expand_t_blossom
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def expand_t_blossom(b)
assert(@label_end[b]).not_nil
entry_child = @in_blossom[@endpoint[@label_end[b] ^ 1]]
# > Move along the blossom until we get to the base.
Method scan_blossom
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def scan_blossom(v, w)
# > Trace back from v and w, placing breadcrumbs as we go.
path = []
base = nil
until v.nil? && w.nil?
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method scan_vertex
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def scan_vertex(v)
assert_label(@in_blossom[v], LBL_S)
augmented = false
@neighb_end[v].each do |p|
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method augment_matching
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def augment_matching(k)
v, w = @edges[k].to_a
[[v, 2 * k + 1], [w, 2 * k]].each do |(s, p)|
# > Match vertex s to remote endpoint p. Then trace back from s
# > until we find a single vertex, swapping matched and unmatched
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method scan_blossom
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def scan_blossom(v, w)
# > Trace back from v and w, placing breadcrumbs as we go.
path = []
base = nil
until v.nil? && w.nil?
Method update_duals
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def update_duals(delta)
(0...@nvertex).each do |v|
case @label[@in_blossom[v]]
when LBL_S
@dual[v] -= delta
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method expand_t_blossom
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def expand_t_blossom(b)
assert(@label_end[b]).not_nil
entry_child = @in_blossom[@endpoint[@label_end[b] ^ 1]]
# > Move along the blossom until we get to the base.
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method blossom_leaves
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def blossom_leaves(b, ary = [])
if b < @nvertex
ary.push(b)
else
@blossom_children[b].each do |c|
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method consider_tight_edge
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def consider_tight_edge(k, w, p, v)
augmented = false
if @label[@in_blossom[w]] == LBL_FREE
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method assign_label
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def assign_label(w, t, p = nil)
b = @in_blossom[w]
assert_label(w, LBL_FREE)
assert_label(b, LBL_FREE)
@label[w] = @label[b] = t
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"