Loading Clusterisation2D_RevueSyntSem21.py +72 −17 Changes for Clusterisation2D_RevueSyntSem21.py: 72 added lines, 17 removed lines. Original line number Diff line number Diff line Loading @@ -111,14 +111,17 @@ comms1 = G.community_multilevel() comms2 = G.community_infomap() comms3 = G.community_fastgreedy() comms4 = G.community_leading_eigenvector(clusters=6) comms4 = G.community_walktrap() comms5=G.community_spinglass() comms6=G.community_edge_betweenness() comms5 = G.community_walktrap() comms7 = G.community_leading_eigenvector(clusters=6) comms8 = G.community_optimal_modularity() # très long ... comms6 = G.community_optimal_modularity() # très long ... comms7=G.community_spinglass() comms8=G.community_edge_betweenness() comms9=G.community_label_propagation() # --------------- Loading Loading @@ -146,25 +149,77 @@ visual_style3["legend"] = "Mot : "+ mot.upper() # ---------------------------------- # Création des images résultat ''' igraph.plot(comms1, mot+"-multilevelNoMarkGroups.svg", **visual_style3) igraph.plot(comms2, mot+"-infomapNoMarkGroups.svg", mark_groups = False, **visual_style3) igraph.plot(comms3, mot+"-fastgreedy.svg", mark_groups = True, **visual_style3) igraph.plot(comms4, mot+"-leading-eigenvector.svg", mark_groups = True, **visual_style3) igraph.plot(comms5, mot+"-walktrap.svg", **visual_style3) igraph.plot(comms6, mot+"-optimal_modularity.svg", mark_groups = True, **visual_style3) igraph.plot(comms7, mot+"-spinglassNoMarkGroups.svg", mark_groups = False, **visual_style3) igraph.plot(comms8, mot+"-edge_betweenness.svg", mark_groups = True, **visual_style3) igraph.plot(comms9, mot+"-label_propagation.svg", mark_groups = True, **visual_style3) # --------------- igraph.plot(comms4, mot+"-walktrap.svg", **visual_style3) igraph.plot(comms5, mot+"-spinglassNoMarkGroups.svg", mark_groups = False, **visual_style3) igraph.plot(comms6, mot+"-edge_betweenness.svg", mark_groups = True, **visual_style3) igraph.plot(comms7, mot+"-leading-eigenvector.svg", mark_groups = True, **visual_style3) igraph.plot(comms8, mot+"-optimal_modularity.svg", mark_groups = True, **visual_style3) igraph.plot(comms9, mot+"-label_propagation.svg", mark_groups = True, **visual_style3) ''' # --------------- # comparaisons # utilisation de la fonction compare_communities de igraph : # https://igraph.org/python/doc/igraph.clustering-module.html#compare_communities # comms3 - fastgreedy,comms4-walktrap, comms6-edge-betweeness sont de type vertexdendrogram # il faut donc les transformer en vertexclustering pour la comparaison en choisissnat une ligne de coupe -> 6 comms3b=comms3.as_clustering(n=6) igraph.plot(comms3b, mot+"-fastgreedy2.svg", mark_groups = True, **visual_style3) comms4b=comms4.as_clustering(n=6) igraph.plot(comms4b, mot+"-walktrap2.svg",mark_groups = True, **visual_style3) comms6b=comms6.as_clustering(n=6) igraph.plot(comms6b, mot+"-edge_betweenness2.svg", mark_groups = True, **visual_style3) com=[comms1,comms2,comms3b,comms4b,comms5,comms6b,comms7,comms8,comms9] labels=['multilevel','infomap','fastgreedy','walktrap','spinglass','edge_betweeness','eigenvector','optimal_modularity','label_propagation'] communautes=[comms1] print("VI") for i in range(9): print(labels[i],':') for j in range(9): r= igraph.compare_communities(com[i],com[j],method='vi', remove_none=False) print('\t',labels[j],'-',round(r,2)) print("\nNMI") for i in range(9): print(labels[i],':') for j in range(9): r= igraph.compare_communities(com[i],com[j],method='nmi', remove_none=False) print('\t',labels[j],'-',round(r,2)) print("\nSPLIT-JOIN") for i in range(9): print(labels[i],':') for j in range(9): r= igraph.compare_communities(com[i],com[j],method='split-join', remove_none=False) print('\t',labels[j],'-',round(r,2)) print("\nRAND") for i in range(9): print(labels[i],':') for j in range(9): r= igraph.compare_communities(com[i],com[j],method='rand', remove_none=False) print('\t',labels[j],'-',round(r,2)) print("\nADJUSTED_RAND") for i in range(9): print(labels[i],':') for j in range(9): r= igraph.compare_communities(com[i],com[j],method='adjusted_rand', remove_none=False) print('\t',labels[j],'-',round(r,2)) No newline at end of file sec-fastgreedy2.png +3.28 MiB Loading image diff... sec-walktrap2.png +3.01 MiB Loading image diff... Loading
Clusterisation2D_RevueSyntSem21.py +72 −17 Changes for Clusterisation2D_RevueSyntSem21.py: 72 added lines, 17 removed lines. Original line number Diff line number Diff line Loading @@ -111,14 +111,17 @@ comms1 = G.community_multilevel() comms2 = G.community_infomap() comms3 = G.community_fastgreedy() comms4 = G.community_leading_eigenvector(clusters=6) comms4 = G.community_walktrap() comms5=G.community_spinglass() comms6=G.community_edge_betweenness() comms5 = G.community_walktrap() comms7 = G.community_leading_eigenvector(clusters=6) comms8 = G.community_optimal_modularity() # très long ... comms6 = G.community_optimal_modularity() # très long ... comms7=G.community_spinglass() comms8=G.community_edge_betweenness() comms9=G.community_label_propagation() # --------------- Loading Loading @@ -146,25 +149,77 @@ visual_style3["legend"] = "Mot : "+ mot.upper() # ---------------------------------- # Création des images résultat ''' igraph.plot(comms1, mot+"-multilevelNoMarkGroups.svg", **visual_style3) igraph.plot(comms2, mot+"-infomapNoMarkGroups.svg", mark_groups = False, **visual_style3) igraph.plot(comms3, mot+"-fastgreedy.svg", mark_groups = True, **visual_style3) igraph.plot(comms4, mot+"-leading-eigenvector.svg", mark_groups = True, **visual_style3) igraph.plot(comms5, mot+"-walktrap.svg", **visual_style3) igraph.plot(comms6, mot+"-optimal_modularity.svg", mark_groups = True, **visual_style3) igraph.plot(comms7, mot+"-spinglassNoMarkGroups.svg", mark_groups = False, **visual_style3) igraph.plot(comms8, mot+"-edge_betweenness.svg", mark_groups = True, **visual_style3) igraph.plot(comms9, mot+"-label_propagation.svg", mark_groups = True, **visual_style3) # --------------- igraph.plot(comms4, mot+"-walktrap.svg", **visual_style3) igraph.plot(comms5, mot+"-spinglassNoMarkGroups.svg", mark_groups = False, **visual_style3) igraph.plot(comms6, mot+"-edge_betweenness.svg", mark_groups = True, **visual_style3) igraph.plot(comms7, mot+"-leading-eigenvector.svg", mark_groups = True, **visual_style3) igraph.plot(comms8, mot+"-optimal_modularity.svg", mark_groups = True, **visual_style3) igraph.plot(comms9, mot+"-label_propagation.svg", mark_groups = True, **visual_style3) ''' # --------------- # comparaisons # utilisation de la fonction compare_communities de igraph : # https://igraph.org/python/doc/igraph.clustering-module.html#compare_communities # comms3 - fastgreedy,comms4-walktrap, comms6-edge-betweeness sont de type vertexdendrogram # il faut donc les transformer en vertexclustering pour la comparaison en choisissnat une ligne de coupe -> 6 comms3b=comms3.as_clustering(n=6) igraph.plot(comms3b, mot+"-fastgreedy2.svg", mark_groups = True, **visual_style3) comms4b=comms4.as_clustering(n=6) igraph.plot(comms4b, mot+"-walktrap2.svg",mark_groups = True, **visual_style3) comms6b=comms6.as_clustering(n=6) igraph.plot(comms6b, mot+"-edge_betweenness2.svg", mark_groups = True, **visual_style3) com=[comms1,comms2,comms3b,comms4b,comms5,comms6b,comms7,comms8,comms9] labels=['multilevel','infomap','fastgreedy','walktrap','spinglass','edge_betweeness','eigenvector','optimal_modularity','label_propagation'] communautes=[comms1] print("VI") for i in range(9): print(labels[i],':') for j in range(9): r= igraph.compare_communities(com[i],com[j],method='vi', remove_none=False) print('\t',labels[j],'-',round(r,2)) print("\nNMI") for i in range(9): print(labels[i],':') for j in range(9): r= igraph.compare_communities(com[i],com[j],method='nmi', remove_none=False) print('\t',labels[j],'-',round(r,2)) print("\nSPLIT-JOIN") for i in range(9): print(labels[i],':') for j in range(9): r= igraph.compare_communities(com[i],com[j],method='split-join', remove_none=False) print('\t',labels[j],'-',round(r,2)) print("\nRAND") for i in range(9): print(labels[i],':') for j in range(9): r= igraph.compare_communities(com[i],com[j],method='rand', remove_none=False) print('\t',labels[j],'-',round(r,2)) print("\nADJUSTED_RAND") for i in range(9): print(labels[i],':') for j in range(9): r= igraph.compare_communities(com[i],com[j],method='adjusted_rand', remove_none=False) print('\t',labels[j],'-',round(r,2)) No newline at end of file