About this book

Gephi is an interactive visualization and exploration platform for all kinds of networks and complex systems. Social media data has helped to drive network visualization to new levels of relevance and importance. However, there is far more to network visualization than just social media data. For analyzing and visualizing network graphs, you need to have an excellent platform, and you need to know ways to use your data effectively.

Network Graph Analysis and Visualization with Gephi is a practical, hands-on guide that provides you with all the tools you need to begin creating your own network graphs. You will learn how to import data, test multiple graph layouts, and publish your visualizations to the Web.

Network Graph Analysis and Visualization with Gephi will teach you how to create your own network graphs using Gephi. The book begins by taking you through the installation of Gephi and configuring the installation options. You will also get acquainted with the Gephi workspace and the various tools in Gephi. Next, you’ll use these tools to create your own graphs. If you need to add more capability to your personal toolkit, you will be learning to Download and install several of the best Gephi layout plugins. You will then use these layouts simultaneously to produce beautiful graphs. Also, you create and import data in Gephi and add some new plugins that extend Gephi even further. You also gain the skills to prepare and customize your network visualization for export.

By the end of this book, you will be able to create your own network graphs using Gephi, customize the look and feel of your graphs, and successfully publish them to the Web.

Publication date:
September 2013
Publisher
Packt
Pages
116
ISBN
9781783280131

 

Chapter 1. Installing Gephi

Network visualization has become an increasingly important approach for how we view data in our increasingly connected world. Social networks, information networks, transportation networks, and a host of other datasets can be brought to life through network maps. However, this approach was traditionally left to those with an understanding of the complex mathematical underpinnings of graph theory, or at least to those who were exceptional coders who could create their own graph structures. In recent years, the explosion of social media datasets has propelled network graphs into the visualization mainstream, resulting in a number of proprietary and open source tools that address the need to create and view networks. One of the leading tools of this genre is Gephi.

The goal of Gephi is to make network visualization accessible to all by providing a set of tools that handle the complex mathematics supporting the graphs. Therefore, users of Gephi are able to focus on the meaning of the underlying data, and may quickly test alternative visual approaches that best display the network connections the user wishes to share with his/her audience. Gephi is a great tool for those wanting to display insights through their graphs quickly, while simultaneously providing the ability to further explore the world of graph theory.

In this chapter, I will provide you with instructions on how to quickly get up and running with Gephi. You will learn how to:

  • Go to the Gephi website

  • Ensure you have the necessary software and hardware to run Gephi

  • Download the current version of the software

  • Run the installation process on your laptop or desktop

  • Start the software and verify that it is functioning correctly

  • Locate and understand the functionality for each of the toolbar icons

By the end of the chapter, you will have a working version of Gephi and will be ready to learn more about how to utilize this exceptional tool to create your own network visualizations.

 

Downloading the software


We are now going to walk through the download steps for Gephi using a few simple steps:

  1. Navigate to the Gephi site at http://gephi.org. Take a moment while you visit the site to acquaint yourself with some of the available resources, including quick tips on how the software can be used to create a wide variety of network maps and diagrams.

    The download option will provide information about the current version. We will be working from the 0.8.2-beta version for each of the examples in this book.

  2. On the landing page, beneath the download button is a link for system requirements. Click on it to make certain you have the necessary resources to run the Gephi platform successfully. After clicking, you should see something like this:

    As you will note on this page, the practical requirements for running Gephi are highly related to the complexity of the datasets that will form your network maps. This is due in part to the graphic-intensive nature of the program; simple diagrams will be computed without difficulty on a machine with just 128 MB of RAM. However, if you are looking to create and analyze complex networks with hundreds of thousands of nodes and edges, it would be wise to use a machine with at least 2 GB of memory.

    Note

    Note that the examples used in this book will not require significant memory or CPU outlays. So, as long as your machine is capable of handling a few thousand nodes and edges, there should be no issues in executing any of the cases presented here.

    Once you have verified the minimal requirements needed to run the software, it's time to begin the download process.

  3. Click the download button, and you will be transported to the download page, with multiple download options, depending on your operating system. Any language and localization preferences you may have can be set after the download. Gephi offers English, French, Spanish, Japanese, Brazilian Portuguese, Russian, Chinese, and Czech localization using the Languages option under the Tools menu. All of the examples used in this book are based on the Windows version using the English language setting.

  4. Once the appropriate software version has been downloaded, locate it on your machine to begin the installation process. Gephi is packaged using an executable setup file, so you should find a filename akin to gephi-0.8.2-beta.setup.exe, depending on the version selected for download.

