開始使用免費開始

往返最多的站點

在這裡你會查看哪些站點最常被前往與出發,以及「入度對出度」的比值。這能告訴我們哪些站點有明顯偏向:要不是很多其他站點從它們借走腳踏車,就是有很多人把腳踏車還到那裡。對於這類共享單車的網路圖要能有效運作,來源站或匯集站不能太多;否則網路的營運方就得不斷四處搬運腳踏車!理想狀況是網路本身能自我平衡;如果做得到,我們預期幾乎所有站點的入度與出度比值都會接近 1。首先,我們會先在「無權重」的情況下觀察。

本練習屬於課程

案例研究:R 的網路分析

檢視課程

練習說明

  • 建立一個包含下列欄位的資料框:
    • trip_out 應包含 trip_g_simp"out" 度數分佈。
    • trip_in 應包含 "in" 度數分佈。
    • ratio 應為「out 度數 ÷ in 度數」的比值。
  • trip_deg 進行篩選,只保留 trip_outtrip_in 皆大於 10 的列。
  • 繪製篩選後比值的長條圖。

動手互動練習

試著完成這個範例程式碼,體驗一下這個練習。

trip_deg <- data_frame(
  # Find the "out" degree distribution
  trip_out = degree(___, mode = "___"), 
  # ... and the "in" degree distribution
  trip_in = degree(___, mode = "in")
  # Calculate the ratio of out / in
  ratio = ___ / trip_in
)

trip_deg_filtered <- trip_deg %>%
  # Filter for rows where trips in and out are both over 10
  ___(___ > 10, ___ > 10) 

# Plot histogram of filtered ratios
hist(___$ratio)
編輯並執行程式碼