facebookresearch / graph2nn
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 285 units with 2,709 lines of code in units (1.2% of code).
    • 1 very complex units (137 lines of code)
    • 0 complex units (0 lines of code)
    • 8 medium complex units (214 lines of code)
    • 20 simple units (432 lines of code)
    • 256 very simple units (1,926 lines of code)
5% | 0% | 7% | 15% | 71%
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
py5% | 0% | 7% | 15% | 71%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
tools49% | 0% | 0% | 9% | 41%
pycls/utils0% | 0% | 13% | 23% | 62%
pycls/models0% | 0% | 4% | 12% | 83%
pycls/datasets0% | 0% | 17% | 18% | 63%
ROOT0% | 0% | 0% | 28% | 71%
pycls0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
def train_model()
in tools/train_net.py
137 64 3
def generate_index()
in pycls/models/relation_graph.py
37 14 6
def log_json_stats()
in pycls/utils/logging.py
20 13 8
def init_weights()
in pycls/utils/net.py
18 13 1
def ws_graph()
in pycls/datasets/load_graph.py
26 12 4
def flops_count()
in pycls/utils/metrics.py
36 12 1
def compute_precise_bn_stats()
in pycls/utils/net.py
18 12 2
def ws_graph()
in pycls/models/relation_graph.py
26 12 4
def random_crop()
in pycls/datasets/transforms.py
33 11 4
def single_proc_train()
in tools/train_net.py
25 10 0
def _construct_class()
in pycls/models/efficientnet.py
34 9 8
def _construct_class()
in pycls/models/resnet.py
23 9 7
def random_sized_crop()
in pycls/datasets/transforms.py
32 8 3
def measure_layer()
in pycls/utils/metrics.py
45 8 2
def model2adj()
in pycls/utils/net.py
20 8 1
def forward()
in pycls/models/efficientnet.py
18 8 2
def _construct_class()
in pycls/models/efficientnet.py
39 8 9
def forward()
in pycls/models/efficientnet.py
18 8 2
def parse_json_stats()
in pycls/utils/logging.py
5 7 3
def measure_model()
in pycls/utils/metrics.py
30 7 3