Installing the software

Now that the software has been successfully downloaded, let's walk through a few simple steps to complete the installation:

  1. Click on the downloaded file to start the installation process. Depending on your machine settings, you may encounter a pop-up message asking if you wish to continue with the installation. Simply select the Run option to proceed with the setup.

  2. After navigating through any system messages, the Gephi installation process will initiate, starting with a Setup Wizard window. Click on the Next button to continue.

  3. The setup program will then prompt you for the installation location, defaulting to C:\Program Files (x86)\Gephi-0.8.2. Click on the Next button that takes you to a Start menu's folder option. The default setting here is set to Gephi (if that's acceptable to you), and then select Next; otherwise, provide an alternative name, such as Awesome Network Viz Tool, and click on Next to proceed.

  4. Next, in a seemingly endless series of options, (don't worry, they're almost done!), is a window where Gephi allows you to set a few file defaults. This is valuable if you are importing data from other network visualization tools, such as Cytoscape or Graphviz.

  5. Choose your settings, and the installation wizard provides one last settings confirmation window before starting the install. If you are comfortable with the choices you just made, click on Install. Otherwise, select the Back button to adjust the settings before completing the installation.

  6. Finally, we're ready for the big event! Click on Install, and we're off to the races. The process will typically take less than two minutes, depending on the speed of your local machine. When the installation is successful, Gephi will show the following window:

Now that the install has completed, you'll note that Gephi has given us the option to launch the program immediately. At this point, you probably would like to dig into everything Gephi can do as quickly as possible. So, let's go, keeping the Launch Gephi option checked, and select Finish.

Before moving on to a discussion of Gephi tools and capabilities, let's step back for a moment and make sure we understand the component parts of a network graph. This knowledge is essential to a basic understanding of creating and interpreting network graphs.

Quite simply, graphs are composed of nodes and edges. Nodes are a set of objects representing entities in a dataset. You may think of cities, universities, students, and so on as typical nodes. Edges are the connections between nodes, and provide visual cues as to the degree of connectedness of the graph. Not all nodes are connected to one another; those that are directly connected are referred to as neighbors . Note that a single node may have many edges, depending on the number of neighbors associated with a given node.

Finally, edges in Gephi may be directed or undirected. In most cases, graphs are undirected, meaning there is a symmetrical connection between nodes. A directed graph expresses asymmetric relationships, where there is a specific order between points, typically represented by an arrow pointing from a source node to a target node.

In Gephi, nodes and edges are both represented by specific identifiers, such as ID and Label, and may contain other more descriptive information, such as weight, subgroup, and color.

The Gephi interface

After completing the installation and launching Gephi, the first screen you see should resemble this:

You will see a Welcome window on top of the general user interface. Note that you can elect to not view the Welcome window on subsequent visits by deselecting the checkbox at the lower-left corner of the window. The window provides a few quick startup options, including a handful of sample visualizations provided as part of the installation package.

For now, I'm going to ask you to close this window so we can begin to examine the different components within the base Gephi install. For those of you familiar with the NetBeans IDE, the Gephi layout will be easy to grasp, because it is based on the NetBeans environment. Even if you aren't familiar with NetBeans or Eclipse, you will soon find the user interface to be quite intuitive, and will be navigating between panels and menus flawlessly. Menus and formatting options are laid out around the perimeter of the Gephi workspace, with the main area designed for viewing your data and graphs. This approach keeps almost everything in front of you at all times, and will help you to become familiar with the Gephi layout quickly.

