Skip to content

Commit

Permalink
Update P2N-NetworksBis.py
Browse files Browse the repository at this point in the history
fix networkx update
  • Loading branch information
Patent2net committed Jul 23, 2021
1 parent 3ebbe72 commit f8b1160
Showing 1 changed file with 24 additions and 24 deletions.
48 changes: 24 additions & 24 deletions Patent2Net/P2N-NetworksBis.py
Original file line number Diff line number Diff line change
Expand Up @@ -422,9 +422,9 @@ def Cleaning(texte): # this is for graphviz. Maybe an ascii converter would be o

#G, deg = calculate_degree(G1)
for noeud in G1.nodes():
G1.node[noeud]['degree_in'] = G1.in_degree(noeud)
G1.node[noeud]['degree_out'] = G1.out_degree(noeud)
G1.node[noeud]['degree'] = G1.out_degree(noeud) + G1.in_degree(noeud) #adding two sides degrees
G1.nodes[noeud]['degree_in'] = G1.in_degree(noeud)
G1.nodes[noeud]['degree_out'] = G1.out_degree(noeud)
G1.nodes[noeud]['degree'] = G1.out_degree(noeud) + G1.in_degree(noeud) #adding two sides degrees

# G, bet = calculate_betweenness(G)
# #g, eigen = calculate_eigenvector_centrality(g)
Expand All @@ -440,7 +440,7 @@ def Cleaning(texte): # this is for graphviz. Maybe an ascii converter would be o
for noed in pos2.keys():
pos[noed] = numpy.append(pos2[noed], pos3[noed])
factx, facty = 1, 1 # neatto
tutu = [int(G1.node[tt]['degree']) for tt in G1.nodes()]
tutu = [int(G1.nodes[tt]['degree']) for tt in G1.nodes()]
if len(tutu)>0:
Maxdegs = max(tutu)
else:
Expand Down Expand Up @@ -506,21 +506,21 @@ def Cleaning(texte): # this is for graphviz. Maybe an ascii converter would be o
Visu['color'] = dict()
Visu['position']= {'x':(int(pos[k][0])*factx+posx), 'y':(int(pos[k][1])*facty+posy), 'z':(int(pos[k][2])*factz+posz)}

if G1.node[k]['category'] == 'label':
G1.node[k]['url'] =UrlPatent(G1.node[k]['label'])[0]
if G1.nodes[k]['category'] == 'label':
G1.nodes[k]['url'] =UrlPatent(G1.nodes[k]['label'])[0]
Visu['color']['a'] = 1
Visu['color']['r']= int(254)
Visu['color']['g']= int(0)
Visu['color']['b']= int(0)
Visu['shape'] ="diamond"
elif G1.node[k]['category'] =='CitP':
elif G1.nodes[k]['category'] =='CitP':
Visu['color']['a'] = 1
Visu['color']['r']= int(0)
Visu['color']['g']= int(254)
Visu['color']['b']= int(0)
Visu['shape'] ="ellipse"

elif G1.node[k]['category'] == 'CitO':
elif G1.nodes[k]['category'] == 'CitO':
# a hack here, trying to find out content in scholar
#https://scholar.google.fr/scholar?hl=fr&q=pipo+test&btnG=&lr=
Visu['color']['r']= int(0)
Expand All @@ -529,40 +529,40 @@ def Cleaning(texte): # this is for graphviz. Maybe an ascii converter would be o
Visu['color']['a'] =1
Visu['shape'] ="disc"
#UrlTemp = "https://scholar.google.com/scholar?q=" + quot(Nodes.keys()[k])
#G1.node[k]['url'] = UrlTemp
elif G1.node[k]['category'] == 'CitedBy':
#G1.nodes[k]['url'] = UrlTemp
elif G1.nodes[k]['category'] == 'CitedBy':
Visu['color']['a'] = 1
Visu['color']['r']= int(0)
Visu['color']['g']= int(127)
Visu['color']['b']= int(127)
Visu['shape'] ="square"
G1.node[k]['url'] =UrlPatent(G1.node[k]['label'])[0]
G1.nodes[k]['url'] =UrlPatent(G1.nodes[k]['label'])[0]

elif G1.node[k]['category'] == "equivalents":
elif G1.nodes[k]['category'] == "equivalents":
Visu['color']['a'] = 1
Visu['color']['r']= int(127)
Visu['color']['g']= int(127)
Visu['color']['b']= int(0)
Visu['shape'] ="ellipse"
G1.node[k]['url'] =UrlPatent(G1.node[k]['label'])[0]
elif G1.node[k]['category'] == 'applicant-nice':
G1.node[k]['category'] = 'applicant'# for readable facility
G1.node[k]['url'] = UrlApplicantBuild(G1.node[k]['label'])[0]
G1.nodes[k]['url'] =UrlPatent(G1.nodes[k]['label'])[0]
elif G1.nodes[k]['category'] == 'applicant-nice':
G1.nodes[k]['category'] = 'applicant'# for readable facility
G1.nodes[k]['url'] = UrlApplicantBuild(G1.nodes[k]['label'])[0]
Visu['color']['a'] = 1
Visu['color']['r']= int(127)
Visu['color']['g']= int(0)
Visu['color']['b']= int(127)
Visu['shape'] ="star"
elif G1.node[k]['category'] == 'IPCR1' or G1.node[k]['category'] == 'IPCR3' or G1.node[k]['category'] == 'IPCR4' or G1.node[k]['category'] == 'IPCR7' or G1.node[k]['category'] == 'IPCR7' or G1.node[k]['category'] == 'CPC':
G1.node[k]['url'] = UrlIPCRBuild(G1.node[k]['label'])[0]
elif G1.nodes[k]['category'] == 'IPCR1' or G1.nodes[k]['category'] == 'IPCR3' or G1.nodes[k]['category'] == 'IPCR4' or G1.nodes[k]['category'] == 'IPCR7' or G1.nodes[k]['category'] == 'IPCR7' or G1.nodes[k]['category'] == 'CPC':
G1.nodes[k]['url'] = UrlIPCRBuild(G1.nodes[k]['label'])[0]
Visu['color']['a'] = 1
Visu['color']['r']= int(127)
Visu['color']['g']= int(254)
Visu['color']['b']= int(127)
Visu['shape'] ="database"
elif G1.node[k]['category'] == 'inventor-nice':
G1.node[k]['category'] = 'inventor'# for readable facility
G1.node[k]['url'] = UrlInventorBuild(G1.node[k]['label'])[0]
elif G1.nodes[k]['category'] == 'inventor-nice':
G1.nodes[k]['category'] = 'inventor'# for readable facility
G1.nodes[k]['url'] = UrlInventorBuild(G1.nodes[k]['label'])[0]
Visu['color']['a'] = 1
Visu['color']['r']= int(127)
Visu['color']['g']= int(127)
Expand All @@ -577,10 +577,10 @@ def Cleaning(texte): # this is for graphviz. Maybe an ascii converter would be o
if "label" not in mixNet:
mixNet.append('label')
#factx, facty = 500, 400
Visu['size'] = G1.node[k]["degree"]*10.0/Maxdegs
G1.node[k]['viz'] =dict()
Visu['size'] = G1.nodes[k]["degree"]*10.0/Maxdegs
G1.nodes[k]['viz'] =dict()
for cle in list(Visu.keys()):
G1.node[k]['viz'][cle] = Visu[cle]
G1.nodes[k]['viz'][cle] = Visu[cle]

outputFile = ndf+network +'Dyn.gexf'
outputFileJS = ndf+network +'JS.gexf'
Expand Down

0 comments on commit f8b1160

Please sign in to comment.