Install Gephi

Go to gephi.org to download the latest version of Gephi (Desktop application).

  • On Windows, after the download completes, run the installer and follow the steps.
  • On Mac OS X, click on the .dmg file and drag the Gephi app to the Applications folder.

Import a dataset

“Welcome”

Open Gephi. A ‘Welcome’ window will appear, prompting you to create a new project.

Welcome modal

Creating a network based on your own data depends on your project, discipline, data source, etc.

  • An Excel or CSV file with two columns “Source” and “Target” (indicating the origin and end of the connection) is sufficient to produce a network in Gephi.
  • If your data table is encoded differently, you can use Table2Net to convert it into a Gephi network.
  • Other data analysis and web analytics software can also be used to produce files compatible with Gephi.

For this tutorial, select the first sample dataset, “Les_Miserables.gexf”, which contains a very simple network of characters from Victor Hugo’s novel.

“Import report”

On opening a network file, the “Import report” window allows you to check that the software has read the network correctly and that there were no errors during import.

  • The import report will tell you how many nodes and edges are present in your network
  • and will allow you to choose whether you want to import the network in a new workspace or append/merge it with an network you have already opened

Click OK.

Import report modal

“Data laboratory”

Now that the GEXF has been imported, a network appears in the centre of the “Overview” tab.

Before working on it, however, click on the “Data Laboratory” tab at the very top of the Gephi interface.

Data laboratory data table

The Data Laboratory allows you to view, and if necessary edit, your data in tabular format.

At the top left of the “Data Table” window, the “Nodes” and “Edges” buttons allow you to navigate between the two tables.

In both of them you can

  • sort the nodes and edges of your network, clicking on the headings of the table
  • filter the table, using the field on the top right
  • operate on the columns, using the button under the table

Click on the “Overview” tab at the very top of the interface, to go back to the main exploration tab of Gephi.

Interacting with the network

“Graph”

The “Graph” window at the center of the “Overview” tab is the heart of Gephi. It displays your networks according to the parameters you set in the other windows.

graph view

“Top left menu” : interaction with the network

Since most networks are too complex for each of their elements to be readable at the same time, the “graph” window allows you to

  • zoom: by using the scrolling gesture you use on your computer on the network
  • pane: by right-clicking and dragging the network

On the left of the “graph” window, buttons allows you to switch between a series of tools to

  • select on or more nodes
  • drag and move node in the same of the network
  • color individual nodes, etc.

“Bottom menu” : rendering

A bit hidden at the bottom of the “graph” window, you find a folding menu that can be unfolded by clicking on the small arrow on the right.

Click on the small arrow on the bottom-right of the “graph” window to unfold the menu.

Once unfolded the menu will allow you to control the rendering of the “graph” window and modify

  • global parameters such as the color of the background
  • the scale of the thickness of the edges
  • and, most importantly to control the visualization of the labels (showing and hiding them, changing their size, and making it proportional to the size of the nodes)

  • Click on the checkbox to display the nodes’ label
  • Set the size to “node size”
  • and use the “size” slider to set the final size of labels.

Changing the objects size and colors

“Appearance”

In the “Appearance” window, you can change the colour and size of nodes and edges based on pre-existing attributes or metrics calculated by Gephi.

  • Click on “Nodes” then on the “Size” icon (the circles of different sizes),
  • Select “Ranking”,
  • Choose the “Degree” attribute
  • Enter minimum and maximum values (e.g. 10 and 50) to resize the nodes
  • Click on “Apply”.

You can also change the colour of the nodes (by clicking on the colour palette icon) or modify the display of the edges. By default in this sample GEXF dataset, nodes are coloured according to their ‘Modularity class’, a category obtained by a community detection calculation.

Playing with the layout

ForceAtlas2

In the ‘Layout’ window, you can modify the spatialisation of the graph by choosing one of the algorithms offered.

  • Select “ForceAtlas 2” — the force-directed algorithm especially developed for Gephi.
  • Click the button “Run” to launch the algorithm and see the nodes repulse each other and the edges binding the nodes that they connects.
  • When the algorithm has reached a stable balance between the two forces and you are satisfied with the result, click “stop” to halt the spatialization process.

You will find that you need to play around with the settings to obtain a readable network:

  • Change the ‘Scaling’ to 100 to give the graph more space
  • Select ‘Prevent Overlap’ so that the nodes do not cover each other.
  • Click “Run” again to launch the algorithm with the new settings.

Graph metrics

“Statistics”

On the right side of the screen, the ‘Statistics’ window allows you to calculate certain properties of the graph. For example, it includes centrality metrics and calculations that provide information about the overall structure of the network, its clusters, and communities.

“Network Diameter”

  • To calculate betweenness centrality, click on “Run” next to “Network Diameter”.
  • This opens a small pop-up window in which you can specify whether the graph is directed or not (in this case, it is not).
  • Click OK to close it and start the calculation.

