Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Gephi Cookbook
Gephi Cookbook

Gephi Cookbook: Over 90 hands-on recipes to master the art of network analysis and visualization with Gephi

eBook
$27.98 $39.99
Paperback
$48.99
Subscription
Free Trial
Renews at $19.99p/m

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Table of content icon View table of contents Preview book icon Preview Book

Gephi Cookbook

Chapter 2. Basic Graph Manipulations

In this chapter, we will cover the following recipes:

  • Generating a random graph
  • Selecting and highlighting nodes in the graph
  • Coloring and sizing nodes in the graph
  • Adding nodes and edges to the graph
  • Editing node attributes in the graph
  • Finding out the shortest path in the graph
  • Setting the edge and label properties
  • Setting basic properties for graphs, nodes, edges, and labels
  • Changing the background color of the graph
  • Generating a heat map for the graph
  • Showing convex hulls for a graph where a hierarchy exists
  • Showing/hiding various parts of the graph
  • Reverting changes in the graph to the original presets
  • Creating a PNG file directly from the graph window in user-specified sizes

Introduction

This chapter teaches you how to perform basic graph manipulations in Gephi. Manipulations such as modifying network structure by adding or deleting nodes and edges, editing node attributes, and applying filters on the network can be very easily done in Gephi, owing to its user-friendly interface.

Generating a random graph

A random graph with n nodes is a graph generated by starting with n nodes with no edges existing between any pair of nodes, and then randomly adding edges between nodes in a probabilistic fashion. This recipe describes the process of generating one such random graph in Gephi.

How to do it…

The steps to generate a random graph with n nodes are as follows:

  1. Click on File in the menu bar.
  2. Choose Generate in the drop-down menu.
  3. Choose Random Graph in the extended menu. You'll see the following pop-up window on the screen:
    How to do it…
  4. In the Number of nodes textbox, enter the number of nodes (n) that you want the random graph to have.
  5. In the Wiring probability textbox, enter the probability (p), according to where you would like the edges to be added between different pairs of nodes in the random graph. A low wiring probability will result in a regular lattice. On the other hand, the higher the wiring probability is, the more random the resulting graph will be.
  6. Click on OK....

Selecting and highlighting nodes in the graph

In this recipe, you will learn how to selectively pick up specific nodes in the graph and how to highlight them for closer study.

How to do it…

There are two different ways in which nodes can be selected in Gephi: direct selection and rectangle selection. Here's how we go about selecting the nodes in Gephi:

  1. To directly select a node and view its neighbors/adjacent nodes, click on the little arrow button towards the upper-left corner of the Graph panel, as shown in the following screenshot:
    How to do it…
  2. Navigate to the node that you want to highlight and place the arrow on the node. You will notice that the node on which you have placed the arrow, along with the neighboring nodes and the edges connecting them, has become highlighted while the other nodes are dimmed. This is shown in the following screenshot:
    How to do it…
  3. To select a node using rectangle selection, click on the button with the little rectangle depicted on it towards the upper-left corner of the...

Coloring and sizing nodes in the graph

Sometimes, while studying the properties of a network, we need to manually alter some of the attributes of the nodes, such as their color and size. This section explains how to achieve this.

How to do it…

The following steps illustrate how to resize individual nodes in the graph:

  1. Click on the diamond-shaped button in the toolbar placed on the left-hand side of the Graph panel. The mouse pointer, when placed over it, should show a descriptor textbox that reads Sizer.
  2. Click on the node that you want to resize and while holding the mouse button, drag the mouse vertically upwards or downwards. Dragging the mouse upwards will increase the size of the node and dragging it downwards will decrease the size.
  3. If the resized node now hides a part of the graph that you otherwise want to continue looking at, click on the button in the same toolbar with a hand symbol on it. Placing the mouse pointer on this button should show up a descriptor textbox that reads...

Adding nodes and edges to the graph

Gephi allows its users to alter graphs on-the-fly by offering capabilities such as adding node(s) or edge(s) to the graph in just one click. This recipe discusses how to carry out these actions.

How to do it…

The following steps illustrate the procedure to add a new node to the graph:

  1. Click on the pencil-shaped button in the toolbar, placed vertically on the upper-left side of the edge of the Graph panel. When a mouse pointer is placed on the icon, it should show a descriptor textbox that reads Node Pencil.
  2. In the upper-right corner of the Graph panel, choose the color that you would like to assign to the node and set the desired size for it.
  3. Now, click on the area of the Graph panel where you want to place the new node. This will create a new node with the selected color and size, as shown in the following screenshot:
    How to do it…

Follow these steps to add a new edge to the graph:

  1. Click on the pencil-shaped button in the toolbar that is placed vertically on the upper...

Editing node attributes in the graph

There might be cases where one would like to change some attributes for specific nodes manually. Gephi offers a very easy way to do so. In this recipe, we will discuss how, with just a single click, you can alter node attributes such as size, position, color, label, and so on.

How to do it…

