GiulioRossetti / cdlib

Community Discovery Library
http://cdlib.readthedocs.io
BSD 2-Clause "Simplified" License
374 stars 71 forks source link

Visualization of Edge clustering #145

Closed steevelaquitaine closed 3 years ago

steevelaquitaine commented 3 years ago

Hi,

Can cdlib.classes.edge_clustering.EdgeClustering objects be plotted yet? I could not find the answer in the user documentation.

Plotting a graph from a cdlib.classes.node_clustering.NodeClustering object is easy:

graph = nx.karate_club_graph()
communities = algorithms.louvain(graph)
pos = nx.spring_layout(graph)
viz.plot_network_clusters(graph, communities, pos)

But the same does not seem to work with an ..EdgeClustering object:

communities = algorithms.hierarchical_link_community(graph)
pos = nx.spring_layout(graph)
viz.plot_network_clusters(graph, communities, pos)

Thanks a lot for any help you can provide. s.

github-actions[bot] commented 3 years ago

Thanks for submitting your first issue!

GiulioRossetti commented 3 years ago

Hi,

unfortunately, you are right: at the moment EdgeClustering objects are not natively supported by visualization methods.

I'll work on it: in the meantime, my suggestion is to move from EdgeClustering to NodeClustering by reshaping the communities. It is not an ideal solution but it should work just fine.

Giulio

steevelaquitaine commented 3 years ago

@GiulioRossetti : Thanks a lot for your quick reply. Will do.