Closed glwagner closed 4 years ago
Yes, we should use G.nodes() as our node iterator. This would be quite helpful.
I will also fix our current networks to fix the issue for the moment.
@lubo93 there is one complication. The master equation solver does not use a graph. Therefore, there needs to be a 1-1 correspondence between list elements and node numbers.
If we want to allow the node id's to have "gaps", but still correspond in a simple way to a list, we can potentially use an OrderedGraph?
https://networkx.github.io/documentation/stable/reference/classes/ordered.html
@lubo93, please advise.
Ok, I will then just fix our networks. We should add a description in the README to make sure that everyone uses edge lists with 0,1,... node numbers. Some objects in networkx (e.g., lattices) don't use this convention.
This issue should be solved by using "contact_network = nx.convert_node_labels_to_integers(contact_network)". @glwagner , can you confirm that this solves the problem? Then we could close this issue.
Yes, I believe this issue was solved by #64. Thanks @lubo93 .
The issues discussed in #58 and #60 arise because the node id's generated from
'edge_list_SBM_1e4.txt'
are not a range from 0 topopulation-1
.In contrast, many initialization functions ---
populate_ages
,sample_distribution
, andTransitionRates
assume that the nodes are a range from 0 topopulation-1
, and therefore correspond 1-1 with the node id's.To relax the assumption that node id's are a range, we need to either use dictionaries, or the contact network itself to assign ages and clinical statistics to the population.
I propose that we use the contact network itself. In this abstraction, we will assign ages to the contact network according to a distribution. Thus
populate_ages
will be replaced withassign_ages(contact_network, distribution)
. The generation of distributions for the clinical parameters, as well as the constructor forTransitionRates
will have to be modified accordingly.I don't think this will take long. @lubo93, please advise.