Question: (python) Please don't use network X. Adapt the Random Network you designed in the last assignment according to the Barabasi-Albert network model, to implement their

(python) Please don't use network X. Adapt the Random Network you designed in the last assignment according to the Barabasi-Albert network model, to implement their network model.

PAST PROGRAM BELOW****

import random

from collections import Counter

import numpy as np

def randGraph(N,p):

#initialize G:

gr = {}

for a in range(N):

gr[a] = []

#iterate through potential edges:

for a in range(N-1):

for b in range(a+1,N):

if random.random() < p:

gr[a].append(b)

gr[b].append(a)

#sort adjacency lists before returning:

for a in gr:

gr[a].sort()

return gr

g=randGraph(6,.5)

n = len(g)

print(n)

for v in range(0,n):

print(v, ":", g[v])

program fro. last assignment is shown in the description

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!