Gephi supports CSV files that simply represents relationships. The CSV format can be obtained from any row data, databases or Excel export. Each line must contains at least two elements, separated by a separator (coma, semicolon, pipe or whitespace). Values can be encapsulated by single or double quotes. By default graphs imported from CSV are directed graphs, but the user can select undirected in the import report dialog.

Edge List

The CSV example below represents a graph with two edges: “a” -> “b” and “b” -> “c”.

a;b
b;c

Adjacency List

All edges can be written as node pairs. It’s also possible to write all node’s connection on the same line. The example below represents a graph with 3 edges: “a” -> “b”, “b” -> “c” and “b” -> “d”
a;b
b;c;d

Mixed

The following example shows various cases that CSV supports as well. Self-loops and mutual edges are supported. It’s also possible to repeat an edge, “D” -> “E” is repeated twice in this example. As a consequence the edge weight is incremented. “D” -> “E” has a edge weight at two, whereas default value is one.
A,B
B,A
C,C
D,E
A,D
D,B,E
F,G,A,B

Matrix

The sample below shows a graph with 5 nodes. An edge is created when the the cell is ‘1′.
;A;B;C;D;E
A;0;1;0;1;0
B;1;0;0;0;0
C;0;0;1;0;0
D;0;1;0;1;0
E;0;0;0;0;0

Edge weight

Simply replace ‘1′ values by the edge weight value, formatted as a ‘double’.