Question: Complete the function calc _ genrated _ stats to compute various network properties such as network diameter, characteristic path length ( CPL ) , average
Complete the function calcgenratedstats to compute various network properties such as network diameter, characteristic path length CPL average clustering coefficient, transitivity, and assortativity for each grph in a provided list. If any grph is not fully connected, consider using its largest connected component for analysis. The results are returned as a dict where each property is described by a string key, with a list of corresponding values for each grph
Then, implement the function comparegenratedtogrndtruth to perform a onesample ttest on the empirical network properties against the sampled values from each grph model. It compares the diameter, CPL average clustering coefficient, transitivity, and assortativity. The results are returned as a dict of pvalues.
Lastly, develop the function pltgrphstats to visually represent the distribution of each network property eg CPL average clustering through boxplts. The boxplts are arranged in a single plt with five sidebyside subplts, each depicting one property. The overall plt is labeled with the generator name, and each individual boxplt is labeled with the corresponding property on the yaxis.
def calcgenratedstatsgrphs: ListnxGrph Dictstr list:
Inputs:
grphs: a list of NetworkX grph object
Returns:
a dict of grph stats
return grphstats
def comparegenratedtogrndtruthgrndtruthfeatures: Dictstr float genratedfeatures: Dictstr Listfloat Dictstr float:
Inputs:
grndtruthfeatures: a dict of grph stats
genratedfeatures: a dict of grph stats
Returns:
a dict of onesample ttest
return pvals
def pltgrphstatsgrphstats: ListDictstr list save: boolFalse None:
Inputs:
grphstats: a dict of grph stats
Returns:
None
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
