वेट्स सहित सबसे अधिक आने-जाने वाले स्टेशन
अब तक, हमने अपने नेटवर्क को unweighted edges के साथ ही देखा है। लेकिन हमारे edge weights असल में trips की संख्या हैं, इसलिए यह तर्कसंगत है कि हम degrees के विश्लेषण को weighted degree distribution तक बढ़ाएँ। यह इसलिए महत्वपूर्ण है क्योंकि balanced degree ratio मायने रखता है, लेकिन जिसे वास्तव में rebalance करने की ज़रूरत पड़ती है, वह bikes हैं। अगर सभी स्टेशनों पर weights समान हों, तो unweighted degree ratio काम कर जाएगा। लेकिन अगर हमें जानना हो कि वास्तव में कितनी bikes प्रवाहित हो रही हैं, तो weights को ध्यान में रखना पड़ेगा।
Degree distribution का weighted समानांतर strength है। हम इसे strength() फंक्शन से निकाल सकते हैं, जो graph की edges के weight attribute के आधार पर weighted degree distribution देता है।
यह अभ्यास पाठ्यक्रम का हिस्सा है
केस स्टडीज़: R में नेटवर्क विश्लेषण
अभ्यास निर्देश
- निम्नलिखित कॉलमों वाला एक data frame बनाएँ।
trip_outमेंtrip_g_simpका"out"weighted degree (strength) distribution होना चाहिए।trip_inमें"in"weighted degree distribution होना चाहिए।ratioमें "out" degrees को "in" degrees से भाग देकर प्राप्त अनुपात होना चाहिए।
trip_strngको ऐसे rows तक फ़िल्टर करें जहाँtrip_outऔरtrip_inदोनों10से अधिक हों।- फ़िल्टर किए गए ratios का एक histogram प्लॉट करें।
इंटरैक्टिव व्यावहारिक अभ्यास
इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।
trip_strng <- data_frame(
# Find the "out" strength distribution
trip_out = strength(___, mode = "___"),
# ... and the "in" strength distribution
trip_in = strength(___, mode = "in"),
# Calculate the ratio of out / in
ratio = ___ / trip_in
)
trip_strng_filtered <- trip_strng %>%
# Filter for rows where trips in and out are both over 10
filter(___ > 10, ___ > 10)
# Plot histogram of filtered ratios
hist(___$ratio)