Gephi Cookbook - Sample Chapter
Gephi Cookbook - Sample Chapter
ee
Gephi Cookbook
This book is your one-stop guide to learning Gephi's interactive networking and visualization, alongside
the graph theory concepts that drive them. Each recipe walks you through a task and explains why and
how it works. Starting with installing Gephi, you will learn how to begin analyzing a graph using Gephi's
various features. You will discover how to make informed decisions using layout algorithms and filters,
and perform statistical analysis with real-world datasets. This guide is an invaluable resource if you would
like to plunge into the network analysis domain without having to learn how to code.
Gephi Cookbook
Gephi is an open source, user-friendly network visualization and analysis tool that provides numerous
powerful features, making it easy for novices to get to grips with graph analysis quickly.
Sa
pl
e
tasks on graphs
Understand various layout algorithms
and problems
Devangana Khokhar
network analysis
$ 44.99 US
29.99 UK
P U B L I S H I N G
Gephi Cookbook
Over 90 hands-on recipes to master the art of network analysis
and visualization with Gephi
P U B L I S H I N G
Devangana Khokhar
Gephi Cookbook
Gephi Cookbook is a guide to learn about interactive network exploration and
visualization accompanied by the graph theory concepts that drive them. It helps you to
understand about the nuances of network visualization, not only from a conceptual, but
also from an implementation perspective. This book is an invaluable resource if you are
looking forward to getting a deep-dive into the network analysis domain without having
to learn how to code.
47
Introduction
While working with graph and network visualizations, one of the most important requirements
is to have the ability to visualize the graph with its nodes placed according to some structure
across the graphical space. A good tool provides the capability to the users to restructure the
network in order to visualize it in a way in which the required parts of the graph are enhanced,
similar nodes occupy the same subspace in the graphical space, and all the nodes are clearly
distinguishable from each other. This helps give a clear and detailed understanding of the
structure of the network. Since networks are not the same and the exploration statement is
different in every case, the desired structure in the graphical space might differ. By leveraging
the various layouts shown in this chapter, the underlying structure of a network becomes more
obvious. This is one of the key advantages of network analysis; going back and forth from one
layout to another allows the structure of the network to emerge more quickly.
Various ready-to-use layout algorithms are one of the fortes of Gephi. This chapter covers
the default layout algorithms available in Gephi, from the perspective of both conception
and implementation.
Getting ready
Create a new network or load a preexisting one in Gephi. Make sure the Layout panel, as
shown in the following screenshot, is visible in the Gephi window:
If not, click on the Window option in the Menu bar and, from the drop-down menu, select
Layout. The Layout panel will appear on the left-hand side of the Gephi application window.
48
Chapter 3
How to do it
Let's consider the Les Misrables graph. To apply the Clockwise Rotate algorithm on this
graph, follow these steps:
1. Load the Les Misrables graph's undirected version in Gephi. Here's how it will
appear in the Graph window:
2. In the Layout panel, click on the drop-down menu that says ---Choose a layout:
49
50
Chapter 3
How it works
We just learned how to rotate a graph by a 90-degrees angle in a clockwise direction. This is
one of the geometric transformation algorithms present in Gephi, and may prove to be very
helpful in cases where the default layout isn't aesthetically pleasing. The graph, for instance,
might be spread more vertically than horizontally and one might want to visualize the same
graph spread more horizontally than vertically.
There's more
If you wish to rotate the graph in a clockwise direction by an angle other than 90 degrees,
here's how:
1. In the properties box, as shown in the following screenshot, double-click on the
textbox that holds the angle figure and enter the angle by which you would like to
rotate the graph clockwise:
2. Hit Run.
51
To reset all the values to their defaults, click on the Reset button located at the bottom of the
left-hand side panel, adjacent to the Presets button.
52
Chapter 3
See also
https://www.khanacademy.org/math/geometry/transformations for
more information on the Geometric Transformation algorithms and the Clockwise
Rotate layout algorithm
How to do it
We will begin with the Les Misrables network and explain how to use the Counter-Clockwise
Rotate layout algorithm to obtain a rotated version of the network. The steps remain the same
for any other network too. So let's get started.
1. Load the Les Misrables graph in Gephi.
2. In the Layout panel, click on the drop-down menu that says ---Choose a layout.
3. From the drop-down menu, select Counter-Clockwise Rotate. Hovering over the
small round icon with i written on it should open a pop-up information box that reads
Counter-Clockwise Rotate Rotate the graph by -90 degrees.
4. Hit Run. The chosen graph, rotated counter-clockwise by 90-degrees, will appear in
the Graph panel.
53
54
Chapter 3
How it works
You just learned how to rotate a graph or a network by 90 degrees in a counter-clockwise
direction. This, similar to the applications described in the How it works section of the Using
the Clockwise Rotate layout algorithm recipe, comes in handy when you want a snapshot of
the network that is more aesthetically pleasing and/or is more symmetrical.
There's more
If you wish to rotate the graph by an angle other than 90 degrees in a counter-clockwise
direction, use the following steps:
1. In the properties box, as shown in the following screenshot, double-click on the
textbox with 90.0 written in it and enter the angle by which you want to rotate the
graph. Hit Enter when done.
2. Hit Run.
55
56
Chapter 3
Suppose that you want the network to be rotated by x degrees in a counter-clockwise
direction. Simply rotating the same graph in the clockwise direction by (360 - x) degrees
would also result in the same final graph.
For example, you want the graph to be rotated in a counter-clockwise direction by 70 degrees,
resulting in a different layout for the graph. The same layout can be achieved by rotating
the graph in a clockwise direction by (360-70), which is 290 degrees. The following two
screenshots proves this.
This screenshot is that of the Les Misrables graph when rotated in a counter-clockwise
direction by 70 degrees:
57
To reset all the values to their defaults, click on the Reset button, which is located at the
bottom of the left-hand side panel, adjacent to the Presets button.
See also
https://www.khanacademy.org/math/geometry/transformations for
58
Chapter 3
How to do it
Let us consider Les Misrables network as a way to explain the process of applying the
Contraction layout algorithm. The steps remain same for any other network too.
1. Load the Les Misrables graph in Gephi.
2. In the Layout panel, click on the drop-down menu that says ---Choose a layout.
3. From the drop-down menu, select Contraction. Hovering over the small round icon
with i written on it should open a pop-up information box that reads Contraction
Contracts the layout around its center.
4. In the properties panel, enter the scale in the Scale Factor textbox by which you want
the network to be contracted.
5. Hit Run. The chosen graph, contracted as desired, will appear in the Graph panel.
The following screenshot shows how the Les Misrables graph will look when contracted by
20 percent or by a scale factor of 0.8:
59
How it works
The Contraction layout algorithm is yet another Geometric Transformation algorithm present in
Gephi. The scale factor defines the ratio of the size of the resulting graph to the original graph.
For example, if the scale factor is 0.7, then the resulting graph would shrink by 30 percent of
the size of the original graph. What really happens is that every node size remains the same,
but the distance between the nodes and the length of the edges is modified according to the
scale defined. In this example, the edges will become 70 percent of their original length and
the graph gets redrawn.
One might confuse scaling with zooming. There's a subtle difference between the two. During
scaling, only the edge lengths change and node sizes remain the same. On the other hand,
during zooming out or zooming in, the node sizes change proportionally, as well as edge lengths.
There's more
There's also the capability to shrink the network according to the user's choice. The following
steps describe this process:
1. In the properties box, as shown in the following screenshot, enter the scale by which
you would like to shrink the network in the Scale factor textbox. Hit Enter once done.
2. Click on Run.
60
Chapter 3
The following screenshot shows the Les Misrables network when shrunk by half its sizethat
is, by a scale factor of 0.5:
To reset all the values to their defaults, click on the Reset button located at the bottom of the
left-hand side panel, adjacent to the Presets button.
See also
https://www.khanacademy.org/math/geometry/transformations/
dilations-scaling/ for more information on graph scaling
61
How to do it
Considering the Les Misrables network, the steps to use the Expansion layout algorithm to
get an expanded version of the network are as follows. The steps remain the same for any
other network, too:
1. Load the Les Misrables graph in Gephi.
2. In the Layout panel, click on the drop-down menu that says ---Choose a layout.
3. From the drop-down menu, select Expansion. Hovering over the small round icon with
i written on it should open a pop-up information box that reads Expansion Expands
the layout around its center.
4. Hit Run. The chosen graph, expanded by 1.2 times its original size, will be redrawn in
the Graph panel.
The following screenshot shows how the Les Misrables graph will look when expanded by 1.2
times when using the Expansion Layout algorithm:
How it works
The way the Expansion algorithm works is very much the same as the Contraction algorithm.
For example, if the user has chosen 2 as the scale, the network will expand to twice its size.
This means that the edges will grow to twice their original length, while the node sizes remain
the same.
62
Chapter 3
There's more
Similar to the custom network contraction that was described in the previous recipe, Using the
Contraction layout algorithm, the user has the ability to view the desired expanded version of
the network. To accomplish this, follow these steps:
1. In the properties box, as shown in the following screenshot, in the Scale factor
textbox, enter the scale by which you would like to expand the graph under
consideration. Hit Enter once done.
2. Click on Run.
The following screenshot shows the Les Misrables network when expanded to twice its
original size that is, by a scale factor of 2.
63
See also
There are some good tutorials by Khan Academy on Graph Scaling. Check out the tutorials at
https://www.khanacademy.org/math/geometry/transformations/dilationsscaling/.
How to do it
As with the previous recipes in the chapter, we will begin with the Les Misrables network and
explain how to use the Force Atlas layout algorithm for a network. The steps remain the same
for any other network too. So let's get started.
1. Load the Les Misrables graph in Gephi.
2. In the Layout panel, click on the drop-down menu that says ---Choose a layout.
3. From the drop-down menu, select Force Atlas.
4. In the properties dialog box, enter a very high value, such as 20000.0, in the
Repulsion strength textbox. This is to ensure that, at the end of the layout, the
nodes do not overlap each other.
5. Hit Run. The chosen graph, laid out according to Force Atlas, will appear in the
Graph panel.
64
Chapter 3
The following screenshot shows how the Les Misrables graph will look when re-visualized by
using the Force Atlas layout algorithm with a repulsion strength of 20000.0.
How it works
As mentioned in the introduction section of this recipe, the Force Atlas layout algorithm
belongs to a class of networks known as force-directed algorithms. The force-directed
algorithms aim at building up a layout that is aesthetically pleasing with more emphasis on
symmetries and non-overlapping nodes. Force-directed algorithms use the properties of the
network to produce this kind of layout.
One concept that is made use of in force-directed algorithms is that of hubs and authorities.
Hubs in a directed network are nodes with high out-degrees, whereas authorities are nodes
with high in-degrees. In the case of undirected networks, treat each edge as a bidirectional
edge and then compute in-degrees and out-degrees. Force Atlas enhances the role of
authorities while penalizing the hubs in such a way that the authorities get clustered towards
the center of the graph, whereas the hubs get laid out towards the periphery.
65
There's more
You may have noticed that there are multiple parameters listed in the properties box when
the Force Atlas layout algorithm is selected. Each of these parameters helps us to change the
settings of the network when recomputed using the Force Atlas layout algorithm. Following are
the steps to reconfigure the settings of the Force Atlas layout algorithm and a description of
the way they change the final layout:
1. The first attribute that you see in the properties box, as shown in the following
screenshot, is Inertia. The Inertia attribute defines the extent to which the node
speed will be conserved at each new pass. That is, it determines how frequently the
nodes will change their position in the graphical space with each iteration of the
algorithm. For example, an inertia of 0.1 means that the nodes would almost be
static in the space whereas an inertia of 50.0 means that the nodes may change
their spatial position radically with each pass of the algorithm:
66
Chapter 3
2. The second parameter is Repulsion Strength. This parameter defines the force with
which each of the nodes will repel other nodes. The following screenshot shows
the Les Misrables network when revisualized after running the Force Atlas layout
algorithm with a repulsion strength of 5000.0, while other parameters retain their
default values:
67
3. The next parameter is Attraction Strength, which defines how strongly each pair of
connected nodes will attract each other. It is the opposite of repulsion strength with
the difference that repulsion strength holds true for all the nodes while attraction
strength holds true only for pairs of adjacent nodes.
4. The fourth parameter is Maximum Displacement, which is used to put a limit on
the amount by which each node can be displaced in the final layout from its initial
position.
68
Chapter 3
5. The fifth parameter, Auto Stabilize Function, when checked, activates the freezing of
the unstable nodes. This helps in stabilizing the network and achieving convergence
of the algorithm faster. The selection of this parameter may result in some loss of
efficiency.
6. The next parameter, Autostab Strength, defines the strength of the Auto Stabilize
function when it is selected. A high autostab strength will result in infrequent
movement of unstable nodes and vice-versa.
7.
The seventh parameter is Autostab Sensibility, which defines the extent and speed
with which the inertia adapts itself during algorithm execution.
8. Gravity defines the force with which all nodes are attracted to the center of the graph.
This avoids the huge dispersion that might be caused in the case of graphs with
disconnected components.
9. One of the defining factors of the Force Atlas algorithm is Attraction Distribution.
When the checkbox for attraction distribution is checked, the Force Atlas algorithm
attempts to centralize the authorities and push the hubs towards the border of the
layout. The following screenshot shows how the Les Misrables network will look after
the Force Atlas algorithm is run with Attraction Distribution checked:
69
There's more
The Force Atlas layout algorithm is best suited for small-world networks. Small-world networks
or scale-free networks mimic the real world. That is, the single-hop direct node-to-node
connections in small-world networks are very few but most of the nodes in the graph could
be reached from a node in multiple hops. An example could be a friendship network on
social networks. If you were to consider the entire network of users of Facebook, it would
be a small-world graph since each and every node is connected to relatively few nodes, as
compared to the total number of nodes in the entire graph; however, it's possible, in most
of cases, to reach any node from a node in a small number of hops.
See also
70
Chapter 3
How to do it
We will begin with the Les Misrables network and explain how to use the Force Atlas 2 layout
algorithm on it. The steps remain the same for any other network too. So let's get started.
1. Load the Les Misrables graph in Gephi.
2. In the Layout panel, click on the drop-down menu that says ---Choose a layout.
3. From the drop-down menu, select Force Atlas 2.
4. Set Scaling to a large value, such as 300.0, otherwise some of the nodes will
overlap each other. Hit Run.
The following screenshot shows how the Les Misrables graph will look when the Force Atlas 2
layout algorithm is run over it with scaling set to 300.0:
71
How it works
The speedup that is achieved in Force Atlas 2 is primarily due to the replacement of directsum simulation used in Force Atlas with Barnes-Hut simulation.
The direct-sum simulation tries to analyze the interaction between each entity to every other
entity in the system. In a graph, it considers the repulsion force between each node to every
other node in the graph and then tries to optimize the overall repulsion. Hence, the directsum simulation runs with a complexity of O(n2). On the other hand, Barnes-Hut simulation
considers interaction between some entities on an individual one-to-one basis. The remaining
entities are clubbed into different partitions and entries in each partition are then replaced by
a single representative. In our case, it considers the interaction between directly connected
nodes on an individual basis and the rest of the nodes are divided into partitions with a
single representative node representing each partition. The algorithm then tries to optimize
the repulsion between the considered node and rest of the adjacent nodes or representative
nodes. This leads to reduced interactions between the nodes and hence the complexity
comes down to O(n log n).
There's more
The settings for Force Atlas 2 could be modified to get varied layouts for the graph. Here's the
explanation of each of the parameters that could be set explicitly:
Threads number: This defines the number of threads that will run in parallel to speed
up the execution of the algorithm. This number is limited by the number of cores in
the processor.
Dissuade Hubs: This results in the placement of hubs towards the periphery of
the network.
LinLog mode: This is the option to switch between the linear-linear mode and
linear-log mode. The linear-log (LinLog) mode stands for linear attraction and
logarithmic repulsion. By default, it is linear attraction and linear repulsion.
The LinLog mode results in tighter and closely-knit clusters.
Prevent Overlap: This avoids the overlap of nodes in the final layout.
Edge weight influence: This defines how much weight has to be given to the
edge weights. When set to 0, it will result in computations that do not take into
consideration the edge weights. When set to 1, it gives complete weight to the edge
weights and they become crucial to the resulting layout.
Scaling: This defines the closeness of nodes in the resulting graph. A low scaling
value will result in a dense graph, whereas a high scaling value will result in a
sparse graph.
Stronger Gravity: This defines whether the graph should be drawn with most of the
nodes attracted towards the center.
72
Chapter 3
Gravity: This defines the strength with which the gravity will be applied to the graph.
Tolerance: This is similar to the Inertia parameter in the Force Atlas layout algorithm.
A lower value results in slow execution of the algorithm but higher precision delivered
in the end and vice versa.
To reset all the values to their defaults, click on the Reset button, which is located at the
bottom of the left-hand side panel, adjacent to the Presets button.
See also
simulation in detail
How to do it
We will begin with the Les Misrables network and explain how to use the Fruchterman
Reingold layout algorithm on it. The steps remain the same for any other network, too.
So let's get started:
1. Load the Les Misrables graph in Gephi.
2. In the Layout panel, click on the drop-down menu that says ---Choose a layout.
3. From the drop-down menu, select Fruchterman Reingold.
4. Hit Run. The chosen graph with the new layout appears in the Graph panel.
73
How it works
In the Fruchterman Reingold layout algorithm, the nodes are assumed to be entities made
of steel and the edges are assumed to be springs. The attractive force between the nodes
mimics the spring force, whereas the repulsive force between the nodes is analogous to the
electrical force. The objective of this algorithm is to minimize the overall energy of the whole
system and come up with an optimized layout of the network that satisfies this objective. One
important thing to note here is that, unlike the Force Atlas and Force Atlas 2 algorithms, this
algorithm does not take into consideration the edge weight to come up with an optimal layout.
74
Chapter 3
There's more
There are certain parameters in the specification of the Fruchterman Reingold layout
algorithm that can be modified to define the final layout of the network. Here's the
description of what they are and how they affect the layout of the network:
Area: This defines the area over which the final graph will be laid out.
Gravity: This is similar to the concept of gravity discussed under the Force Atlas and
Force Atlas 2 algorithms.
Speed: This defines the speed of convergence of the algorithm. High convergence
speed leads to lower precisions and vice versa.
To reset all the values to their defaults, click on the Reset button located at the bottom of the
left-hand side panel, adjacent to the Presets button.
The Fruchterman Reingold layout algorithm works quite well with small and medium graphs
but not so well with large graphs, owing to its high computational complexity. So, for large
graphs, you might want to explore other layout algorithms or increase the speed in the Speed
box (but that will lead to lower precision).
See also
How to do it
Using the Les Misrables network, we will explain how to use the Label Adjust layout algorithm
to obtain a new version of the network where labels can be read clearly. The steps remain the
same for any other network, too. So, let's get started.
1. Load the Les Misrables graph in Gephi.
75
How it works
The Label Adjust layout algorithm uses the size of the text labels to remodel the network. The
label text size acts as the repulsive force to restructure the network. The final layout will be
free of any overlapping labels.
76
Chapter 3
There's more
There's an option to use the node size along with the label text size to define the new layout of
the network in this algorithm:
1. In the properties box of the Label Adjust algorithm, check the Include Node Size box.
2. Hit Run.
This means that the larger nodes will repel other nodes more and smaller nodes will repel
other nodes less. Here's the screenshot of how the Les Misrables network will look when
remodeled by using the Label Adjust layout algorithm with the inclusion of node size:
To reset all the values to their defaults, click on the Reset button, which is located at the
bottom of the left-hand side panel, adjacent to the Presets button.
77
See also
How to do it
Using the Les Misrables network, we will explain how to use the Random Layout algorithm to
obtain a randomized version of the network. The steps remain the same for any other network
too. So, let's get started:
1. Load the Les Misrables graph in Gephi.
2. In the Layout panel, click on the drop-down menu that says ---Choose a layout.
3. From the drop-down menu, select Random Layout. Hovering over the small round
icon with i written on it should open a pop-up information box that reads Random
Layout: A random distribution of the nodes.
4. In the properties box, enter the space size that will define the size of the imaginary
rectangular space on which the final graph will be laid out.
5. Hit Run. The chosen graph, restructured with random node distribution, will appear in
the Graph panel.
78
Chapter 3
The following screenshot shows how the Les Misrables graph will look when viewed after
applying the Random Layout algorithm with a space size set to 2000.0:
79
How to do it
We will begin with the Les Misrables network and explain how to use the Yifan Hu layout
algorithm to obtain a restructured network. So, let's get started:
1. Load the Les Misrables graph in Gephi.
2. In the Layout panel, click on the drop-down menu that says ---Choose a layout.
3. From the drop-down menu, select Yifan Hu.
4. Hit Run. The restructured graph will appear in the Graph panel.
The following screenshot shows the Les Misrables graph after it has been restructured by
using the Yifan Hu layout algorithm:
80
Chapter 3
How it works
The Yifan Hu layout algorithm uses the same concept as Force Atlas to compute the new
layout of the network by optimizing the overall internode repulsions. The difference lies in
the pair of nodes that are taken into consideration for the computation of repulsive forces. In
the Yifan Hu layout algorithm, only pairs of adjacent nodes are taken into consideration. This
is different from the Force Atlas algorithm in which every pair of nodes is considered for the
computation of forces. This leads to reduced complexity in the Yifan Hu layout algorithm and
hence the new layout is computed much faster.
The Yifan Hu layout algorithm also makes use of the concept of "adaptive cooling scheme".
The algorithm starts with a high step length and over time readjusts the step length to smaller
values. This has two positive implications. It helps in faster convergence of the algorithm and
also in preventing the algorithm from getting stuck in local minima.
There's more
There are several settings that the user can change for the Yifan Hu layout algorithm to come
up with the best possible layout for the graph under consideration. Here are short descriptions
of these settings:
Quadtree Max Level: This defines the maximum level for the quadtree
representation. A quadtree is a tree where each non-leaf node has exactly four
children. The quadtree representation essentially places each node of the tree in a
matrix, with four neighbors being its children. A higher value of this parameter results
in higher accuracy and vice versa.
Theta: This defines the approximation coefficient for the Barnes-Hut algorithm. A
small value of theta would mean high accuracy.
Optimal Distance: The edges in the graph in the Yifan Hu algorithm are visualized
and assumed to be springs. This parameter defines the length of these springs. To
get the nodes further apart from each other, use a large value for this parameter.
To obtain a denser graph, use a small value.
Relative Strength: This defines the ratio between the repulsive forces and the
attraction forces in the graph.
Initial Step Size: This is the initial step size that the algorithm will use in its
integration phase. As prescribed in Gephi, a meaningful value, which is usually 10
percent of the optimal distance, should be chosen for this parameter.
Step ratio: This is ratio that will be used to recompute and update the step size
during the execution of the layout algorithm.
81
Adaptive cooling: This option is for choosing the adaptive cooling scheme to
configure the step size.
Convergence threshold: This defines the threshold energy convergence levels for the
algorithm to stop its execution. A high threshold will result in low accuracy, and a low
threshold in high accuracy, in the resulting layout.
To reset all the values to their defaults, click on the Reset button located at the bottom of the
left-hand side panel, adjacent to the Presets button.
See also
Efficient, High Quality Force-Directed Graph Drawing by Yifan Hu, which was
published in The Mathematica Journal in 2006, to learn more about the adaptive
cooling scheme that has been introduced in this recipe. The paper can be accessed
at http://www.mathematica-journal.com/issue/v10i1/contents/
graph_draw/graph_draw.pdf.
on quadtrees.
How to do it
We will begin with the Les Misrables network and explain how to use the Yifan Hu
Proportional algorithm on it. The steps remain the same for any other network too.
So let's get started:
1. Load the Les Misrables graph in Gephi.
2. In the Layout panel, click on the drop-down menu that says ---Choose a layout.
3. From the drop-down menu, select Yifan Hu Proportional.
4. Hit Run.
82
Chapter 3
The following screenshot shows how the Les Misrables graph will look after the Yifan Hu
Proportional algorithm has been executed:
See also
Yifan Hu's paper titled Efficient, High-Quality Force-Directed Graph Drawing at http://
www.mathematica-journal.com/issue/v10i1/contents/graph_draw/
graph_draw.pdf to read more about the Yifan Hu Proportional layout algorithm
83
How to do it
In this recipe, we will learn how to use Yifan Hu Multilevel layout algorithm to obtain a
restructured network on the Les Misrables network. The steps remain the same for
any other network too. So, let's get started.
1. Load the Les Misrables graph in Gephi.
2. In the Layout panel, click on the drop-down menu that says ---Choose a layout.
3. From the drop-down menu, select Yifan Hu Multilevel.
4. Hit Run. The remodeled graph will appear in the Graph panel.
The following screenshot shows how the Les Misrables graph will look after the execution of
the Yifan Hu Multilevel layout algorithm:
84
Chapter 3
How it works
The Yifan Hu Multilevel algorithm makes use of a scheme that combines a force-directed
model and a graph-coarsening technique. Graph-coarsening tries to group vertices and build
tighter, smaller graphs from these groups and is usually the first phase of a multilevel hierarchy
building method. This results in initial attraction between nodes, followed by repulsion between
them. It also results in reduced complexity of the algorithm. An approximation using the
Barnes-Hut algorithm is done for computing the force that is exerted on a node from a group
of distant nodes. The node treats all these distant nodes as a super node. One thing to notice
here is that this algorithm doesn't use the edge weight for its computation.
There's more
The settings for the Yifan Hu Multilevel algorithm can be modified, depending on the network
in consideration. Here's a list of parameters that could be changed under Settings and a brief
description for each of those parameters:
Quadtree max level: This is similar to Quadtree max level described in There's
more section of the Using the Yifan Hu layout algorithm recipe.
Minimum Level Size: This defines the minimum number of nodes that each level of
the quadtree must have.
Minimum Coarsening Rate: This defines the minimum relative size between
any two levels
Step Ratio: This will be used to recompute and update the step size during execution
of the layout algorithm.
Optimal Distance: The edges in the graph in the Yifan Hu algorithm are visualized
and assumed to be springs. This parameter defines the length of these springs. To
get the nodes far apart from each other, use a large value for this parameter. To
obtain a denser graph, use a small value
To reset all the values to their defaults, click on the Reset button, which is located at the
bottom of the left-hand side panel, adjacent to the Presets button.
See also
85
www.PacktPub.com
Stay Connected: