Multiplex Network Pseudocode: Difference between revisions
From Santa Fe Institute Events Wiki
(Created page with '= Generating Network = == Node Creation == == Edge Creation == = Process on Network = == Network Update == === Asynchronous Update === == Node Update == === Fermi Rule ===') |
|||
Line 2: | Line 2: | ||
== Node Creation == | == Node Creation == | ||
== Edge Creation == | == Edge Creation == | ||
=== Basic Edge With Complex Attributes === | |||
<tt> | |||
def initEdge(G,N,L): | |||
for l in range(L): | |||
i=rng.randrange(N) | |||
j=rng.randrange(N) | |||
payoff = np.matrix([[rng.random() for e in range(2)] for e in range(2)]) | |||
#payoff = payoff/payoff.sum().sum() | |||
G.add_edge(i,j,w=payoff) | |||
G.add_edge(j,i,w=payoff.transpose()) | |||
return G | |||
</tt> | |||
= Process on Network = | = Process on Network = |
Revision as of 19:26, 18 June 2014
Generating Network
Node Creation
Edge Creation
Basic Edge With Complex Attributes
def initEdge(G,N,L):
for l in range(L): i=rng.randrange(N) j=rng.randrange(N) payoff = np.matrix([[rng.random() for e in range(2)] for e in range(2)]) #payoff = payoff/payoff.sum().sum() G.add_edge(i,j,w=payoff) G.add_edge(j,i,w=payoff.transpose()) return G