Let's begin our tour by examining the default layout structure. As you become more familiar with Gephi and how you work with it, there will be opportunities to customize the layout. For now, let's stick with the defaults, starting with the main canvas area in the center of the window.

  1. If you've already taken the opportunity to scan the Gephi workspace, most likely you have noticed that all of the options are grayed out. To rectify that, we'll need to open a file.

  2. To get started, you'll want to download some of the sample files from the Gephi site and keep them in an easy to find location. For this example, we'll work with the Jazz musicians' network, a collection of jazz figures and their relationships to one another.

    Go to the Gephi wiki at https://wiki.gephi.org/index.php/Datasets and navigate to the dataset, which can be found under the Social Networks heading. Alternatively, you can go straight to the following address at https://gephi.org/datasets/jazz.net.zip. Note that this file is a .zip file, so you'll need to extract it before we can load it into Gephi.

Now, select Open from the File menu, and then navigate to the file you just downloaded. I've chosen this example for two reasons: first, it will allow us to tour the basic features in Gephi, and second, you will get a glimpse of a relatively simple network before we move on to a greater degree of complexity later in the book.

Once the file has loaded, you should see a diagram like this:

Actually, it looks quite complex at first glance, with a couple hundred nodes (the circles in the diagram) and the thousands of edges (lines) connecting the related nodes. Fear not, you'll soon find this level of complexity easy to navigate. For now, let's leave the map aside and focus on the many tools Gephi offers to help us make sense out of this or any other network map. The next few sections will provide brief overviews of the functionality provided within Gephi. In later chapters, some of these options will be explored in greater detail.

Toolbar 1 – selectors, pencils, and brushes

We'll start our tour with the group of icons on the upper-left margin of the display area, and walk through each of these one at a time.

At the top we have the direct selection arrow, the default, meaning you can click on any node or edge within a diagram. This is followed by a rectangle selection tool, which allows you to draw a rectangle of any size over portions of the diagram, highlighting items in the selected area as you go.

The drag tool, represented by a hand shape, permits you to get a closer look at selected nodes by dragging them to a new location on the canvas. This can be very useful in cases where we have a densely populated canvas area.

If you still need a way to highlight specific elements in your diagram, the next two icons on the toolbar are highly useful, starting with the painter tool that enables us to recolor selected nodes with a simple mouse click. To really focus on a specific node, you can take advantage of the sizer tool, allowing us to increase or decrease the node size simply by moving our mouse up or down.

The brush tool provides another great way to understand the underlying relationships in our visualization. Selecting this tool, we can click on any node and see all the nodes in the diagram that have a direct relationship to our selection. As we'll see in a bit, we can do this in any color we choose, thus making it much easier to see patterns, especially when compared to our original example.

The next two options on the toolbar allow us to draw new nodes with the node pencil, or to add new edges through the edge pencil. Each of these is executed by using simple mouse clicks. In many cases, there will be no need to add nodes or edges in this fashion, but it is nice to have that capability for those occasions where it is needed.

Next, you will see an airplane icon, representing the shortest path function, a great tool for seeing how many connections it takes to navigate between two selected nodes. Simply highlight this icon, then click on two distinct nodes, and watch Gephi display the most direct connection between the two points. In some cases, Gephi will inform us that there are no available connections between the points.

Another useful option comes by way of the heatmap tool, depicted as a gear-shaped icon on the toolbar. This function enables you to see the proximity of related nodes using either a gradient or color palette approach. This provides an effective way to see relationships across the network for a selected node.

Finally, we have the edit icon, represented by a selection arrow with an adjacent question mark. Selecting this option allows us to view several attributes for our selection, including color, size, x, y, and z positioning, plus ID and label information. Any of these attributes may be edited here, with the exception of the ID field, which remains fixed.

Toolbar 2 – graph and node functions

There are a few additional icons on the same toolbar at the lower-left corner of the work area. We'll take a quick look at these functions and how they can be used:

  • Locate the icon that looks like a magnifying glass. This is the center on graph function, which does exactly what the name specifies. It places our graph back in the center of the workspace. Nothing fancy here, but it can be a very useful function.

  • Beneath this is the reset colors icon. Tired of the basic default gray color for the graph? Simply right-click on this icon, select a color from the wheel, and then left-click to reset the graph to your new color. Play around with this until you get a color that suits your fancy, or perhaps matches your decorating scheme.

  • Next is the size function that allows you to choose the node size for the entire graph. As with the reset colors command, just right-click, enter a size, and then left-click to reset the graph.

  • The next three icons all relate to labeling the diagram, starting first with the reset label color , followed by reset label visible , and finally reset label size. Resetting the label color returns labels to black, while resetting the labels to visible does just that. Finally, resetting the label size returns all labels to the default size setting. These functions will be explored further on as we proceed with our examples in upcoming chapters.