The following steps illustrate the way to change node attributes such as size, position, color, label, and so on.

  1. Click on the button with an arrow and a question mark on it that is placed last on the toolbar located vertically on the upper-left edge of the Graph panel. When a mouse pointer is placed over this button, it should read Edit-Edit node attributes.
  2. Now click on the node whose attributes you want to alter.
  3. This opens a new panel titled Edit on the upper-left corner of the screen.
  4. Click on the attribute(s) that you want to modify and assign new value(s).

There's more…

You cannot modify attributes such as ID, since those are unique values.

Introduction


This chapter teaches you how to perform basic graph manipulations in Gephi. Manipulations such as modifying network structure by adding or deleting nodes and edges, editing node attributes, and applying filters on the network can be very easily done in Gephi, owing to its user-friendly interface.

Generating a random graph


A random graph with n nodes is a graph generated by starting with n nodes with no edges existing between any pair of nodes, and then randomly adding edges between nodes in a probabilistic fashion. This recipe describes the process of generating one such random graph in Gephi.

How to do it…

The steps to generate a random graph with n nodes are as follows:

  1. Click on File in the menu bar.

  2. Choose Generate in the drop-down menu.

  3. Choose Random Graph in the extended menu. You'll see the following pop-up window on the screen:

  4. In the Number of nodes textbox, enter the number of nodes (n) that you want the random graph to have.

  5. In the Wiring probability textbox, enter the probability (p), according to where you would like the edges to be added between different pairs of nodes in the random graph. A low wiring probability will result in a regular lattice. On the other hand, the higher the wiring probability is, the more random the resulting graph will be.

  6. Click on OK. This generates...

Selecting and highlighting nodes in the graph


In this recipe, you will learn how to selectively pick up specific nodes in the graph and how to highlight them for closer study.

How to do it…

There are two different ways in which nodes can be selected in Gephi: direct selection and rectangle selection. Here's how we go about selecting the nodes in Gephi:

  1. To directly select a node and view its neighbors/adjacent nodes, click on the little arrow button towards the upper-left corner of the Graph panel, as shown in the following screenshot:

  2. Navigate to the node that you want to highlight and place the arrow on the node. You will notice that the node on which you have placed the arrow, along with the neighboring nodes and the edges connecting them, has become highlighted while the other nodes are dimmed. This is shown in the following screenshot:

  3. To select a node using rectangle selection, click on the button with the little rectangle depicted on it towards the upper-left corner of the Graph panel:

  4. Place...

Coloring and sizing nodes in the graph


Sometimes, while studying the properties of a network, we need to manually alter some of the attributes of the nodes, such as their color and size. This section explains how to achieve this.

How to do it…

The following steps illustrate how to resize individual nodes in the graph:

  1. Click on the diamond-shaped button in the toolbar placed on the left-hand side of the Graph panel. The mouse pointer, when placed over it, should show a descriptor textbox that reads Sizer.

  2. Click on the node that you want to resize and while holding the mouse button, drag the mouse vertically upwards or downwards. Dragging the mouse upwards will increase the size of the node and dragging it downwards will decrease the size.

  3. If the resized node now hides a part of the graph that you otherwise want to continue looking at, click on the button in the same toolbar with a hand symbol on it. Placing the mouse pointer on this button should show up a descriptor textbox that reads Drag.

  4. Now...

Adding nodes and edges to the graph


Gephi allows its users to alter graphs on-the-fly by offering capabilities such as adding node(s) or edge(s) to the graph in just one click. This recipe discusses how to carry out these actions.

How to do it…

The following steps illustrate the procedure to add a new node to the graph:

  1. Click on the pencil-shaped button in the toolbar, placed vertically on the upper-left side of the edge of the Graph panel. When a mouse pointer is placed on the icon, it should show a descriptor textbox that reads Node Pencil.

  2. In the upper-right corner of the Graph panel, choose the color that you would like to assign to the node and set the desired size for it.

  3. Now, click on the area of the Graph panel where you want to place the new node. This will create a new node with the selected color and size, as shown in the following screenshot:

Follow these steps to add a new edge to the graph:

  1. Click on the pencil-shaped button in the toolbar that is placed vertically on the upper-left...

Editing node attributes in the graph


There might be cases where one would like to change some attributes for specific nodes manually. Gephi offers a very easy way to do so. In this recipe, we will discuss how, with just a single click, you can alter node attributes such as size, position, color, label, and so on.

How to do it…

The following steps illustrate the way to change node attributes such as size, position, color, label, and so on.

  1. Click on the button with an arrow and a question mark on it that is placed last on the toolbar located vertically on the upper-left edge of the Graph panel. When a mouse pointer is placed over this button, it should read Edit-Edit node attributes.

  2. Now click on the node whose attributes you want to alter.

  3. This opens a new panel titled Edit on the upper-left corner of the screen.

  4. Click on the attribute(s) that you want to modify and assign new value(s).

There's more…

You cannot modify attributes such as ID, since those are unique values.

Finding out the shortest path in the graph


