Showing 45 of 76 total issues
Function maxWeightMatching
has a Cognitive Complexity of 479 (exceeds 5 allowed). Consider refactoring. Open
def maxWeightMatching(edges, maxcardinality=False):
"""Compute a maximum-weighted matching in the general undirected
weighted graph given by "edges". If "maxcardinality" is true,
only maximum-cardinality matchings are considered as solutions.
- 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
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
File mwmatching.py
has 557 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""Weighted maximum matching in general graphs.
The algorithm is taken from "Efficient Algorithms for Finding Maximum
Matching in Graphs" by Zvi Galil, ACM Computing Surveys, 1986.
It is based on the "blossom" method for finding augmenting paths and
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 check_delta3
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
def check_delta3
bk = nil
bd = nil
tbk = nil
tbd = 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 e
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
def e(g)
first = []
label = []
mate = []
- 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 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 match
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
def match
m = []
dogs, cats = g.partition
u = init_duals(cats, dogs)
- 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 19 (exceeds 5 allowed). Consider refactoring. Open
def match
u = g.partition[0]
m = []
loop do
- 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 check_delta2
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def check_delta2
(0...@nvertex).each do |v|
next unless @label[@in_blossom[v]] == MWMGeneral::LBL_FREE
bd = nil
bk = 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 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 l
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def l(x, y, first, label, mate, q, visited_nodes)
# L0. [Initialize.] Set r <- FIRST(x), s <= FIRST(y).
# If r = s, return (no vertices can be labeled).
# Otherwise flag r and s. (Steps L1-L2 find join by advancing
# alternately along paths P(x) and P(y). Flags are assigned
- 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 e
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
def e(g)
first = []
label = []
mate = []
Method match
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
def match
m = []
dogs, cats = g.partition
u = init_duals(cats, dogs)
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 check_delta3
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def check_delta3
bk = nil
bd = nil
tbk = nil
tbd = nil
Method l
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def l(x, y, first, label, mate, q, visited_nodes)
# L0. [Initialize.] Set r <- FIRST(x), s <= FIRST(y).
# If r = s, return (no vertices can be labeled).
# Otherwise flag r and s. (Steps L1-L2 find join by advancing
# alternately along paths P(x) and P(y). Flags are assigned
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.