Spatial
Builder implementations for spatial and local Watts-Strogatz social networks.
Implements local_social_network, spatial_social_network, bounded_distance network types.
build_bounded_distance(world, network_config)
Random contacts within a geographic radius.
Required network_config keys
mean_count – mean connections per person pool.max_km – search radius (km)
Optional: clustering_level – clustering coefficient (default 0.7) pool.level – geo unit level (defaults to smallest)
Source code in may/social_networks/builder_functions/spatial.py
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | |
build_local_social_network(world, network_config)
Watts-Strogatz social network within the smallest geo units.
Required network_config keys
mean_count – mean connections per person
Optional: pool.level – geo unit level (defaults to geography.levels[0]) clustering_level – rewiring probability (default 0.8) assign_activity – dict with contact_activity_key and activity_key
Source code in may/social_networks/builder_functions/spatial.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | |
build_spatial_social_network(world, network_config)
Spatial Watts-Strogatz between geo units in an annulus.
Required network_config keys
mean_count – mean connections per person pool.min_km – inner radius (km) pool.max_km – outer radius (km)
Optional: clustering_level – rewiring probability (default 0.9) pool.level – geo unit level (defaults to smallest) assign_activity – dict with contact_activity_key and activity_key
Source code in may/social_networks/builder_functions/spatial.py
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | |