Hello friends,
Its been quite a time that I am using networkx, but for the first
time I am facing a strange problem and am unable to figure out what's
causing the error.
I have created some graphs and saved them as <filename>.gpickle files
using networkx.write_gpickle(<filename>).
I retrieved these graphs in another of my python programs using
networkx.read_gpickle(<filename>,<format type>). Then I try to get the
properties of these graphs using different in-built functions of
networkx. My codes and error are given below:
>>> import networkx as nx
>>> G=nx.read_gpickle('some_path/example_graph.gpickle')
>>> G.number_of_nodes()
14
>>> G.number_of_edges()
14
>>> nx.number_connected_components(G)
1
>>> len(nx.connected_component_subgraphs(G))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/site-packages/networkx-1.3-py2.7.egg/
networkx/algorithms/components/connected.py", line 157, in
connected_component_subgraphs
graph_list.append(G.subgraph(c))
File "/usr/local/lib/python2.7/site-packages/networkx-1.3-py2.7.egg/
networkx/classes/graph.py", line 1474, in subgraph
H.name = "Subgraph of (%s)"%(
self.name)
AttributeError: 'Graph' object has no attribute 'name'
As to my knowledge, if we do not provide a graph name, networkx uses a
default name to avoid this error. I have used exacly the same codes
many times before on many other saved graphs but never gave such an
error. I am totally lost. Can anyone help me please????
Python I am using is 2.7 and networkx version is 1.3. and I am working
on a Rehat (Fedora) linux OS.