GDF is the file format used by GUESS. It is built like a database table or a coma separated file (CSV). It supports attributes to both nodes and edges. A standard file is divided in two sections, one for nodes and one for edges. Each section has a header line, which basically is the column title. Each element (i.e. node or edge) is on a line and values are separated by coma. The GDF format is therefore very easy to read and can be easily converted from CSV.

The following link shows the official manual, where information is available about attributes types and logic.

GDF Specification Official GDF Specification (GUESS)

Examples

Basic example

The GDF below is the minimum you need to be supported by Gephi’s current file Importer. The label column is optional.

nodedef>name VARCHAR,label VARCHAR
s1,Site number 1
s2,Site number 2
s3,Site number 3
edgedef>node1 VARCHAR,node2 VARCHAR
s1,s2
s2,s3
s3,s2
s3,s1

With edge weight

Edge weight is basically edge thickness and is defined as follow.

nodedef>name VARCHAR,label VARCHAR
s1,Site number 1
s2,Site number 2
s3,Site number 3
edgedef>node1 VARCHAR,node2 VARCHAR, weight DOUBLE
s1,s2,1.2341
s2,s3,0.453
s3,s2, 2.34
s3,s1, 0.871

Various attributes

Add as many attributes as you need. Add attributes title in the header line and respect order, as you would do for CSV. On the below example, all attributes are design attributes expect “class” that I added. Attributes are central in Gephi, because they can be used by Filter Module.

nodedef>name VARCHAR,label VARCHAR,class VARCHAR, visible BOOLEAN,labelvisible BOOLEAN,width DOUBLE,height DOUBLE,x DOUBLE,y DOUBLE,color VARCHAR
s1,SiteA,blog,true,true,10.0,10.0,-52.11296,-25.921143,'114,116,177'
s2,SiteB,forum,true,true,10.986123,10.986123,-20.114172,25.740356,'219,116,251'
s3,SiteC,webpage,true,true,10.986123,10.986123,8.598924,-26.867584,'192,208,223'
edgedef>node1 VARCHAR,node2 VARCHAR,directed BOOLEAN,color VARCHAR
s1,s2,true,'114,116,177'
s2,s3,true,'219,116,251'
s3,s2,true,'192,208,223'
s3,s1,true,'192,208,223'

Working with texts

Problems often comes when coma, apostrophe (i.e. single-quote) or double-quote are used in texts. The example below shows how to manage these strings, wrap single-quotes around it.

nodedef>name VARCHAR,label VARCHAR,class VARCHAR, visible BOOLEAN,labelvisible BOOLEAN,width DOUBLE,height DOUBLE,x DOUBLE,y DOUBLE,color VARCHAR
s1,'Hello "world" !',type1,true,true,10.0,10.0,-52.11296,-25.921143,'114,116,177'
s2,'Well, this is',type1,true,true,10.986123,10.986123,-20.114172,25.740356,'219,116,251'
s3,'A correct 'GDF' file',type1,true,true,10.986123,10.986123,8.598924,-26.867584,'192,208,223'
edgedef>node1 VARCHAR,node2 VARCHAR,directed BOOLEAN,color VARCHAR
s1,s2,true,'114,116,177'
s2,s3,true,'219,116,251'
s3,s2,true,'192,208,223'
s3,s1,true,'192,208,223'

Implementation details

Missing values

When values are missing, don’t omit to put the coma.

nodedef>name VARCHAR, label VARCHAR, att1 VARCHAR, att2 VARCHAR, att3 VARCHAR,att4 BOOLEAN
s1,SiteA,blabla,blabla,blabla,true
s2,SiteB, , , ,false
s3,SiteC,blabla, , ,true

Colors

Color is a VARCHAR attribute with 3 values for red, blue and green. Values should be from 0 to 255.
Example: ‘114,116,177′

Position & size

Position is set with X and Y values, plus an optional Z value. They must be DOUBLE columns. Size of nodes is set with the width DOUBLE attribute.

Common problems

* I don’t see my special characters. Square are drawn instead.
For characters different from ASCII, encode your file in UTF-8 (with BOM). One can use Notepad++ for doing this.

* ArrayIndexOutOfBoundsException: 1
Be sure you mentioned a label in each node line.