[SOLVED] CS Scientific Computation Project 2

$25

File Name: CS_Scientific_Computation_Project_2.zip
File Size: 329.7 KB

5/5 - (1 vote)

Scientific Computation Project 2
Your CID here:

def func1(G,x):

Code for Part 1, question 1(a)
Input:
G: A weighted NetworkX graph
x: an integer
Output:
Fdict: A dictionary

import networkx as nx
import heapq

Fdict = {}
Mdict = {}
Mlist = []

heapq.heappush(Mlist,[0,x])
Mdict[x]=Mlist[0]

while len(Mlist)>0:
dpop,npop = heapq.heappop(Mlist)
if npop != -1000:
del Mdict[npop]
Fdict[npop] = dpop
for a,b,c in G.edges(npop,data=weight):
if b in Fdict:
pass
elif b in Mdict:
dcomp = dpop + c
if dcomp

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] CS Scientific Computation Project 2
$25