0

I have generated a random graph, how can I save it to a csv file?

g=networkx.erdos_renyi_graph(100,.3)

1 Answer 1

1

Normally you store networkx graphs as edge-list - there is a dedicated method to do that (and read it back in as well):

import networkx as nx

g=nx.erdos_renyi_graph(100,.3)
nx.write_edgelist(g, "file.csv")

See

If you really need a csv, this might help.

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.