facebookresearch / beanmachine
Conditional Complexity

The distribution of complexity of units (measured with McCabe index).

Intro
  • Conditional complexity (also called cyclomatic complexity) is a term used to measure the complexity of software. The term refers to the number of possible paths through a program function. A higher value ofter means higher maintenance and testing costs (infosecinstitute.com).
  • Conditional complexity is calculated by counting all conditions in the program that can affect the execution path (e.g. if statement, loops, switches, and/or operators, try and catch blocks...).
  • Conditional complexity is measured at the unit level (methods, functions...).
  • Units are classified in four categories based on the measured McCabe index: 1-5 (simple units), 6-10 (medium complex units), 11-25 (complex units), 26+ (very complex units).
Learn more...
Conditional Complexity Overall
  • There are 2,664 units with 20,074 lines of code in units (57.2% of code).
    • 0 very complex units (0 lines of code)
    • 3 complex units (302 lines of code)
    • 48 medium complex units (1,703 lines of code)
    • 146 simple units (3,136 lines of code)
    • 2,467 very simple units (14,933 lines of code)
0% | 1% | 8% | 15% | 74%
Legend:
51+
26-50
11-25
6-10
1-5
Alternative Visuals
Conditional Complexity per Extension
51+
26-50
11-25
6-10
1-5
cpp0% | 5% | 6% | 16% | 71%
py0% | 0% | 9% | 16% | 74%
h0% | 0% | 9% | 0% | 90%
pyi0% | 0% | 0% | 0% | 100%
js0% | 0% | 0% | 0% | 100%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
src/beanmachine/graph0% | 4% | 6% | 14% | 73%
src/beanmachine/ppl0% | 0% | 8% | 16% | 74%
src/beanmachine/tutorials0% | 0% | 6% | 2% | 90%
scripts0% | 0% | 68% | 14% | 16%
src/beanmachine/applications0% | 0% | 9% | 27% | 62%
sphinx/source0% | 0% | 37% | 26% | 35%
website0% | 0% | 0% | 0% | 100%
website/src/pages0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
std::string op()
in src/beanmachine/graph/to_dot.cpp
63 31 1
void Graph::cavi()
in src/beanmachine/graph/cavi.cpp
123 28 4
void Graph::gibbs()
in src/beanmachine/graph/gibbs.cpp
116 27 3
def _type_of_matrix()
in src/beanmachine/ppl/compiler/bmg_types.py
31 23 1
def update_graph()
in src/beanmachine/ppl/legacy/world/world.py
68 22 2
def _rv_to_node()
in src/beanmachine/ppl/compiler/runtime.py
25 22 2
void Distribution::sample()
in src/beanmachine/graph/distribution/distribution.cpp
76 22 2
def _single_inference_step()
in src/beanmachine/ppl/experimental/abc/abc_infer.py
38 21 1
def search_package()
in sphinx/source/docs.py
39 20 1
def transform_notebook()
in scripts/convert_ipynb_to_mdx.py
79 20 2
std::string NodeValue::to_string()
in src/beanmachine/graph/graph.cpp
61 20 0
std::unique_ptr Distribution::new_distribution()
in src/beanmachine/graph/distribution/distribution.cpp
83 19 3
def _single_inference_step()
in src/beanmachine/ppl/experimental/abc/abc_smc_infer.py
40 18 2
def _product()
in src/beanmachine/ppl/compiler/support.py
11 18 3
def _needs_fixing()
in src/beanmachine/ppl/compiler/fix_multiary_ops.py
10 18 2
def update_children_parents()
in src/beanmachine/ppl/legacy/world/world.py
43 17 2
def _single_inference_step()
in src/beanmachine/ppl/experimental/abc/adaptive_abc_smc_infer.py
35 16 2
def _add_constant()
in src/beanmachine/ppl/compiler/gen_bmg_cpp.py
46 16 2
def handle_sample()
in src/beanmachine/ppl/compiler/runtime.py
46 16 2
def _add_constant()
in src/beanmachine/ppl/compiler/gen_bmg_python.py
36 16 2