Home Cloud & Networking Gephi Cookbook

Gephi Cookbook

By Devangana Khokar , Devangana
books-svg-icon Book
eBook $39.99 $27.98
Print $48.99
Subscription $15.99 $10 p/m for three months
$10 p/m for first 3 months. $15.99 p/m after that. Cancel Anytime!
What do you get with a Packt Subscription?
This book & 7000+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with a Packt Subscription?
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with eBook + Subscription?
Download this book in EPUB and PDF formats, plus a monthly download credit
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with a Packt Subscription?
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with eBook?
Download this book in EPUB and PDF formats
Access this title in our online reader
DRM FREE - Read whenever, wherever and however you want
Online reader with customised display settings for better reading experience
What do you get with video?
Download this video in MP4 format
Access this title in our online reader
DRM FREE - Watch whenever, wherever and however you want
Online reader with customised display settings for better learning experience
What do you get with video?
Stream this video
Access this title in our online reader
DRM FREE - Watch whenever, wherever and however you want
Online reader with customised display settings for better learning experience
What do you get with Audiobook?
Download a zip folder consisting of audio files (in MP3 Format) along with supplementary PDF
What do you get with Exam Trainer?
Flashcards, Mock exams, Exam Tips, Practice Questions
Access these resources with our interactive certification platform
Mobile compatible-Practice whenever, wherever, however you want
BUY NOW $10 p/m for first 3 months. $15.99 p/m after that. Cancel Anytime!
eBook $39.99 $27.98
Print $48.99
Subscription $15.99 $10 p/m for three months
What do you get with a Packt Subscription?
This book & 7000+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with a Packt Subscription?
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with eBook + Subscription?
Download this book in EPUB and PDF formats, plus a monthly download credit
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with a Packt Subscription?
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with eBook?
Download this book in EPUB and PDF formats
Access this title in our online reader
DRM FREE - Read whenever, wherever and however you want
Online reader with customised display settings for better reading experience
What do you get with video?
Download this video in MP4 format
Access this title in our online reader
DRM FREE - Watch whenever, wherever and however you want
Online reader with customised display settings for better learning experience
What do you get with video?
Stream this video
Access this title in our online reader
DRM FREE - Watch whenever, wherever and however you want
Online reader with customised display settings for better learning experience
What do you get with Audiobook?
Download a zip folder consisting of audio files (in MP3 Format) along with supplementary PDF
What do you get with Exam Trainer?
Flashcards, Mock exams, Exam Tips, Practice Questions
Access these resources with our interactive certification platform
Mobile compatible-Practice whenever, wherever, however you want
  1. Free Chapter
    Getting Started with Gephi
About this book
Publication date:
May 2015
Publisher
Packt
Pages
296
ISBN
9781783987405

 

Chapter 1. Getting Started with Gephi

In this chapter, we will cover the following recipes:

  • Installing Gephi

  • 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

 

Introduction


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.

This chapter also gives you an overview of Gephi's graphical user interface (GUI) and a basic understanding of various modes available in it.

 

Installing Gephi


This recipe discusses the minimum system configurations required in order to install Gephi and the installation process for different platforms.

Getting ready

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.

How to do it…

Follow these steps to install Gephi on Windows:

  1. Download the Gephi installer from the official website: https://gephi.github.io.

  2. Run the installer and hit Next:

  3. Accept the license agreement and hit Next:

  4. Keep clicking on the Next button until you reach the following screen. Click on Install:

  5. The installation will begin and once it's over, the following screen is displayed. Hit Finish to complete the setup:

To install Gephi on a Linux machine, follow these steps:

  1. From Gephi's official website (https://gephi.github.io), download the TAR installer file.

  2. Once the download has finished, untar the file and run Gephi by executing ./bin/gephi.

  3. Ubuntu users can make use of the daily build, available from Launchpad. First, run sudo apt-add-repository ppa:rockclimb/gephi-daily to your software sources.

  4. Then, run sudo apt-get update, followed by sudo apt-get install gephi, in order to install Gephi on your box.

The installation process for Mac OS X is pretty simple and straightforward:

  1. From Gephi's official website (https://gephi.github.io), download the installer.

  2. Once the download has finished, double-click on the DMG file to run the installer.

  3. Once the installation has finished, a new window will open. Double-click on the Gephi icon to run the application.

There's more…

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.

See also

 

Troubleshooting the Gephi installation


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.

How to do it…

