I have a CSV with the following,
x,y,6
y,z,9
y,p,5
x,p,3
here, letters are nodes and numbers are the edges. I drew the graph :
Gph = nx.read_edgelist(filepath, delimiter=',', data=[('weight', int)])
G.edges(data=True)
edge_labels = dict(((u, v), d['weight']) for u, v, d in Gph.edges(data=True))
pos = nx.random_layout(Gph)
#pos = nx.pydot_layout(Gph)
nx.draw(Gph, pos, with_labels=True)
nx.draw_networkx_edges(Gph, pos, edge_color='b')
plt.show()
how to cluster the nodes based on the edges? so the pairs become element of a cluster. x, y is an element of a the cluster.