You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@j6k4m8 screenshare not required at the moment but I may take you up on that in the future. So trying to write out a graphml as suggested throws an error (stack trace below). If I compare a networkx graph's attributes and those of G.nx, you'll see: [...,'edges', 'get_edge_data','graph','graph_attr_dict_factory','has_edge','has_node'...] for the former compared to [...'edges','get_edge_data','graph_attr_dict_factory','has_edge','has_node',...] for the latter. That is, the 'graph' attribute isn't present in G.nx. I'm guessing that's intentional?
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Input In [35], in <module>
1 graphml_file_name = 'graphtools.graphml'
----> 3 nx.write_graphml(G.nx, graphml_file_name)
File <class 'networkx.utils.decorators.argmap'> compilation 17:5, in argmap_write_graphml_lxml_13(G, path, encoding, prettyprint, infer_numeric_types, named_key_ids, edge_id_from_attribute)
3 from contextlib import contextmanager
4 from pathlib import Path
----> 5 import warnings
7 import networkx as nx
8 from networkx.utils import create_random_state, create_py_random_state
File ~/opt/miniconda3/envs/graph_analytics/lib/python3.8/site-packages/networkx/readwrite/graphml.py:171, in write_graphml_lxml(G, path, encoding, prettyprint, infer_numeric_types, named_key_ids, edge_id_from_attribute)
160 except ImportError:
161 return write_graphml_xml(
162 G,
163 path,
(...)
168 edge_id_from_attribute,
169 )
--> 171 writer = GraphMLWriterLxml(
172 path,
173 graph=G,
174 encoding=encoding,
175 prettyprint=prettyprint,
176 infer_numeric_types=infer_numeric_types,
177 named_key_ids=named_key_ids,
178 edge_id_from_attribute=edge_id_from_attribute,
179 )
180 writer.dump()
File ~/opt/miniconda3/envs/graph_analytics/lib/python3.8/site-packages/networkx/readwrite/graphml.py:729, in GraphMLWriterLxml.__init__(self, path, graph, encoding, prettyprint, infer_numeric_types, named_key_ids, edge_id_from_attribute)
726 self.attribute_types = defaultdict(set)
728 if graph is not None:
--> 729 self.add_graph_element(graph)
File ~/opt/miniconda3/envs/graph_analytics/lib/python3.8/site-packages/networkx/readwrite/graphml.py:740, in GraphMLWriterLxml.add_graph_element(self, G)
737 else:
738 default_edge_type = "undirected"
--> 740 graphid = G.graph.pop("id", None)
741 if graphid is None:
742 graph_element = self._xml.element("graph", edgedefault=default_edge_type)
AttributeError: 'NetworkXDialect' object has no attribute 'graph'
Via @MikeB2019x:
@j6k4m8 screenshare not required at the moment but I may take you up on that in the future. So trying to write out a graphml as suggested throws an error (stack trace below). If I compare a networkx graph's attributes and those of
G.nx
, you'll see:[...,'edges', 'get_edge_data','graph','graph_attr_dict_factory','has_edge','has_node'...]
for the former compared to[...'edges','get_edge_data','graph_attr_dict_factory','has_edge','has_node',...]
for the latter. That is, the 'graph' attribute isn't present inG.nx
. I'm guessing that's intentional?Originally posted by @MikeB2019x in #35 (comment)
The text was updated successfully, but these errors were encountered: