# Visualize Graph Models with Gephi

April 28, 2015 | 20:28

One of the common tasks when we are partitioning graphs is to visualize the graphs. In this blog I will introduce one popular data visualization tool -- Gephi.

Gephi is written in Java and can be run on PC, Mac and Linux platform. The latest release is 0.8.2-beta, which can be downloaded here. The installation step should be easy, but you may run into troubles if you are running JRE1.7 or higher on your machine. Since the current version of Gephi is written in Java 6 and not compatible with higher version of Java, you need to specifically link the library to the old one. On my Mac, I need to open the file located at: /Applications/Gephi.app/Contents/Resources/gephi/etc/gephi.conf, add a line: jdkhome="/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/" to link a 1.6 version of Java. And if you open Gephi before this step, you will also need to delete the /Users/<your name>/Library/Application Support/gephi folder before launching the application again. Gephi will run successfully after changing these settings.

Gephi supports importing mulitple formats of data. I want to recommend the GDF format. Here is a simple sample of GDF format.

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


As you can see, this format is like the CSV format, combines both the nodes information and edges information. Also, you can add more attributes for the nodes and edges. For example, you can add weights for nodes and edges, which can later be rendered in Gephi. And in my case, I need to add a color label to visualize the results of community discovery, so I just wrote my nodes information in this way:

nodedef>name VARCHAR, label VARCHAR, color VARCHAR
V1, Group1, "255,0,0"


the third column is the RGB string of specific color for this node. When import this file into Gephi, colors of every nodes can shown automatically without any extra settings.

## Setting Layouts

Gephi implements various layout algorithms. When choosing a layout, you need to consider which feature of the topology you want to highlight.

### Divisions

If you want to emphasis divisions of the graph, you should use OpenOrd layout.

### Complementarities

If your aim is to emphasis complementatities between nodes, you can choose from ForceAtlas, Yifan Hu and Frushterman-Reingold.

### Ranking

For emphasizing on ranking, you can use Circular or Radial Axis layout.

More details can be found here.

## Other tools

There are also a bunch of other tools for graph visualization.

1. GUESS: GUESS is an exploratory data analysis and visualization tool for graphs and networks.
2. NodeXL: NodeXL is a visualization tool combined with Microsoft Excel, you can easily turn spreadsheets into graphs.
Creative Commons BY-NC-ND 3.0