Do you have any idea what i isn't incrementing? I'm trying to generate a weighted graph with n nodes?

i is my increment.

So if I call genWeightGraph(10), I want to add 10 nodes, adding node k to two vertexes (v1 and v2). I am starting my graph with just two nodes connected to each other, so the list of their edges starts out as being [[1],[0]], with the index of list[index] = vertex. I'm generating k randomly from a set of N nodes, and I'm connecting K to 2 random vertexes. 

The list weighted exists because, like the internet, the more connections/edges you have, the more likely new nodes are to connect to you. So weighted list just helps me account for this probability bias, as I pull/sample from this weighted list.

But it doesn't end. Ever. I can't figure it out.

```
def genWeightGraph(n): #n nodes, davg number of links
    links = [[] for i in xrange(n-2)] # create n many nodes -2 to adjust for insert [1],[0]
    links.insert(0,[1])
    links.insert(1,[0]) # start with [[1],[0],...[]] of n length
    weighted = [nodes for v in links for nodes in v] #initialized weighted list of [1,0]
    i = 0 #initialized edges added
    while (i < n): #add this many nodes
        v1 = random.choice(weighted) #pick a friend/vertex from weighted list
        v2 = random.choice(weighted) #pick another friend/vertex from weighted list
        k = random.choice(xrange(2,n)) #pick a new friend to connect both v1 and v2 to
        print "v1", v1
        print "v2", v2 
        print "k", k
        print "nodes", i
        if k in links[v1] or links[v2]:
           continue
        elif v1 == v2: # if you pick the same vertex, just add k to one of them
            links[v1].append(k)
            links[k].append(v1)
            weighted += [k,v1] 
            i += 1
        else:
            links.insert(v1, k) # access v1's friend list, append k
            links.insert(k, v1) # find k's list, add v
            links.insert(v2, k) #add k to v2's list
            links.insert(k, v2) #find k's list, add v2 
            weighted += [k,v1,k,v2] #add to weighted
            i += 1

```