開始使用免費開始

Fast-greedy 社群偵測

你要先嘗試的社群偵測方法是 fast-greedy 社群偵測。你會使用 Zachary Karate Club 網路。這個社群網路包含 34 位社團成員與 78 條邊。每一條邊表示這兩位成員不只在空手道社團內互動,也在社團外有互動。使用這個網路,你將判定網路中有多少個子社群,以及哪些成員屬於哪些子群。同時,你也會依社群成員歸屬繪製網路圖。

本練習屬於課程

R 的 Network Analysis

檢視課程

練習說明

  • 使用 fastgreedy.community() 建立社群物件,並指定給物件 kc
  • kc 上使用 sizes(),找出偵測到多少個社群,以及每個社群包含多少位成員。
  • 使用 membership() 顯示各社團成員分別屬於哪些社群。
  • 使用 plot() 繪製預設的社群圖。第一個引數為物件 kc,第二個引數為圖形物件 g

動手互動練習

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

# Perform fast-greedy community detection on network graph
kc = ___(g)

# Determine sizes of each community
___(___)

# Determine which individuals belong to which community
___(___)

# Plot the community structure of the network
___(___, g)
編輯並執行程式碼