def k_random_intersection_graph(n, m, k):
 G = nx.empty_graph((n + m))
 mset = range(n, (n + m))
 for v in range(n):
  targets = random.sample(mset, k)
  G.add_edges_from(zip(([v] * len(targets)), targets))
 return nx.projected_graph(G, range(n))

def k_random_intersection_graph ( n , m , k ) : G = nx . empty_graph ( ( n + m ) ) mset = range ( n , ( n + m ) ) for v in range ( n ) : targets = random . sample ( mset , k ) G . add_edges_from ( zip ( ( [ v ] * len ( targets ) ) , targets ) ) return nx . projected_graph ( G , range ( n ) )
return a intersection graph with randomly chosen attribute sets for each node that are of equal size (k) .