def _slow_construct_edges(G, radius, p):
 for ((u, pu), (v, pv)) in combinations(G.nodes(data='pos'), 2):
  if (sum(((abs((a - b)) ** p) for (a, b) in zip(pu, pv))) <= (radius ** p)):
   G.add_edge(u, v)

def _slow_construct_edges ( G , radius , p ) : for ( ( u , pu ) , ( v , pv ) ) in combinations ( G . nodes ( data = 'pos' ) , 2 ) : if ( sum ( ( ( abs ( ( a - b ) ) ** p ) for ( a , b ) in zip ( pu , pv ) ) ) <= ( radius ** p ) ) : G . add_edge ( u , v )
construct edges for random geometric graph .