I am working on a community detection GUI program in PyQt5. In a section of my program I want to visualize a network (Graph) which I have found its communities.
When i run the program in non-GUI way everything is OK and the graph is visualized in the browser but when i put the code in GUI again everything runs correctly and the program ends with no errors, but the graph is not shown in the browser.
I appreciate any help on this problem.
The code below shows how i visualize the graph. coms.communities is the communities which i have found using CDLIB library and nodes_list holds the label of each node. I aimed to color the nodes in same community with same color and because of that i use the labeles of nodes to give them same color.
palette = (sns.color_palette("Pastel1", n_colors=len(coms.communities)))
palette = palette.as_hex()
colorDict = {}
counter = 0
for i in palette:
colorDict[counter] = i
counter += 1
N = Network(height='100%', width='100%', directed=False, notebook=False)
for n in G.nodes:
N.add_node(n, color=(colorDict[nodes_list[n]]), size=5)
for e in G.edges.data():
N.add_edge(e[0], e[1])
N.show('result.html')
Everything is OK with code but i don't know how to use this code in a GUI program to show the constructed graph in a browser.