#!/usr/bin/env python
import random
num = 10000
neighs = 100
nodelist = range(num)
nodemap = {}
D = {}
for n in nodelist:
nodemap[n] = n
D[n] = []
for n in range(num):
j = 0
while j < neighs:
j += 1
m = random.randrange(0,num)
n = nodemap[n]
m = nodemap[m]
D[n].append(m)
D[m].append(n)
#D[n][m] = None
#D[m][n] = None
# dict of dicts: 238, 155
# dict of sets: 194, 111
# dict of lists: 125, 42