This generates a small statistical report that provides information on the distribution of the three measurements taken. These values are now recorded in the Nodes table of the ‘Data Laboratory’ in fresh new columns.

You can exit the small report by clicking on ‘Close’.

“Appearance” to apply the new metric to the nodes

You can now return to the ‘Appearance’ window to change the colour of the nodes based on the Betweenness centrality you just calculated.

  • Select “Nodes”, then the “Colour” icon (the colour palette) and the “Ranking” tab to choose ‘Betweenness Centrality’ from the drop-down menu.
  • You can then choose the colour gradient by clicking directly on the coloured bar and change the colours manually or by clicking on the small coloured menu on the right to choose one of the default palettes.

Filtering the graph

“Filters”

The “Filters” window allows you to filter your graph in multiple ways based on attributes or properties of nodes and edges. Filters are organised in folders and sub-folders. Under the folder “Attributes”, for example, you will find all the filters operating on the variables saved in the columns of your Data Laboratory. Under the folder “Topology”, you will find all the filters related to the relational structure of the network.

  • Double-click on “Topology” and then “Degree Rank” to filter nodes based on the number of their connections
  • Move the “Degree Range Settings” left slider at the bottom to 2, click on the “Filter”’ button to hide all the nodes with less than 2 connections

The small ‘Context’ window at the top right indicates that you are no longer viewing the entire network, but only three quarters of the nodes.

“Preview” - create a nice final picture

Once your exploration is complete, you can move on to the careful production of a nice static image.

To do so go to the ‘Preview’ tab.

On the left, in the ‘Preview Settings’ window, you will find a whole range of settings related to graphic rendering. Any changes you make here will not alter the graph itself, but only its final visual appearance.

  • For example, select ‘Show Labels’ to display the names of the characters in Les Misérables, but deselect ‘Proportional size’ so that they are all the same size.
  • Change the ‘Opacity’ of the edges to 60, so that they are easy to follow when they intersect and overlap, and deselect ‘Curved’ to get straight lines.
  • Click ‘Refresh’ to apply these changes.

“Export” - Picture export

To export the image, click on ‘Export: SVG/PDF/PNG’.

An SVG vector file can be easily edited with software such as Inkscape, but if you just need a simple image, a PNG file will suffice.

In this case, in the export pop-up window, you can click on ‘Options’ to increase the size of the image and thus ensure that your image will not be too pixelated.

Saving the Gephi project

But a static image is not the (only) output of your work. Before leaving, don’t forget to save your Gephi project itself.

In the top menu, click on “File” and then ”‘Save” to save your document in .gephi format.

You can then reopen it later with all your changes intact!

If you want to export your graph to be used in other software, you need to export it.

In the top menu, click on “File” and then ”Export” and “Graph file…” to save your network in .gexf, .graphml or other formats.

To go further

This quick tour of the application is only a very partial overview of Gephi’s features. Members of the community have developed more comprehensive tutorials that we recommend:

Here is also a list of tutorials and other useful resources related to Gephi: List

Open Gephi Lite

Import a dataset

“Welcome”

A ‘Welcome’ window will appear, prompting you to create a new project.

Gephi lite Welcome modal

In Gephi Lite you can open

  • Local graph files that are stored on your computer.
  • Graph files stored in your GitHub account.

Creating a network based on your own data depends on your project, discipline, data source, etc.

  • An Excel or CSV file with two columns “Source” and “Target” (indicating the origin and end of the connection) is sufficient to produce a network in Gephi.
  • If your data table is encoded differently, you can use Table2Net to convert it into a Gephi network.
  • Other data analysis and web analytics software can also be used to produce files (Gexf or GraphML) compatible with Gephi Lite.

For this tutorial, select the first sample dataset, “Les_Miserables.gexf”, which contains a very simple network of characters from Victor Hugo’s novel.

“Data laboratory”

Now that the GEXF has been imported, a network appears in the centre of the “Graph” window.

Before working on it, however, click on “Data” at the top of the Gephi Lite interface to open the data table window.

Gephi Lite data table

The “Data” window allows you to view, and if necessary edit, your data in tabular format.

At the top left of this window, the “Nodes” and “Edges” buttons allow you to navigate between the two tables.

In both of them you can

  • sort the nodes and edges of your network, clicking on the headings of the table
  • search nodes and edges using the field on the top right

Using the menu on the left, you can also

  • create new nodes, edges or columns
  • filters the tables
  • calculate metrics

Click on the “Graph” tab at the very top of the interface, to go back to the main exploration window of Gephi Lite.

Interacting with the network

“Graph”

The “Graph” window is the heart of Gephi Lite. It displays your networks according to the parameters you set in the menu on the left.

Les misérables.gexf in the graph view