Toolbar 3 – customizing nodes and edges

We have one last set of icons to understand before moving on to bigger and better things.

The background color option appears as a light bulb. This feature provides a simple toggle between a white background versus a black one. Use your discretion to determine which one looks better—although a dark background may provide a more dynamic appearance, the white one is often a better option for printing purposes.

The take screenshot tool, shown as a camera icon, allows us to copy the current view to another application without having to go through the process of saving the network as an image.

The show node labels icon will give you the option of displaying or removing labels for each node in the network.

We next encounter three functions related to how edges are displayed. First, we have the show edges icon that works exactly as expected. Select this option, and all edges will disappear, making it easier to see the distribution of nodes. Click on it again, and the edges reappear. The second icon in this grouping is used to set edges to source node color; toggle this to match the node color or to return to the default edge color. Our third and final function in this trio is to show edge labels, used in the same fashion as the show node labels option.

Finally, we come to the final group of options, all related to formatting our network display. The edge weight scale is a slider bar; drag it to the left for thinner lines, to the right to increase the weight of the edges. The next two options are each represented by an upper case "A", one with black text and the second in blue. The initial icon is the size mode function, which lets us set labeling options as fixed, scaled, or based on the node size. We'll see how this works when we dive into creating our own graphics. The color mode can be set at either an object or unique level for the purpose of highlight graph features. The font option in this group lets us set the base font and its size. The font size scale function is a slider bar where we can adjust the size relative to the base settings. Slide to the right for a larger font size, and to the left for a smaller one. Please note that either the node or edge labels will need to be turned on to see any impact from this function.

Just two more options before we move on, and put some of this functionality to use based on our own clever visualizations. First is the default color icon, shown as a colored square, based on the current default color setting. Selecting and holding this icon opens a color spectrum window where you can create the color of your dreams, and set it as the default. The attributes settings option allows us to set the default labeling options for both, nodes and edges, using IDs, labels, or both.

Still with me? I hope you're beginning to grasp the capabilities of Gephi, even as we took a very high-level tour of the basic functionality. As we continue our journey, we'll unleash more of this power and begin to tap into the full potential of this great tool.

 

Summary


In this chapter, you learned how to download Gephi to your local desktop or laptop, and how to initiate the installation process. You also learned how to configure the installation options, including the default file settings to be used with your version of Gephi.

Also, you should have a base-level familiarity with the Gephi workspace, especially the design toolbar. Although you may not yet understand in detail how each of these functions work, you should be prepared to move on and begin working with some of the functionalities as we proceed to the next chapter. In our next chapter, you'll discover how to create your own graphs using a number of the tools about which you just learned.

About the Author

  • Ken Cherven

    Ken Cherven has been creating data visualizations for more than 10 years using a variety of tools, including Excel, Tableau, Cognos, D3, Gephi, Sigma.js, and Exhibit, along with geospatial tools such as Mapbox, Carto, and QGIS.

    He uses Tableau on a daily basis in his current position, where he has built dozens of performance dashboards to track both marketing and operational metrics. He has also built many visualizations for his personal websites, especially utilizing Gephi and Sigma.js to explore and visualize network data.

    He is very interested in tools related to the exploration of network data, typically using Gephi for most of his current output. He’s also interested in text analysis, where he’s used tools such as Aylien, RapidMiner, R, and Exploratory to begin understanding and visualizing underlying patterns in political speeches, email transmissions, and book content.

    His experience in building data visualizations has intersected with many technologies, including a variety of SQL-based tools and languages including Oracle, MySQL, and SQLServer. He frequently edits and styles network information using HTML and CSS, along with a bit of JavaScript.

    He is also highly engaged in the world of data visualization, including but not limited to his daily work experience. His work is based on a thorough understanding of visualization principles learned through extensive reading and practice. He also uses his websites to display and promote visualizations, which he shares with a wider audience. He has previously authored two books on Gephi for Packt, and has also presented at multiple data visualization conferences

    Browse publications by this author
Book Title
Unlock this book and the full library for FREE
Start free trial