2

I wrote code below to show graph with igraph package, But I don't know How can I export igraph result in csv file in python? and my another question is how can I add label?

import igraph as ig 
import pandas as pd
g=ig.Graph.TupleList(df.itertuples(index=False),directed=True)
ig.plot(g, target='graph.png', vertex_size=10, bbox=(0, 0, 500, 500))
user12217822
  • 292
  • 1
  • 5
  • 16

1 Answers1

3

Because I want to import that in gephi application I need csv file

Here is the list of formats that igraph can export to:

https://igraph.org/python/api/latest/igraph.Graph.html#write

This is the list of formats supported by Gephi:

https://gephi.org/users/supported-graph-formats/

Choose one that is common to both and use that. I would try GraphML first.


If you insist on CSV-like formats, NCOL comes closest. You can also use the get_edgelist() method to get the list of vertex pairs representing edges, then export them using Python's own facilities.

Szabolcs
  • 24,728
  • 9
  • 85
  • 174