QUT-Digital-Observatory / coordination-network-toolkit

A small command line tool and set of functions for studying coordination networks in Twitter and other social media data.
MIT License
71 stars 14 forks source link

NetworkXNotImplemented: not implemented for directed type #53

Closed Monika-cnb closed 1 year ago

Monika-cnb commented 1 year ago

Hi,

I get this error while trying to plot the graph. I'm able to plot the graph in a different way but I'm not sure why the below code is not working for me. " for g in nx.connected_components(similarity_graph): print(g)"

What can I do to resolve this error?

Thanks

deimosnz commented 1 year ago

Hi,

Please send through the error text you get. That would be a great help.

Thanks Rob

Monika-cnb commented 1 year ago

Hi Rob,

This is the error I'm getting. Everything else apart from this is working fine. image

Thanks

deimosnz commented 1 year ago

Thanks,

"connected_components" is not implemented for directed graphs as per the docs for networkx - https://networkx.org/documentation/stable/reference/algorithms/generated/networkx.algorithms.components.connected_components.html#networkx.algorithms.components.connected_components

In short, directed graphs do not support connected components in the same way as undirected graphs.

The networkx functions "strongly_connected_components" or "weakly_connected_components" should be passed for directed graphs (see the docs linked in the page I have linked for you above)

It may be possible to use other community detection algorithms to achieve similar partitioning of your graph.

I hope this helps and come back to me if it doesn't.

Thanks

Rob

Monika-cnb commented 1 year ago

Thanks for linking the docs, Rob.

I'll take a look at the docs and try with different networkx functions.

Thanks for your help.

Best, Monika