python function not recurving properly (adding nodes to graph)
===

I'm having a rare honest-to-goodness computer science problem (as opposed to the usual how-do-I-make-this-language-I-don't-write-often-enough-do-what-I-want problem), and really feeling my lack of a CS degree for a change.

This is a bit messy, because I'm using several dicts of lists, but the basic concept is this: a Twitter-scraping function that adds retweets of a given tweet to a graph, node-by-node, building outwards from the original author (with follower relationships as edges).

       
    for t in RTs_list:
	g = nx.DiGraph()
	followers_list=collections.defaultdict(list)
	level=collections.defaultdict(list)
	hoppers=collections.defaultdict(list)
	retweets = []
	retweeters = []
	try:
		u = api.get_status(t)
		original_tweet = u.retweeted_status.id_str
		print original_tweet
		ot = api.get_status(original_tweet)
		node_adder(ot.user.id, 1)
		# Can't paginate -- can only get about ~20 RTs max. Need to work on small data here.
		retweets = api.retweets(original_tweet)
		for r in retweets:
			retweeters.append(r.user.id)
		followers_list["0"] = api.followers_ids(ot.user.id)[0]
		print len(retweets),"total retweets"
		level["1"] = ot.user.id
		g.node[ot.user.id]['crossover'] = 1
		if g.node[ot.user.id]["followers_count"]<4000:
			bum_node_adder(followers_list["0"],level["1"], 2)
		for r in retweets:
			rt_iterator(r,retweets,0,followers_list,hoppers,level)		
	except:
		print ""

    def rt_iterator(r,retweets,q,followers_list,hoppers,level):
	q = q+1
	if r.user.id in followers_list[str(q-1)]:
		hoppers[str(q)].append(r.user.id)
		node_adder(r.user.id,q+1)
		g.add_edge(level[str(q)], r.user.id)
		try:
			followers_list[str(q)] = api.followers_ids(r.user.id)[0]
			level[str(q+1)] = r.user.id
			if g.node[r.user.id]["followers_count"]<4000:
				bum_node_adder(followers_list[str(q)],level[str(q+1)],q+2)
				crossover = pull_crossover(followers_list[str(q)],followers_list[str(q-1)])
			if q<10:
				for r in retweets:
					rt_iterator(r,retweets,q,followers_list,hoppers,level)
		except:
			print ""

There's some other function calls in there, but they're not related to the problem. The main issue is how Q counts when going from a (e.g.) a 2-hop node to a 3-hop node. I need it to build out to the maximum depth (10) for every branch from the center, whereas right now I believe it's just building out to the maximum depth for the first branch it tries. Hope that makes sense. If not, typing it up here has helped me; I think I'm just missing a loop in there somewhere but it's tough for me to see.

Also, ignore that various dicts refer to Q+1 or Q-1, that's an artifact of how I implemented this before I refactored to make it recurve.

Thanks!