codes
import networkx as nx
import re
from networkx.algorithms import bipartite
G = nx.Graph()
f = open('user-app1.txt')
i = 0
for line in f:
i = i+1
print i
cell = line.split()
G.add_edge(cell[0],cell[1])
f.close()
NSet = nx.bipartite.sets(G)
User = nx.project(G,NSet[0])
print User.number_of_nodes()
P = bipartite.weighted_projected_graph(G,User, ratio = False )
a = P.edges(data = True)
f = open('User-APPResult.txt','w')
len = P.number_of_edges()
for i in xrange(len):
print i
string = str(a[i])
cell = string.split(',')
user1 = cell[0][1:]
user2 = cell[1]
weight = cell[2][12:13]
f.write(user1 + user2 +' '+ weight + '\n')
i = i + 1
f.close()
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。