Since most networks are too complex for each of their elements to be readable at the same time, the “Graph” window allows you to

  • zoom: by using the scrolling gesture you use on your computer on the network
  • pane: by left-clicking and dragging on the background of the graph
  • move nodes around: by left-clicking and dragging them

On the bottom right of the graph, buttons allows you to switch between a series of tools to

  • select nodes individually or through a rectangle or a lasso
  • to zoom in an out and to recenter your network

Changing the objects size and colors

“Appearance”

In the “Appearance” menu on the left side of the graph window, you can change the colour and size of nodes, edges and of their label based on pre-existing attributes or metrics calculated by Gephi.

“Nodes Appearance”

By default in this sample GEXF dataset, nodes are coloured according to their “Modularity class”, a category obtained by a community detection calculation. You can change this choice or the palette of color used to represent it.

  • Click on “Appearance”, then “Nodes”.
  • In the “Set color from…” drop-down menu select “modularity_class”.
  • Check the “Shade nodes colors”.
  • Select “Size” from the drop-down menu.
  • Chose black from the “Target color” color picker.
  • Set the “Shading degree” to 0,7.

Nodes appearance tab open

  • Now unfold the “Size” drop-down menu
  • Choose the “Degree (dynamic)” option to change the size of your nodes proportionally to the number of their connections
  • Enter minimum and maximum values (e.g. 10 and 60) to resize the nodes
  • Notice that a legend for size and color is automatically generated and updated at the bottom of your graph

Nodes appearance tab opened and caption visible on graph

“Labels Appearance”

Under “Appearance”, in the submenu “Labels”, you can change the size and density of the labels of you graph.

  • Unfold the drop-down menu under “Set label sizes from…” and chose “Nodes size”
  • Set the label size to “20”
  • Move the slider under “How many labels should appear any time” to hide the smaller labels

Labels appearance tab opened

Playing with the layout

ForceAtlas2

In the “Layout” menu, you can modify the spatialisation of the graph by choosing one of the algorithms offered.

  • Unfold the “Layout” menu.
  • Select “ForceAtlas 2” — the force-directed algorithm especially developed for Gephi.
  • Click the button “Start” at the bottom of the menu to launch the algorithm and see the nodes repulse each other and the edges binding the nodes that they connects.
  • When the algorithm has reached a stable balance between the two forces and you are satisfied with the result, click “Stop” to halt the spatialization process.

You will find that you need to play around with the settings to obtain a readable network:

  • Check the “Adjust size?” check-box.
  • Change the “Scaling ratio” to 30 to give the graph more space.
  • Click “Start” again to launch the algorithm with the new settings.

Layout Force Atlas 2 panel opened

Graph metrics

“Metrics”

The “Metrics” menu on the left side of the screen allows you to calculate certain properties of the graph. For example, it includes centrality metrics and calculations that provide information about the overall structure of the network, its clusters, and communities.

Betweeness centrality

  • Select “Betweeness centrality” under the “Metric” menu
  • Click on “Compute metric” at the very bottom of the menu.
  • The values for this metric are now recorded in the Nodes table of the “Data” table in a fresh new column labeled “BetweenessCentrality”.

Metrics betweenness centrality panel opened

“Appearance” to apply the new metric to the nodes

You can now return to the “Appearance” window to change the colour of the nodes based on the betweenness centrality you just calculated.

  • Select “Nodes” under “ then the “Appearance”.
  • In the “Set color from…” drop-down menu select “betweennessCentrality”.
  • You can then choose the colour gradient by clicking directly on the coloured bar and change the colours manually.

Appearance nodes panel opened

Filtering the graph

“Filters”

The “Filters” menu allows you to filter your graph in multiple ways based on attributes or properties of nodes or edges, as well as based on the overall topology of the network.

  • Open the filter panel by clicking on “Filters” in menu
  • Click on “Add Filter” button.
  • In the modal section entitled “Nodes attributes” click on “Degree (dynamic)
  • Gephi Lite will automatically generate an histogram of the distribution of the degree in your network
  • Increase the “Min” value to 2, to hide all the nodes with less than 2 connections.
  • The small histogram now shows that you are no longer viewing the entire network.

Filters panel opened with one active filter on nodes' Degree (dynamic)

“Export” the graph file and picture

To export your network file:

  • Open the “Workspace” menu at the top left of Gephi Lite’s interface.
  • Select “Export graph file” to download your network in .gexf format.

workspace menu

To export the network picture:

  • Select “Export image” to download a .png snapshot of your network as you visualized it

export png modal

Saving the Gephi Lite project

Exporting the graph file or a picture is not the (only) output of your work. Before leaving, don’t forget to save your Gephi Lite project itself.

  • Open the “Workspace” menu
  • Click on “Save as…”
  • Choose if you want to download the project on your computer as a .json or save it to your GitHub account.

You can then reopen it later with all your changes intact!

'save as' modal