As I understand connected_components()
method in NetworkX should generate components in a given undirected graph (There are strongly_connected_components()
and weakly_connected_components()
for directed graph). I have generated an undirected graph G and while trying to implement networkx.connected_components(G)
, I am getting the error NetworkXNotImplemented: not implemented for directed type
.
Note: G was the interaction network of users of the Pretty Good Privacy (PGP) algorithm (http://deim.urv.cat/~aarenas/data/welcome.htm). The network is a single giant component.
I have implemented the method for many other undirected networks.
import networkx as nx
G=nx.read_pajek("PGPgiantcompo.net")
C=max(nx.connected_components(G), key=len)
Expected result:
C contains the giant component which is G itself.
Actual result:
NetworkXNotImplemented Traceback (most recent call last)
<ipython-input-1-27a0ad1fa789> in <module>()
---> 27 C=max(nx.connected_components(G), key=len)
28 Giant_frozen=G.subgraph(C)
29 nx.draw(Giant_frozen, with_labels=True, font_weight='bold')
<decorator-gen-295> in connected_components(G)
F:\Anaconda3\lib\site-packages\networkx\utils\decorators.py in _not_implemented_for(not_implement_for_func, *args, **kwargs)
78 if match:
79 msg = 'not implemented for %s type' % ' '.join(graph_types)
---> 80 raise nx.NetworkXNotImplemented(msg)
81 else:
82 return not_implement_for_func(*args, **kwargs)
NetworkXNotImplemented: not implemented for directed type