facebookresearch / impact-driven-exploration
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 406 units with 5,297 lines of code in units (77.9% of code).
    • 0 very complex units (0 lines of code)
    • 3 complex units (571 lines of code)
    • 15 medium complex units (1,110 lines of code)
    • 35 simple units (930 lines of code)
    • 353 very simple units (2,686 lines of code)
0% | 10% | 20% | 17% | 50%
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
py0% | 10% | 20% | 17% | 50%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
src/algos0% | 32% | 36% | 5% | 25%
gym-minigrid/gym_minigrid/envs0% | 0% | 19% | 27% | 52%
gym-minigrid/gym_minigrid0% | 0% | 14% | 17% | 67%
src0% | 0% | 8% | 16% | 74%
src/core0% | 0% | 0% | 41% | 58%
gym-minigrid0% | 0% | 0% | 59% | 40%
ROOT0% | 0% | 0% | 100% | 0%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
def train()
in src/algos/rnd.py
173 27 1
def train()
in src/algos/curiosity.py
198 27 1
def train()
in src/algos/ride.py
200 26 1
def train()
in src/algos/count.py
154 25 1
def train()
in src/algos/no_episodic_counts.py
189 24 1
def train()
in src/algos/only_episodic_counts.py
148 23 1
def train()
in src/algos/torchbeast.py
144 23 1
def step()
in gym-minigrid/gym_minigrid/minigrid.py
42 22 2
def step()
in gym-minigrid/gym_minigrid/envs/multiroom_noisytv.py
39 21 2
def _gen_grid()
in gym-minigrid/gym_minigrid/envs/crossing.py
44 17 3
def act()
in src/utils.py
83 16 9
def process_vis()
in gym-minigrid/gym_minigrid/minigrid.py
29 15 2
def connect_all()
in gym-minigrid/gym_minigrid/roomgrid.py
35 13 3
def _gen_grid()
in gym-minigrid/gym_minigrid/envs/putnear.py
46 13 3
def render()
in gym-minigrid/gym_minigrid/minigrid.py
34 12 5
def _gen_grid()
in gym-minigrid/gym_minigrid/envs/lockedroom.py
60 12 3
def _gen_grid()
in gym-minigrid/gym_minigrid/envs/playground_v0.py
37 12 3
def decode()
in gym-minigrid/gym_minigrid/minigrid.py
26 11 3
def _gen_grid()
in gym-minigrid/gym_minigrid/roomgrid.py
35 10 3
def remove_wall()
in gym-minigrid/gym_minigrid/roomgrid.py
24 10 4