1

In my code:

import networkx as nx
G=nx.Graph()
G.add_edges_from([(2, 3),(4, 5), (1, 3), (1, 2), (1, 5), (1, 4), (2, 4), (3, 5), (2, 5), (3, 4)])
nx.generate_graph6(G)

I am getting this error:

AttributeError: module 'networkx' has no attribute 'generate_graph6'

I can't really understand what is this problem. Can I get some help understanding and solving this?

mandella
  • 180
  • 1
  • 17
  • 1
    Does this answer your question? [AttributeError: module 'networkx' has no attribute 'Graph'](https://stackoverflow.com/questions/42084985/attributeerror-module-networkx-has-no-attribute-graph) – ink Mar 16 '20 at 08:47
  • @ink I tried some other solutions but non of them worked, I will try also this one but for now I am going to lectures. I will let you know. Thank you! – mandella Mar 16 '20 at 08:53
  • @ink I could't try that solution, but the answer below works perfectly. Thank you for your response! – mandella Mar 16 '20 at 18:04

1 Answers1

1

Frome the networkx documentation there is a difference between the versions:

See documentation of 1.10 and of current version

It looks like the generate_graph6 method was removed. If you want to know the details, you can take a look at the commit, which removed generate_graph6. Their it states that you can simulate the behaviour of generate_graph6 with write_graph6.

Hope this helps.

Sparky05
  • 4,692
  • 1
  • 10
  • 27