Finding the shortest path in a graph is one of the problems that is widely encountered in many different situations across many different domains. This is one of the fundamental problems in graph theory. It has applications in domains such as computer networks, inventory optimization, flow networks, and so on. In this recipe, we will learn how to compute and visualize the shortest path in a graph in Gephi.

Getting ready

Load a pre-existing network in which you would like to find the shortest path, such as Les Misérables, or create one.

How to do it…

To compute and visualize the shortest path for a pair of nodes in a network, follow these steps:

  1. Click on the button with an airplane symbol on it in the vertically placed left-hand side toolbar in the Graph panel. When placed over this button, the mouse pointer displays a descriptor textbox that reads Shortest Path.

  2. Now click on the source node in the graph from where the path should start.

  3. Select the target...

Setting the edge and label properties


Gephi offers functionality to set up edge and label properties such as edge weight, edge color, label weight, label color, and so on. These functionalities will be discussed in this recipe.

How to do it…

To set edge and label properties explicitly, follow these steps:

  1. Load the Les Misérables graph in Gephi.

  2. Click on the upward-pointing arrow located at the bottom-right corner of the Graph panel to expand a new panel.

  3. In that panel, click on the Labels tab.

  4. Check the checkbox located next to Nodes. This will display all the node labels.

  5. The first button we will discuss defines how the edges will be colored. This is the button with a line segment and a mini-rainbow-like structure as its icon placed at the fourth position in the horizontal toolbar located towards the bottom of the Graph panel. Hovering the mouse pointer on top of it should show a descriptor textbox that reads Edges have source node color.

  6. When toggled on, this will result in the edges taking the...

Setting basic properties for graphs, nodes, edges, and labels


Apart from what has been discussed so far in this chapter, Gephi also offers some additional options for configuring the basic properties of the graphs, nodes, edges, and labels. This section discusses these functionalities.

Getting ready

Load the Les Misérables graph in Gephi.

How to do it…

In the following steps, we will discuss various functionalities offered by Gephi to set the basic properties of graphs, nodes, edges, and labels.

  1. Click on the upward-pointing arrow located in the bottom-right corner of the Graph panel to expand a new toolbar with four tabs: Global, Nodes, Edges, and Labels.

  2. Click on the Global tab.

  3. Click on the button next to Background Color to open a color palette window where you can select the background for the graph.

  4. The Autoselect neighbor checkbox is used to turn the toggle on and off for selecting the neighbors when a node is selected.

  5. Move the Zoom slider back and forth to zoom-in and zoom-out of the graph...

Left arrow icon Right arrow icon

Description

If you want to learn network analysis and visualization along with graph concepts from scratch, then this book is for you. This is ideal for those of you with little or no understanding of Gephi and this domain, but will also be beneficial for those interested in expanding their knowledge and experience.

Who is this book for?

If you want to learn network analysis and visualization along with graph concepts from scratch, then this book is for you. This is ideal for those of you with little or no understanding of Gephi and this domain, but will also be beneficial for those interested in expanding their knowledge and experience.

What you will learn

  • Install and configure Gephi on your system and understand its various features
  • Perform basic manipulation and exploration tasks on graphs
  • Understand various layout algorithms present by default in Gephi and the principles behind them
  • Explore the properties of graphical networks using numerous filters and statistical metrics available in Gephi
  • Import graph data from different sources and manipulate it directly in tabular formats
  • Use realworld datasets to better understand network analysis

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : May 27, 2015
Length: 296 pages
Edition : 1st
Language : English
ISBN-13 : 9781783987412
Concepts :
Tools :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : May 27, 2015
Length: 296 pages
Edition : 1st
Language : English
ISBN-13 : 9781783987412
Concepts :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total $ 146.97
Gephi Cookbook
$48.99
Mastering Gephi Network Visualization
$48.99
Neo4j Cookbook
$48.99
Total $ 146.97 Stars icon

Table of Contents

11 Chapters
1. Getting Started with Gephi Chevron down icon Chevron up icon
2. Basic Graph Manipulations Chevron down icon Chevron up icon
3. Using Graph Layout Algorithms Chevron down icon Chevron up icon
4. Working with Partition and Ranking Algorithms Chevron down icon Chevron up icon
5. Running Metrics, Filters, and Timelines Chevron down icon Chevron up icon
6. Working in the Data Laboratory Mode Chevron down icon Chevron up icon
7. Getting Graphs and Networks Ready for Preview Chevron down icon Chevron up icon
8. Exploring Dynamic and Multilevel Graphs Chevron down icon Chevron up icon
9. Getting Real-world Graph Datasets Chevron down icon Chevron up icon
10. Exploring Some Useful Gephi Plugins Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon

Customer reviews

Rating distribution
Full star icon Full star icon Full star icon Full star icon Full star icon 5
(1 Ratings)
5 star 100%
4 star 0%
3 star 0%
2 star 0%
1 star 0%
PierreR May 18, 2019
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Un livre qui vous permettra de prendre en main facilement le logiciel de Graphe Gephi. Avec beaucoup de d'exemples pratiques et clairs. Je me sers de Gephi pour faire des Graphes de Sites Web.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.