Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 16981

Visualize Nodes and Their Connections via python

$
0
0

I have a list of Connections between to nodes describing similarities of Entries in a Dataset.

I'm thinking of vizualising the Entries and their connections to show that there are clusters of very similar entries.

What packages can I use to do this?

I've started with networkx, problem is I don't really now how to cluster the similar nodes together with this package.

I have a List of the connections in a df:

    source  target  weight0   0       1492    11   12       937    12   16       989    13   18       371    14   18      1140    15   26       398    16   26      1061    17   30      1823    18   33      1637    19   54      1047    1

I Create a graph the following way:

import networkx as nximport matplotlib.pyplot as pltG = nx.Graph()for index, row in CC.iterrows():      G.add_edge(CC['source'].loc[index],CC['target'].loc[index], weight =1)pos = nx.spring_layout(G, seed=7)nx.draw_networkx_nodes(G, pos, node_size=5)nx.draw_networkx_edges(G, pos, edgelist=G.edges(), width=0.5)pos = nx.spring_layout(G, k=1, iterations=200)plt.figure(3, figsize=(2000,2000), dpi =2) 

The result is:

enter image description here

How can I Group the linked nodes together better?


Viewing all articles
Browse latest Browse all 16981

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>