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?

3
  • 1
    Does this answer your question? AttributeError: module 'networkx' has no attribute 'Graph' Commented Mar 16, 2020 at 8: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! Commented Mar 16, 2020 at 8:53
  • @ink I could't try that solution, but the answer below works perfectly. Thank you for your response! Commented Mar 16, 2020 at 18:04

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.