In this chapter, we will cover the following recipes:
Troubleshooting the Gephi installation
Exploring Gephi's graphical user interface
The basics of working in the Overview mode
The basics of working in the Data Laboratory mode
The basics of working in the Preview mode
Gephi is an interactive graph and network analysis and visualization tool that allows its users to study the properties of graphs and networks in detail, without having to write any code. Gephi supports almost all types of graphical networks including complex networks, hierarchical networks, dynamic networks, and temporal networks. Gephi has a lot of ready-to-use features that allow users to create stunning and informative visualizations. Graph analysis is one of the preliminary steps in the process of studying graphical systems and Gephi aids in that process by freeing the user from requiring knowledge of programming.
Gephi was developed in Java and, hence, is a cross-platform application, which means it can work on Windows, Linux, and Mac OS X. This chapter will take you through the step-by-step process involved in installing Gephi on different platforms. We will also discuss troubleshooting that might be required during the installation process.
Gephi, being a network analysis and visualization tool, requires a compatible graphics card to be installed on your system. It uses a built-in OpenGL engine for fast processing when dealing with very large networks. Hence, it requires OpenGL 1.2 installed on your system. Gephi also requires Java 6 or later. Make sure you have these two programs installed on your system before you go ahead with the installation process.
Download the Gephi installer from the official website: https://gephi.github.io.
Run the installer and hit Next:
Accept the license agreement and hit Next:
The installation will begin and once it's over, the following screen is displayed. Hit Finish to complete the setup:
From Gephi's official website (https://gephi.github.io), download the TAR installer file.
Once the download has finished, untar the file and run Gephi by executing
Ubuntu users can make use of the daily build, available from Launchpad. First, run
sudo apt-add-repository ppa:rockclimb/gephi-dailyto your software sources.
sudo apt-get update, followed by
sudo apt-get install gephi, in order to install Gephi on your box.
From Gephi's official website (https://gephi.github.io), download the installer.
Once the download has finished, double-click on the
DMGfile to run the installer.
Once the installation has finished, a new window will open. Double-click on the Gephi icon to run the application.
As mentioned earlier, Gephi is a cross-platform tool and works on many more platforms than the ones described in this recipe. If the graphs on which you are going to work are very large, then a 64-bit version of Gephi will have to be installed if you are also using a 64-bit machine.
One might face some issues while installing Gephi, most of which are related to memory management in Java. To learn about fixing some of the most common ones, refer to the next recipe, Troubleshooting the Gephi installation.
https://gephi.github.io/users/install/ for documentation on installing Gephi on other platforms
While installing Gephi, there are a couple of problems that users encounter quite frequently, most of which are related to memory-specific requirements. Some of these issues are discussed in this recipe, along with the fixes that one can employ to resolve them.
If you encounter any memory- or JVM-related issues, try following these steps to check if the issue can be resolved:
If you are using Java 8, try downgrading to Java 7 and check whether the problem is resolved.
If you are using the latest version of Gephi, uninstall it and install an older version. If these two fixes do not resolve the problem, then you might need to do operating system-specific fixes, as listed in the following points:
For Windows systems, go to the Gephi folder in
C:\and then go to the
etcfolder. Open the
gephi.conffile in Notepad. In the default options, change the
-J-Xmx1024m. This changes the maximum heap size allocated to Java to 1,024 MB. If you are using a 64-bit machine, the
gephi.conffile will be located in the Gephi folder in
For Linux systems, go to the
etcfolder in the Gephi application directory and open the
gephi.conffile. Change the
-J-Xmx1024mto change the maximum heap size allocated to Java to 1,024 MB.
For Mac OS X systems, go to Show Package Contents by right-clicking on the Gephi icon in the
Applicationsfolder. Inside the
Contentsfolder, go to the
Resources/Gephi/etcfolder. Open the
gephi.conffile and, in the default options, change the
-J-Xmx1024m. This changes the maximum heap size allocated to Java to 1,024 MB.
Java Virtual Machine (JVM) is an abstract computing machine, otherwise known as a virtual machine. A virtual machine emulates a part of the computing system. JVM executes a Java program compiled into Java bytecode. Since Gephi runs on JVM, its functioning depends on the memory allocated in the system for Java. If very little memory has been allocated to Java, it won't have enough resources to load all the data and, hence, the application won't start. On the other hand, if too much memory has been allocated to Java, then the system won't let Java start and will throw the "JVM Creation failed" message.
http://docs.oracle.com/cd/E13150_01/jrockit_jvm/jrockit/geninfo/diagnos/garbage_collect.html to understand more about memory management in Java
This recipe describes some of the main GUI components of Gephi and gives the user an overview of what can be achieved. For this, you need to make sure that you have Gephi installed on your system.
To explore Gephi's GUI, perform the following steps:
If it is your first time with Gephi, click on Les Miserables.gexf to load an existing network that was designed using the property of concurrence between the characters from the famous novel Les Misérables by Victor Hugo.
You will notice a prompt titled Import report asking you to set the properties for the graph. Just leave the pre-specified selections as they are and hit OK to load the graph.
To reposition the graph on the screen, place the mouse pointer somewhere on the Graph panel situated in the center of the screen and, while holding the right mouse button, move around to the location you want the graph to be centered at.
There are two ways in which the graph can be zoomed-in and zoomed-out:
Rotate the mouse wheel upwards to zoom-in and downwards to zoom-out with the mouse pointer located somewhere in the graph window.
Click on the upward-pointing arrow on the right-bottom corner of the graph window to expand the Settings panel. Click on the Global tab and use the zoom slider to zoom-in and zoom-out on the graph.
Gephi has a pretty simple and user-friendly GUI. The upper-left corner on the screen has three tabs namely Overview, Data Laboratory, and Preview, which represent the three modes present in Gephi for network manipulation. You can customize which panels appear in the application by selecting/deselecting specific panels from the Window option in the menu bar.
Run Gephi and load a preexisting network. The first screen that you see is the Overview mode, which is otherwise called the Graph Manipulation mode in Gephi. If you already have Gephi running, clicking on the Overview tab in the upper-left corner of the screen will take you to this mode.
When in Overview mode, you'll able to perform a wide variety of manipulations on the graphs. These are categorized under the following subsections in the Overview mode, each located in a different part of the Overview screen:
Partition: This module lets you partition the graph into smaller components based on various node- and edge-specific properties, which are called partitioning parameters. One such example of partitioning parameters provided by Gephi is Modularity Class. The following screenshot shows the graph obtained after partitioning the Les Misérables graph on the basis of Modularity Class and then recoloring it:
Ranking: This module lets you rank the nodes of the graph based on various criteria such as degree, modularity class, edge weight, and so on. The following screenshot shows the Les Misérables network after its nodes have been ranked, according to their degrees:
Layout: In this module, one can obtain different visualizations of the same graph by using numerous graph layout algorithms that are provided in Gephi. Some of the most popularly used graph layout algorithms used in Gephi are Force Atlas, Fruchterman Reingold, and Yifan Hu. One such example is shown in the following screenshot, in which the Fruchterman Reingold layout algorithm has been applied to the Les Misérables graph:
Graph: In this panel, you'll find a list of basic tools that you can use to perform basic manipulations on the graph such as resizing individual nodes, coloring components of the graph, coloring individual nodes, and modifying node labels. If you do not see this panel on your screen, click on Window in the menu bar and select Graph from there.
Statistics: In this panel, one can run various statistical metrics on the graph to get a deeper insight into the network structure and network properties. In order to get any of the metrics for the graph, simply hit Run for a specific metric. This will generate an HTML report, which depicts that metric for the graph. One such report for degree distribution of the Les Misérables graph is shown in the following screenshot:
Filter: This part of the Overview screen contains various filtering parameters that are based on which of the nodes and edges of the graph could be filtered. One can combine multiple filtering parameters by using the logical operators present in the panel. The following screenshot shows the result of applying the k-core topology filter on the Les Misérables graph with the k value being 5:
Chapter 3, Using Graph Layout Algorithms, to understand more about various graph layout algorithms present in Gephi.
Chapter 4, Working with Partition and Ranking Algorithms, to understand different ranking and partitioning approaches for graphs.
Chapter 5, Running Metrics, Filters, and Timelines, to know more about statistical metrics and filters for graphs. This chapter also explains concepts related to timeline controls for dynamic graphs.
http://en.wikipedia.org/wiki/Degeneracy_(graph_theory)#k-Cores to understand more about k-core topology in graphs
To understand the basics of the Data Laboratory mode in Gephi, follow these steps:
Click on the Data Laboratory tab, which is placed next to the Overview tab in the upper-left corner of the screen. You will see that all the information about the network can now be seen as a data table, as shown in the following screenshot, with columns or attributes such as nodes, node ID, and node label:
Click on the Edges button, which is located right below the Overview tab in the upper-left corner of the view, to switch to viewing edge-specific details of the network. This is depicted in the following screenshot:
In this mode, you can carry out tasks such as adding new columns, deleting columns, merging columns, and importing and exporting spreadsheets. Note that the columns here refer to the attributes of the edges.
Chapter 6, Working in the Data Laboratory Mode, to learn more about the functionalities offered in the Data Laboratory mode in Gephi
This recipe introduces the fundamentals of the Preview mode in Gephi. This mode lets you alter the way the final network will look. One can then export a snapshot of it into a required format such as a PDF or a PNG image file.
The following steps take you through the Preview mode in Gephi:
Click on the Preview tab that is located in the upper-left side of the screen.
You'll see the Default preset automatically selected. You can change the various properties of the graph in the panel according to how you would like to visualize the graph.
Once you have entered the required properties, hit Refresh. This will generate the network in the default visualization; it could then be exported to the required file format by using the Export button present in the lower-left corner of the screen.
Chapter 7, Getting Graphs and Networks Ready for Preview, to know more about the Preview mode in Gephi