gephi convert directed undirected graph

Problem: Importing a csv file into Gephi  does not allow to specify whether edges are directed or undirected (by default edges are directed unless a “type” column is specified).  This post provides a workaround for the problem:

“You can simply export->graph file to .gexf format and when you file->open your saved graph, you’ll get the option to change it to undirected.”

Hack: you can also open gexf file and change edges from being directed to undirected by:
<graph defaultedgetype=”directed” mode=”static”>
->
<graph defaultedgetype=”undirected” mode=”static”>

P.S. There are two ways of importing a csv file into Gephi

1) Open File/Open/*.csv file
This option assumes that the file is in the following format (edges) “source”,”target1″,”target2″,”targetn++”

2) File / New Project; then select “Data Laboratory”, “Edges” tab, and then select “Import Spreadsheet”.  This method assume a more standard format “source”, “target”, “weight”.  Note you need to add the appropriate header to the csv file i.e. “Source,Target,Weight”

 

Nodes Labels: somehow during the conversion process nodes’ labels are not set; to fix that you can open gexf file and then in Data Laboratory copy “id” column to “label” and then export graph back to gexf.

Keywords: gephi convert directed undirected graph import csv file

About Neil Rubens

see http://ActiveIntelligence.org

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*