If you encounter any memory- or JVM-related issues, try following these steps to check if the issue can be resolved:

  1. If you are using Java 8, try downgrading to Java 7 and check whether the problem is resolved.

  2. 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 Program Files in C:\ and then go to the etc folder. Open the gephi.conf file in Notepad. In the default options, change the -J-Xmx512m value to -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.conf file will be located in the Gephi folder in C:\Program Files(x86).

    • For Linux systems, go to the etc folder in the Gephi application directory and open the gephi.conf file. Change the -J-Xmx512m value to -J-Xmx1024m to 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 Applications folder. Inside the Contents folder, go to the Resources/Gephi/etc folder. Open the gephi.conf file and, in the default options, change the -J-Xmx512m value to -J-Xmx1024m. This changes the maximum heap size allocated to Java to 1,024 MB.

Tip

Unable to save the modified gephi.conf file? Open your text editor in administrator mode, navigate to the folder where the file is located, open the file, and then make the changes. Finally, hit Save to save the changes.

How it works…

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.

 

Exploring Gephi's graphical user interface


Gephi offers a very user-friendly GUI to users, making it very easy for novices to explore and manipulate networks with just a few clicks of the mouse.

Getting ready

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.

How to do it…

To explore Gephi's GUI, perform the following steps:

  1. Run Gephi on your system. You'll be welcomed with a small screen, as shown in the following screenshot, that asks you to choose between loading a preexisting sample and creating a new project:

  2. 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.

  3. 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.

    The following screenshot shows the first screen you will see once the graph has been loaded:

  4. 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.

How it works…

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.

 

The basics of working in the Overview mode


This recipe will take you through the basics of various functionalities available in Gephi's Overview mode.

Getting ready

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.

How to do it…

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.

  • Context: This part of the Overview screen gives information about the basic properties of the graph such as the number of edges, the number of nodes, and the type of graph.

  • 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:

See also

  • 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

 

The basics of working in the Data Laboratory mode


This recipe introduces the Data Laboratory mode in Gephi, which allows users to manipulate network information represented in a tabular format.

Getting ready

Run Gephi and load the Les Misérables network.

How to do it…

To understand the basics of the Data Laboratory mode in Gephi, follow these steps:

  1. 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:

  2. 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:

  3. 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.

See also

  • Chapter 6, Working in the Data Laboratory Mode, to learn more about the functionalities offered in the Data Laboratory mode in Gephi

 

The basics of working in the Preview mode


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.

Getting ready

Run Gephi and load the Les Misérables network.

How to do it…

The following steps take you through the Preview mode in Gephi:

  1. Click on the Preview tab that is located in the upper-left side of the screen.

  2. 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.

  3. 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.

The following screenshot shows the Les Misérables network when visualized in the Default preview mode:

See also

  • Chapter 7, Getting Graphs and Networks Ready for Preview, to know more about the Preview mode in Gephi

About the Authors
  • Devangana Khokar

    https://www.linkedin.com/profile/view?id=76656911&authType=OUT_OF_NETWORK&authToken=MaIr&locale=en_US&trk=tyah2&trkInfo=tarId%3A1407844086064%2Ctas%3Adeva%2Cidx%3A1-1-1

    Browse publications by this author
  • Devangana

    Devangana Khokhar is a consultant at ThoughtWorks Inc., working on a range of exciting projects, primarily in the data science and analytics domain and is currently based out of Bengaluru. She has more than 4 years of experience in data analytics, social networks analysis, machine learning, and information retrieval. She is also the director of Women Who Code's Bangalore chapter, a nonprofit organization focused on bringing more women into the field of technology. She holds a master's degree in theoretical computer science and has specialized in social network analysis from PSG College of Technology, Coimbatore. During her postgraduate study, she was intrigued by social networks and machine learning, and she has been in love with data science and analytics since then. Devangana has also been one of the reviewers for R Graphs Cookbook Second Edition, Jaynal Abedin and Hrishi V. Mittal, Packt Publishing. She is passionate about spreading the message of educational equality and is an advocate of women's right to education and equal stature in the tech industry. She also takes an interest in cooking and reading books, mostly in the realm of nonfiction. She is a Twitter addict and very often shares resources that she finds interesting or useful in her pursuit of getting better at data science. She tweets at http://www.twitter.com/DevanganaK. You can also get in touch with her on LinkedIn at in.linkedin.com/in/devangana.

    Browse publications by this author
Latest Reviews (2 reviews total)
Really useful and helpful
Makes a lot of things clear that are obscure in the on-line documentation.
Gephi Cookbook
Unlock this book and the full library FREE for 7 days
Start now