def local_attachment(n, m, r, **kwargs):
	seed = kwargs.pop('seed',None)
	graph = kwargs.pop('graph',None)
	
	if graph is not None and not graph.is_directed():
		raise ZenException, 'The graph provided must be directed'
	if graph is not None and len(graph) > 0:
		raise ZenException, 'The graph provided is not empty'
	
	if len(kwargs) > 0:
		raise ZenException, 'Unknown arguments: %s' % ', '.join(kwargs.keys())
	
	if type(r) != int:
		raise ZenException, 'r must be an integer'
	elif r < 1:
		raise ZenException, 'r must be 1 or larger'
		
	if seed is None:
		seed = -1
	
	if seed >= 0:
		random.seed(seed)
		
	#####
	# build the initial graph
	
	G = graph
	if G is None:
		G = DiGraph()
	
	# populate with nodes
	for i in range(m+1):
		G.add_node(i)
		
	# according to Jackson's paper, all initial nodes have m neighbors.
	for i in range(m+1):
		for j in range(m+1):
			if j != i:
				G.add_edge(j,i)
			
	######
	# Build the rest of the graph
	node_list = list(range(m+1))
	for i in range(m+1,n):
		G.add_node(i)
		
		# pick random neighbors (the parents)
		parents = random.sample(node_list,r)
		
		# pick neighbors from the parents' neighborhoods
		potentials = set()
		for n in parents:
			potentials.update(G.out_neighbors(n))
			
		potentials.difference_update(parents)
		nsize = min([m-r,len(potentials)])
		neighbors = random.sample(potentials,nsize)
		
		# connect
		for v in (parents + neighbors):
			G.add_edge(i,v)
			
		node_list.append(i)
			
	# done
	return G
Create a transaction transformer object for wallet_model <model>
dataset/ETHPy150Open networkdynamics/zenlib/src/zen/generating/local.py/local_attachment--crossover with--dataset/ETHPy150Open chromaway/ngcccbase/ngcccbase/txcons.py/TransactionSpecTransformer.__init__