This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def continue_building_graph(G, queue, visited, ID_artists, max_count, sp): | |
"""Builds a weighted graph G using BFS. | |
Given a (possibly empty) graph G and a (possibly empty) queue, | |
(1) create nodes for new artists, | |
(2) create edges for new collaborations, | |
(3) update the 'albums' attribute of an edge to keep track of all albums accounted for. | |
In the very last step, find the weight of each edge as the number of albums | |
in the 'albums' attribute. | |
Furthermore, update the dictionary of artist ID and names. |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from symfit import Parameter, variables, Fit, D, ODEModel | |
import numpy as np | |
# define number of susceptible population | |
n_susceptible = 195000 | |
# Some data | |
data_I = np.array([1, 2, 11, 23, 36, 75, 104, 137, 166, 209, 313, 400, 496, 693, 914, 1635, 2391, 5213, 8054, 11293, 15157, 19938, 24336, 29010]) | |
data_R = np.array([0, 0, 0, 0, 0, 1, 2, 5, 7, 11, 15, 21, 29, 39, 53, 71, 104, 152, 256, 417, 643, 946, 1345, 1831]) | |
data_S = [n_susceptible - x - data_R[idx] for idx, x in enumerate(data_I)] |