91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 2KB
    文件類型: .zip
    金幣: 1
    下載: 0 次
    發布日期: 2021-01-01
  • 語言: Python
  • 標簽: GN??gn算法??python??

資源簡介

本算法為GN算法,實現對數據的分類。親測有效,如有疑問請私聊。

資源截圖

代碼片段和文件信息

#coding:utf-8
import?networkx?as?nx
import?math
import?csv
import?random?as?rand
import?sys
import?matplotlib.pyplot?as?plt

def?buildG(G?file_?delimiter_):
????reader?=?csv.reader(open(file_)?delimiter=delimiter_)
????for?line?in?reader:
????????G.add_edge(int(line[0])int(line[1]))

def?CmtyStep(G):
????init_number_comp?=?nx.number_connected_components(G)
????number_comp?=?init_number_comp
????while?number_comp?<=?init_number_comp:
????????bw?=?nx.edge_betweenness_centrality(G)#計算所有邊的邊介數中心性
????????if?bw.values()?==?[]:
????????????break
????????else:
????????????max_?=?max(bw.values())#將邊介數中心性最大的值賦給max_
????????for?k?v?in?bw.iteritems():#刪除邊介數中心性的值最大的邊
????????????if?float(v)?==?max_:
????????????????G.remove_edge(k[0]k[1])
????????number_comp?=?nx.number_connected_components(G)#計算

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????3215??2018-09-29?16:10??gn.py

評論

共有 條評論