This will give you the initial weights on the graph. Whenever an edge is
followed, the following algorithm is applied a number of times equal to
the weight on the edge, immediately after it is followed (note that the
cur here is the same cur as above, and that we never reset its value):

for i = 0 to nodes - 1
for j = 0 to nodes - 1
if(i does not equal j)
cur = ((cur * A) + B) % M
weight(i,j) = weight(i,j) + (cur % 21) - 10
if(weight(i,j) < 1)
weight(i,j) = 1
end if
end if
end for
end for