Query Analysis On A Distribute GraphDB
Query Analysis On A Distribute GraphDB
Instructions
Ing. Michal Valenta, Ph.D. doc. RNDr. Ing. Marcel Jiřina, Ph.D.
Head of Department Dean
January 8, 2019
Acknowledgements
I would like to thank my supervisor Michal Valenta for his valuable suggestions
and observations, my sister Šárka Svitáková for spelling corrections, my friends
Martin Horejš and Tomáš Nováček for their valuable comments and my family
for their continual motivation and support.
Declaration
I hereby declare that the presented thesis is my own work and that I have
cited all sources of information in accordance with the Guideline for adhering
to ethical principles when elaborating an academic final thesis.
I acknowledge that my thesis is subject to the rights and obligations stip-
ulated by the Act No. 121/2000 Coll., the Copyright Act, as amended. In
accordance with Article 46(6) of the Act, I hereby grant a nonexclusive au-
thorization (license) to utilize this thesis, including any and all computer pro-
grams incorporated therein or attached thereto and all corresponding docu-
mentation (hereinafter collectively referred to as the “Work”), to any and all
persons that wish to utilize the Work. Such persons are entitled to use the
Work in any way (including for-profit purposes) that does not detract from its
value. This authorization is not limited in terms of time, location and quan-
tity. However, all persons that makes use of the above license shall be obliged
to grant a license at least in the same scope as defined above with respect to
each and every work that is created (wholly or in part) based on the Work, by
modifying the Work, by combining the Work with another work, by including
the Work in a collection of works or by adapting the Work (including trans-
lation), and at the same time make available the source code of such work at
least in a way and scope that are comparable to the way and scope in which
the source code of the Work is made available.
Přestože dnes existuje několik produktů grafových databázı́ určených pro dis-
tribuovaná prostředı́, jsou v nich obvykle data distribuována na jednotlivé
fyzické uzly náhodně, bez pozdějšı́ revize zatı́ženı́ a možné reorganizace dat.
Tato práce analyzuje současné praktiky ukládánı́ dat v distribuovaných grafo-
vých databázı́ch. Podle této analýzy práce navrhuje a implementuje nový
modul pro grafový výpočetnı́ framework TinkerPop, který loguje provoz vy-
generovaný dotazy uživatelů. Je rovněž naimplementována samostatná ap-
likace pro ukládánı́ takovýchto logovaných dat do databáze JanusGraph. Tento
program rovněž spouštı́ redistribučnı́ algoritmus navrhujı́cı́ efektivnějšı́ uloženı́
dat v clusteru. Existujı́cı́ algoritmus od Vaquera a spol., kompatibilnı́ se
systémem Pregel, je aplikován s podstatnými rozšı́řenı́mi. Výsledkem je návrh
reorganizace dat s 70–80% zlepšenı́m komunikace mezi uzly clusteru. Takovýto
výsledek je porovnatelný s jinou známou metodou Ja-be-Ja, která však vyža-
duje výrazně vyššı́ výpočetnı́ prostředky. Na druhou stranu metoda v této
práci zavádı́ malou disbalanci na uzlech clusteru. Nakonec tato práce uvádı́
doporučenı́ pro možná budoucı́ rozšı́řenı́ a vylepšenı́.
vii
Abstract
viii
Contents
Introduction 1
2 Graph Partitioning 13
2.1 Algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2.2 Pregel-Compliant Algorithms . . . . . . . . . . . . . . . . . . . 19
3 Technology 29
3.1 Distributed Graph Databases . . . . . . . . . . . . . . . . . . . 29
3.2 Apache TinkerPop . . . . . . . . . . . . . . . . . . . . . . . . . 37
5 Implementation 57
5.1 Graph Database Selection . . . . . . . . . . . . . . . . . . . . . 57
5.2 Query Data Extraction . . . . . . . . . . . . . . . . . . . . . . . 58
5.3 Graph Redistribution Manager . . . . . . . . . . . . . . . . . . 65
6 Evaluation 71
6.1 Datasets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
6.2 Evaluation Methods . . . . . . . . . . . . . . . . . . . . . . . . 77
6.3 Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
ix
6.4 Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
6.5 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
7 Enhancements 89
7.1 Query Data Extraction . . . . . . . . . . . . . . . . . . . . . . . 89
7.2 Graph Redistribution Manager . . . . . . . . . . . . . . . . . . 89
7.3 Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
7.4 Experiments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
Conclusion 93
Bibliography 95
A README 105
A.1 Processed Result Logging . . . . . . . . . . . . . . . . . . . . . 105
A.2 Graph Redistribution Manager . . . . . . . . . . . . . . . . . . 111
C Contents of CD 135
x
List of Figures
xi
6.4 Effect of cooling factor on cross-node communication and number
of iterations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
6.5 Effect of imbalance factor on cross-node communication, number
of iterations and capacity usage. . . . . . . . . . . . . . . . . . . . 82
6.6 Effect of adoption factor on cross-node communication and number
of iterations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
6.7 Effect of adoption factor on cross-node communication and number
of iterations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
xii
List of Tables
xiii
List of Tables
xiv
Introduction
1
Introduction
tion of the graph partitioning problem and its existing algorithms in chapter 2.
The current graph database systems are examined together with their models
of data storage in chapter 3. The chapter 4 is devoted to the analysis and
design of the data extraction, their storage and redistribution algorithm. The
implementation of these concepts is described in chapter 5. The proposed
redistribution is evaluated on real datasets and later compared to another
algorithm in chapter 6. Finally, the chapter 7 offers several propositions for
future work.
2
Chapter 1
Theory of Graph Databases
1.1 Databases
“A database is a self-describing collection of integrated records” [2]. Records
in this definition are any data collected to be stored. The adjective integrated
means that not only the records themselves but also their relationships are
maintained. Last but not least, a collection of such data with relationships is
self-describing because it contains a description of its structure.[2]
This definition refers to nowadays databases that emerged with computers.
Nevertheless, the history of databases – storing, retrieving, modifying and
deleting data – dates back a long time ago. Blażewicz et al. [3] mentions
six main phases of database evolution to which we add the last category of
NoSQL databases 1 :
1. manual processing
3
1. Theory of Graph Databases
4
1.1. Databases
5
1. Theory of Graph Databases
• Soft-State – the system does not have to be consistent all the time.
The NoSQL databases are most often divided into following classes:
6
1.2. Graph Databases
Figure 1.1: DBMS popularity changes since 2013 [1]. Graph DBMSs are repre-
sented with the upper green line with circles. Separately from graph DBMSs,
RDF stores are depicted with a lighter green line with circles experiencing
lower popularity changes than solely the graph DBMSs.
7
1. Theory of Graph Databases
The Figure 1.2 and 1.3 show a representation of the same data example in
a property graph and an RDF graph, respectively.
The main differences between property and RDF graphs are [9]:
8
1.2. Graph Databases
Sith Jedi
is the father of
nickname: Darth Vader 1 2 name: Luke
name: Anakin surname: Skywalker
surname: Skywalker address: Desert
taxId: 656d706972652072756c657a 636863692061636b6f, Tatooine
https://schema.org/parent
https://en.wikipedia.org/wiki/Darth_Vader https://en.wikipedia.org/wiki/Luke_Skywalker
https://schema.org/memberOf https://schema.org/memberOf
Sith Jedi
https://schema.org/name https://schema.org/name
Anakin Luke
https://schema.org/familyName https://schema.org/familyName
Skywalker Skywalker
https://schema.org/nickName
Darth Vader Desert
https://schema.org/address 636863692-
https://schema.org/taxID 061636b6f,
656d706972652072756c657a
Tatooine
• Property graph has more efficient storage than the RDF graph as it was
designed with this objective.
Overall, apart from the storage of characteristic data with a specific intent
(data exchange of triplets on the web), the more utilized graphs are property
graphs as they offer more possibilities in total and are more suitable for a
general purpose. Graph DBMSs have also been experiencing more attention
than RDF stores as shown in Figure 1.1.
9
1. Theory of Graph Databases
Each graph database can employ a different graph representation for its
storage. Given a directed graph8 G = (V, E), the most common graph repre-
sentations are (according to Kolář [10], adjusted)
10
1.2. Graph Databases
10
OLAP stands for Online Analytical Processing. It is a processing focused on querying,
unbalanced load and analytical (aggregated) data.
11
Chapter 2
Graph Partitioning
The graph partitioning problem has been a well-known and researched task for
decades, which gives the advantage of a significant number of already existing
methods. These are introduced in following section Algorithms 2.1.
Nevertheless, first, let us define the problem of graph partitioning itself pre-
ceded with selected definitions from graph theory necessary for understanding
the later introduced concepts.
Weight A graph can be extended with weights, assigning each vertex and
edge a numerical value called weight. A weight function w(el) then returns
the weight of an element el ∈ {V ∪ E}.
– no element of P is empty:
∀i ∈ {1, ...k}, P i 6= ∅;
– the elements of P are pairwise disjoint:
∀(i, j) ∈ {1, ..., k}2 , i 6= j, P i ∩ P j = ∅;
– the union of all the elements of P is equal to V :
k
Pi = V
S
i=1
13
2. Graph Partitioning
Edge Cut Although a part P i and a part P j are disjoint, meaning they do
not share any vertices, they can share some edges connecting their vertices.
Sum of the weights of these edges connecting vertices of part P i and part P j
is called an edge cut. This means that an edge cut function cut(P i , P j ) is
defined as X X X
cut(P i , P j ) = w(e),
u∈P i v∈P j e∈E uv
where E uv is the set of edges connecting the vertices u and v. In the case of
an unweighted graph, an edge can be assigned a default value of the weight,
for example, 1.
where the division by two is present only to show that each edge cut was
counted twice.
This balancing and minimalization task is an NP-complete12 problem even
for the case of k = 2 called Minimum Bisection problem [15].
2.1 Algorithms
As already mentioned, a significant number of algorithms for the graph par-
titioning task already exist. Some of these methods are based on the same
principles according to which they can be categorized as f.e. by [16, 17, 18].
Note, that the categories are not always necessarily disjunctive.
This work adopts classification mainly of Buluç et al. [16] nad partly of
Fjällström [18]. An extra category of Pregel-compliant algorithms is added as
well.
We provide a general overview of graph partitioning algorithms. Various
groups of methods are introduced, though not always explained in detail.
More relevant algorithms are then discussed more thoroughly.
11
Often the sizes of partitions are equal, but in the case of different hosts of a graph
database cluster, the size corresponds to a host capacity which can differ.
12
NP-complete problem is a decision problem in computational complexity theory, which
belongs to both the NP and the NP-hard classes. The NP (nondeterministic polynomial
time) class contains decision problems of positive answer proofs verifiable in polynomial
time. The NP-hard class contains problems to which all the problems in NP can be reduced
in polynomial time.
14
2.1. Algorithms
• Spectral Partitioning
Algorithms of this group work with spectrum of a graph which is a list
of eigenvalues of the graph adjacency matrix [17].
A widely applied concept is an algebraic connectivity, also called the
Fiedler vector after the Czech mathematician Miroslav Fiedler [22]. Al-
gebraic connectivity works with Laplacian Matrix L of a graph G =
(V, E), n = |V |, which is defined as L = D − A where D is a degree
matrix of a graph G, D = diag(d1 , ..., dn ), and A is the adjacency matrix
of the graph G [23]. Fiedler vector is then the second smallest eigenvalue
of the Laplacian matrix. Partitions are defined according to similarity
in values of this vector.
• Graph Growing
Graph Growing is based on easy steps of selecting a random vertex and
using the breadth-first search to create a set of surrounding vertices V
which, in the case of a bisection, contain half of the vertices or half of the
13
“The bisection width is the size of the smallest edge cut of a graph which divides it into
two equal parts” [20].
15
2. Graph Partitioning
16
2.1. Algorithms
• Tabu Search
Similarly to Kernighan-Lin, Tabu Search is a method swapping vertices
from a current partition to another. After that, however, the vertex is
brought to a tabu list containing vertices forbidden for migration in a
certain number of following iterations.
17
2. Graph Partitioning
• merging any parallel edges into a single edge with a summed weight
of the parallel edges as well.
2.1.4 Metaheuristics
The popularity of metaheuristics has been projected into graph partitioning
as well. According to Sorensen and Glover [32]:
18
2.2. Pregel-Compliant Algorithms
• each vertex and its out-going edges can change its value
• each vertex can decide about mutating the topology of the graph
This “think like a vertex” approach enables running each vertex task of a
superstep in parallel. Within a superstep no synchronizing communication is
needed. The last stated option of a possible mutation execution is rigorously
processed with well-defined rules at the end of a superstep.
The algorithm terminates when each vertex votes to halt, and no further
messages should be transmitted, or a user-defined maximum of iterations is
reached. At the beginning of the algorithm, each vertex has active status.
When the vertex has no further job to process, it deactivates itself to an
19
2. Graph Partitioning
Figure 2.2: Maximum Value Example in Pregel Model. Dotted lines are mes-
sages. Shaded vertices have voted to halt.[35]
20
2.2. Pregel-Compliant Algorithms
Class of algorithms naturally suitable for Pregel could be the diffusion sys-
tem described in 2.1.2. Perhaps the most profound method based on diffusion
systems and dedicated to distributed graphs is DiDiC – Distributed Diffusive
Clustering [36]. Originally developed for clustering a P2P supercomputer,
DiDiC requires only communication between neighbors and an arbitrary ini-
tial partitioning. However, it can sustain only an upper bound on the number
of clusters which means it does not guarantee a specific amount of partitions
and the result is also not necessarily balanced [36, 28].
Two promising algorithms, Vaquero et al. [37] and Ja-be-Ja [28], compliant
with Pregel framework are further introduced in more detail.
iii For each v ∈ V chosen in that specific order such that v1 , ..., vm < v <
vm+1 , ...vk , let
Lv (t) = f (Lv1 (t), ..., Lvm (t), Lv(m+1) (t − 1), ..., Lvk (t − 1)), (2.1)
21
2. Graph Partitioning
A B A B
t=0 v1 v2 t=0 v1 v2
(a) Label propagation for all the (b) Label propagation with pre-
nodes at the same iteration. vented oscillation.
where k ∈ {1, ..., |Dv |} with Dv being a set of neighbors of the vertex
v and f returns the most frequent label among the neighbors where
ties are broken uniformly randomly. However, if the tie is between the
current partition and another one, the current partition is preferred to
avoid an extra migration overhead.
iv If all the vertices already have the same label as is the most frequent label
among its neighbors (meaning no more label adoptions are possible),
stop the algorithm. Else, set t = t + 1 and go to ii.
• In the first step i, the vertices are not assigned a unique label each.
Instead, their initial partition is adopted as a label at t = 0. This
initial labeling ensures the same number of different labels in the
first step as the number of partitions.
• Instead of steps ii and iii which require demanding ordering of all
the nodes, it confronts the oscillation problem with a random factor
22
2.2. Pregel-Compliant Algorithms
2.2.1.3 Constraints
In order to create a balanced partitioning, Ugander and Backstrom [39] – on
who Vaquero et al. [37] bases j – constraint k thelpartition size
m with both lower
and upper bound equal to (1 − f ) |Vn | and (1 + f ) |Vn | , where f is some
fraction f ∈ [0; 1] and n is the number of partitions.
However, Vaquero et al. approach partition balancing with their own
constraint. They define the maximum number of vertices allowed to change a
partition P i to a partition P j , i 6= j in an iteration t as
C j (t)
Qi,j (t) = , (2.2)
|P (t)| − 1
where C j (t) is a capacity constraint on partition P j such that |P j (t)| ≤ C j ;
P (t) = {P 1 (t), ..., P n (t)}, so |P (t)| = n.
In other words, the remaining capacity of a partition P j is equally divided
among other partitions as available space for its vertices to migrate to the
partition P j . This is an upper bound constraint. The authors do not explicitly
talk about any lower bound constraint.
2.2.2 Ja-be-Ja
Ja-be-Ja15 promises a distributed, local algorithm for balanced partition-
ing [28]. It is a graph repartitioning method resembling the previously de-
scribed algorithm of Vaquero et al., yet with significant differences. Ja-be-
Ja uses a friendly terminology of colors and energies which helps a quicker
15
“Ja-be-Ja” means “swap” in Persian [28].
23
2. Graph Partitioning
comprehension. It also offers solution both for edge- and vertex-cuts, and it
discusses a case of weighted graphs.
Different colors of vertices represent different partitions as well as different
labels do in label propagation.
The energy of a graph, that is, the number of edges between vertices with
different colors (meaning the edge-cut), is defined as
1X
E(G, P ) = (dv − dv (πv )) , (2.3)
2 v∈V
Note, that in Vaquero et al. the labels are adopted, so the number of a par-
ticular label occurrences changes with the necessity to introduce constraints
on label selection. In comparison with that, the Ja-be-Ja color swapping keeps
the number of each color occurrences unchanged.
2.2.2.2 Sampling
There are three ways of how to choose a set of potential vertices for swapping.
• Local – only the neighbors of a given vertex are chosen for the sample
set.
24
2.2. Pregel-Compliant Algorithms
• Random – the sample set if chosen uniformly randomly from the entire
graph. Each host maintains a sample of random vertices from which its
local vertices pick their random sample.
Experiments in the original paper [28] show that the hybrid approach
performs the best in a majority of the cases, so it is also used by the authors
in all subsequent evaluations.
2.2.2.3 Swapping
The decision to swap a color between two vertices has two parts
25
2. Graph Partitioning
p q u v
(a) Color exchange between p and q is (b) Color exchange between u and v is
accepted if α ≥ 1. accepted only if α > 1.
where w(v, u) represents the weight of an edge (or edges) between the
vertices u and v.
2.2.3 Summary
In conclusion, the Vaquero et al. algorithm seems less computationally stren-
uous as it always stays in local scope whereas Ja-be-Ja needs to communicate
after each iteration within the whole graph to swap corresponding vertices and
to gather a set of random vertices for each partition in the next round. The
swapping process of Ja-be-Ja can also be expected to be much slower than the
label adoption of Vaquero et al.
Ja-be-Ja algorithm always results in a well balanced solution (if the initial
partitioning is balanced), because the proportion of particular colors does not
change. On the other hand, it cannot perform a bit elastic behavior regarding
balancing (it cannot be set that the partition proportions can, for example,
differ up to five percent). Nevertheless, the Vaquero et al. method proposes
only an upper bound on each partition, which can create balanced solutions
when the majority of partitions space is taken by data. However, if the amount
26
2.2. Pregel-Compliant Algorithms
of data on each partition is, for instance, less then half of its available space,
it could bring an unbalanced solution, even entirely shifting data out of some
partitions.
Last but not least, Ja-be-Ja algorithm confronts the problem of local min-
ima by applying simulated annealing. Vaquero et al. do not even mention this
issue. Furthermore, Ja-be-Ja offers a solution for weighted graphs whereas Va-
quero et al. do not.
Table 2.1 summarizes these conclusions dividing them into five categories.
The resulting values are labeled with plus or minus signs to denote the per-
formance of the given algorithm in the corresponding category.
27
Chapter 3
Technology
3.1.1 JanusGraph
JanusGraph is a distributed transactional16 graph database. It is a fork of
the open-source project Titan which further development was stopped in 2015
when its mother company Aurelius was acquired by DataStax [40]. Since its
origin, JanusGraph has been growing in its popularity significantly [41].
Like its predecessor, JanusGraph can store hundreds of billions of vertices
over several independent machines. For retrieval and modification of data, it
uses the Gremlin query language which is a component of the Apache Tinker-
Pop framework (described in 3.2).
16
As section 1.1 introduced transactions, a transactional database means that an opera-
tion or a set of operations is encased in a transaction which can run in parallel with other
transactions always resulting (with BASE concept eventually) in the same state.
29
3. Technology
Connection Modes
The storage backends can be connected to JanusGraph in different modes [48].
These are:
• Local Server Mode – Storage backend is run on the same local host
as JanusGraph and a related user application. The storage and Janus-
Graph communicate via localhost socket. The mode is depicted in Figure
3.1.
30
3.1. Distributed Graph Databases
Figure 3.1: Local Server Mode of JanusGraph with storage backend [48]
Figure 3.2: Remote Server Mode of JanusGraph with storage backend [48]
Figure 3.3: Remote Server Mode with Gremlin Server of JanusGraph with
storage backend [48]
31
3. Technology
Local Container
Gremlin Server
Remote Server
Remote Server
Local Server
Embedded
with
Apache Cassandra 3 3 3 3 3
Apache HBase 3 3 3
Google Cloud Bigtable 3 3 3
Oracle Berkeley DB 3
Nevertheless, not all of the supported storage backends support all of the
mentioned modes. A table 3.1 contains these possible combinations of data
storages and connection modes.
Data Model
JanusGraph stores its graph in an adjacency list which was introduced in
section 1.2.2. However, JanusGraph does not store adjacency vertices in the
list, but incident edges to keep the references unambiguous (as the represented
graph is a multi-graph). Such adjacency lists are stored as key-value pairs,
where the key is a vertex ID and the value is represented with all incident
edges and also properties of the corresponding vertex. The layout is shown in
Figure 3.5.
3.1.2 OrientDB
OrientDB is an open-source NoSQL multi-model database. Its objective is to
remove the need of looking for specific dedicated solutions when possessing
32
3.1. Distributed Graph Databases
data of various types. The solution of OrientDB is to store all the different
data under one hood.
In order to make an easy adjustment for developers accustomed to rela-
tional databases, OrientDB provides an SQL interface which can be used for
any operation with the database. Since version 3.0, OrientDB also implements
TinkerPop 3 interfaces.
Connection modes
• memory – no persistent storage is used, all the data stay in the mem-
ory. Consequently, as soon as JVM is shut down, all the data are lost.
Therefore, this mode is suitable for testing purposes and cases in which
a graph does not have to persist.
Data Model
In introducing parts of the OrientDB tutorial, it is proclaimed that unlike
some other multi-model DBMSs, OrientDB does not provide only an interface
for models translating it into another one. Instead, its engine has been built to
natively support graph, document, key-value and object models at once [50].
Nevertheless, OrientDB does translate Graph API into Document API and
further to a key-value or object-oriented storage as shown in Figure 3.6. The
33
3. Technology
THE USER
|| ||
_||_ ||
\ / ||
\/ _||_
+-------------+ \ /
| Graph API | \/
+-------------+-----------------+
| Document API |
+-------------------------------+
| Key-Value and Object-Oriented |
+-------------------------------+
translation does not add any extra complexity, meaning it does not cause an
increase of read and write operations, which means the native support of the
models.
Both vertices and edges are stored as instances of the classes Vertex and
Edge, respectively. Links between the vertices and edges are not pointers but
direct links, which is one of the basic concepts of OrientDB [52].
In other words, a graph containing a vertex v1 , a vertex v2 and an undi-
rected edge e12 connecting vertices v1 and v2 , would be stored as follows
• e12 as an instance of the class Edge (or its subclass) with references to
v1 and v2
3.1.3 ArangoDB
ArangoDB is another multi-model database supporting graph, document, and
key-value storage. Therefore, ArangoDB is a similar product to OrientDB,
both experiencing equal attention by users [41]. Nonetheless, ArangoDB is
34
3.1. Distributed Graph Databases
ArangoDB used to provide only its custom solution of a storage engine based
on memory-mapped files (mmfiles) [55]. Beginning with version 3.2 released
in July, 2017 [56] another option of pluggable backend storage is provided
as well. A user can select the RocksDB, an embeddable persistent key-value
store developed by Facebook [57].
ArangoDB offers a distributed organization of data over nodes of a cluster
as well. The distributed mode depends on the model used, key-value store
being the best and graph data performing the worst regarding the scalability.
Connection Modes
Data Model
Each vertex and edge is stored as a document in ArangoDB. Documents
in ArangoDB form collections which are uniquely identified with an identifier
and a unique name. A collection also needs to have an assigned type. There
are two types of collections so far in ArangoDB – the Document and the Edge.
Each type of an edge (for example “knows” or “owns”) is an edge collection.
An edge collection has special attributes from and to declaring an inbound
and an outbound vertex. Each type of vertex (for example “a person”, “a
company”,...) is a document collection (also called vertex collection).
35
3. Technology
36
3.2. Apache TinkerPop
There are of course several graph databases whose development has been
ended, such as BlazeGraph, Sparksee or GraphBase. On the other hand,
there also exist very promising brand new commercial graph databases that
provide handling of a huge amount of real-time data. A Croatian product
MemGraph has a strong competitor in TigerGraph offering a native par-
allelism handling 256,000 transactions per second [63].
3.2.1 Structure
Serving as an abstraction layer over graph databases, Apache TinkerPop is a
collection of technologies incorporating its own and third-party libraries and
systems [68]. The TinkerPop is written in Java language as a Maven17 project.
It is composed of several parts depicted in Figure 3.7 and introduced in this
section.
Note, that the current TinkerPop 3 is discussed as version 3 has existed
for three years so far. For this reason, the obsolete TinkerPop 2 will not be
examined here. However, for users familiar with TinkerPop 2 it is important
to mention that the two versions vary significantly. The formerly individual
TinkerPop 2 projects have been merged into nowadays Gremlin18 [69].
17
Maven is a building tool for software project management and a build automatization.
18
Specifically, TinkerPop 2 Blueprints are now Gremlin Structure API, Pipes are Graph-
37
3. Technology
Traversal, Frames transformed into Traversal, Furnace was divided into GraphComputer
and VertexProgram and Rexster is now known as Gremlin Server [69].
38
3.2. Apache TinkerPop
The example “Find Anakin, traverse to his son and then to his sister and
retrieve her name” would in Gremlin look like
g.V().has(’name’, ’Anakin’).out(’son’).out(’sister’).values(’name’)
2. V() – all the vertices of the graph. Another method that a Graph-
TraversalSource offers is E() – all the edges of the graph. Return type
of both V () and E() is a GraphTraversal containing many methods
returning GraphTraversal as well (so that the steps could be chained).
3. has(’name’, ’Anakin’) – filtering the vertices to get only those with prop-
erty ’name’ equal to ’Anakin’.
Each operation separated with a dot is called a step. Gremlin language pro-
vides a significant number of steps. For example map, filter, sideEffect,
toList, addE, aggregate, limit and many others, all thoroughly explained
in its Documentation [69].
Path An important step for this thesis is the path()-step. Added to the
sequence of steps, the path operation returns the whole path a traversal walked
when creating the query left of the path entry.
Extending the previous example of Anakin’s children with path brings the
following result:
g.V().has(’name’,’Anakin’)
.out(’son’).out(’sister’).values(’name’).path()
==> [v[1],v[2],v[3],Leia]
39
3. Technology
The path-step is enabled thanks to the Traverser in which all the objects
propagating through traversal are wrapped [69]. In other words, a traverser
keeps all the metadata about the traversal and these metadata can be accessed.
Note that the usage of the word path does not strictly correspond to rig-
orous graph theory. A path in graph theory is defined as follows (adjusted
according to Bondy and Murty [30])
The important part of the definition is the distinct edges and distinct
vertices. If this condition is loosened, and the sequence can contain more
occurrences of the same edge or vertex, we call such a sequence a walk [30].
The TinkerPop function path allows multiple incidences of a given element;
therefore, the function actually represents a walk, not a path.
In this text we are going to use the term path in conformity with the Tin-
kerPop framework to avoid any misunderstandings because in the majority of
cases we use the term referring to logging traversal paths with the function
path19 .
• Vertex Program
Section 2.2 introduced Pregel computational model developed to process
large-scale graphs. It is based on “vertex-centric” thinking when during
each iteration called the superstep each vertex executes a user-defined
function and sends messages to other vertices.
The VertexProgram is an implementation of such a “think like a ver-
tex” approach. Its method execute represents the function performed
19
TinkerPop framework also contains a simplePath function for filtering results contain-
ing only simple paths, that is, paths with distinct elements – so actually paths of the rigorous
graph theory.
40
3.2. Apache TinkerPop
• MapReduce
The MapReduce is an implementation of the standard MapReduce model
for big data processing. It comprises two main functions
41
3. Technology
In TinkerPop, the MapReduce is also applied for all the aggregating re-
quests of the VertexProgram; for this reason, it is a part of the Figure
3.8.
• Core API – contains all the definitions of a Graph, Vertex, Edge, etc.
which must be implemented by the providers.
42
Chapter 4
Analysis and Design
43
4. Analysis and Design
44
4.2. Extracted Data Storage
4.2.1 Storage
The extracted data produced by the Query Data Extraction part defined in
4.1 represent paths of graph traversals. Consequently, the nature of the data is
also a graph, with elements of the original graph. Moreover, it is also necessary
to know the whole topology of the original graph as the paths do not have to
include all the graph elements22 .
For this reason, the extracted data should be stored in the whole graph
as well-identified extra information of the original elements. As already men-
tioned in the previous section, two options of a connected graph database are
possible. Neither of these options prevents the storage of the extra data unless
they place substantial physical demands.
The specific product of a graph database will be chosen in the chapter
Implementation 5.
21
Note, that we use the term path in compliance with the TinkerPop framework as ex-
plained in section 3.2.1.2.
22
The fact that some elements were not a part of the logs does not mean that these
elements should be redistributed at random. They can be utilized in future queries, therefore,
for elements not logged yet, the graph structure should be taken into account.
45
4. Analysis and Design
Requirement Description
Functional Requirements
Traversal Monitoring It must be possible to monitor the traversed
elements (meaning a path) of an OLTP graph
traversal triggered by a user query.
Path Logging The monitored paths21 of individual traversals
are logged into a separate file.
Format Setting Supported format of logging can be set in a con-
figuration file.
Anonymization To enable logging from production databases,
the code should be prepared for an option of log-
ging an anonymized output.
Non-functional Requirements
TinkerPop Compliance As the number of TinkerPop-compliant graph
DBMSs is significant, the solution should be a
part of the TinkerPop framework in order to al-
low the data from any database supporting the
TinkerPop to be logged.
Extensibility It must be easy to add new features and cus-
tomize the implementation. For example, it
should be possible to easily implement and set
another type of format than provided.
Documentation The code of implementation should be properly
documented including a README file.
Licensing The additional implemented features must com-
ply with the source licensing (as the TinkerPop
Compliance is already stated, this means the
Apache License 2.0).
Table 4.1: Functional and non-functional requirements for the Query Data
Extraction
46
4.2. Extracted Data Storage
Requirement Description
Functional Requirements
Redistribution Based on extracted data of past graph traversals
and on provided distributed graph database, the
program can offer a more efficient distribution of
data.
Non-functional Requirements
General Framework The implementation should be aimed at a gen-
Preference eral framework rather than a specific product in
order to allow a wider range of databases to be
employed (in graph databases the general frame-
work is the TinkerPop). However, a particular
system will be chosen; therefore, vendor-specific
adjustments can be applied if necessary.
Interoperability The database connected to the GRM system
can either be a production database or another
database containing a graph of the same topol-
ogy with the same element IDs and partition
information. The graph database with such a
graph must always be provided.
Documentation The code of implementation should be properly
documented including a README file.
Table 4.2: Functional and non-functional requirements for the Graph Redis-
tribution Manager
4.2.2 Model
Section 3.2.1.2 presents the definition of a path-step23 . A path contains both
vertices and edges. As discussed at the beginning of this chapter, the factor
which we want to optimize to achieve better performance is the communication
between partitions. This means that the elements we are interested in are
edges. Note, that it is also possible to incorporate the information about
vertices. This is discussed in chapter 7 of possible enhancements, yet not
included in our implementation.
47
4. Analysis and Design
connects two vertices on different partitions. The more frequent traffic on the
edge, the more likely we want the edge vertices (and the edge) to be allocated
on the same partition. Accordingly, what we want to store is the information
of traffic on each edge, which means the sum of times each traversal walked
over the particular edge. Regarding the log file containing paths of traversals,
it is the number of occurrences of the edge in that log file. Let us denote this
number as a weight of an edge.
One way how to store the value of the weight is to create a property weight
for each edge with a default value, for instance, equal to 1. However, this ap-
proach presents a serious limitation. A graph database can contain a schema
which defines not only possible types of an edge but also a set of its permitted
properties. This means that in order to add a new property of weight for redis-
tribution purposes, the schema of all the edges would have to be altered (and
for each new edge type it would have to be ensured that the weight property
is added to its schema as well). If we wanted to remove the information for
the redistribution, all the original edges would have to be modified again. For
this reason, it is not the desired solution in the case of a configured production
database.
• on edges of type T
• Edge data stored as a part of vertex data – when an edge is stored as part
of vertex data such as in JanusGraph 3.1.1, it does not matter if each
edge is duplicated and its weight incremented or if there is one substitute
24
The chapter 7 contains a discussion of incorporating fading into the redistribution
algorithm. For such an enhancement, a property containing a timestamp would be necessary.
This work, however, does not include fading.
48
4.3. Architecture
for all of such edges. In both cases, all the edges are stored together, so
when a graph is redistributed, and vertices of the substituting edge are
allocated on different partitions, the separation concerns all of the edges
alike.
• Vertex data stored as a part of edge data – in the case of vertex infor-
mation kept within edge data (which is not implemented in any of the
analyzed databases), the redistribution algorithm would be more suit-
able if it was creating a vertex cut. With the application of vertex cuts,
the proposed model would be suitable with explanation analogous to the
first case of edge data stored as a part of vertex data.
With edge cuts, the model would still fit with the same explanation as
in the previous case of edge data stored separately from vertex data.
Nonetheless, again, there are no known databases storing the graph in
this representation, so this option is unlikely to occur.
It has been shown that the proposed model is correct in various graph
representations. Furthermore, with one edge containing minimum of data
and representing all the edges between two vertices, the extra physical space
necessary is not substantial. For these reasons, we choose this model to store
the logged data of traversal paths.
4.3 Architecture
The purpose of this section is to provide a high-level architecture perspective.
Individual details of some parts will be then presented in the following sections.
As it emerges from the analysis above, the whole system contains two separate
segments – the Query Data Extraction (also Logging in short) and the Graph
Redistribution Manager – which need to interact. This interaction is shown
49
4. Analysis and Design
in Figure 4.1. The parts that have to be implemented are highlighted with
blue color.
Following the non-functional requirements of the Query Data Extraction,
specifically the General Framework Preference, it is convenient to design this
part as a new module of the TinkerPop framework. This approach brings the
following advantages
50
4.4. Graph Redistribution Manager
Redistribution
Graph
Algorithm
Redistribution
Manager Evaluator
(GRM) Log
Client
Graph DB
<<module>>
TinkerPop
Logging
Redistribution
Graph
Algorithm
Redistribution
Manager Evaluator
(GRM) Log
Client
Graph DB
Graph DB
TinkerPop <<module>>
Logging
TinkerPop
Figure 4.1: Architecture design. Blue elements denote parts that have to be
implemented.
accepts log files, and communicates with a client and a graph database. It
also presents two crucial parts of the GRM, a redistribution algorithm and an
evaluator.
The evaluator is a piece of code that can assess a specific distribution
based on provided log files. Therefore, it is utilized for comparison of the
final proposed distribution and the original partitioning. It could also be used
when monitoring the progress of the redistribution algorithm.
The design of the primary process of the GRM – data loading, running
an algorithm and handling a result – is expounded in the activity diagram
4.2. The necessary conditions for a successful result (such as “log data with
an expected format”) are omitted.
The action Extract necessary data is examined in detail in the previous
51
4. Analysis and Design
no
Are
partition IDs no Store a partition ID
stored for all of each vertex
vertices?
yes
Figure 4.2: Activity diagram of the main process in the Graph Redistribution
Manager
section 4.2. The diamond of “Are partition IDs stored for all vertices?” and
its subsequent action “Store a partition ID of each vertex” is suitable for
both architecture designs of Figure 4.1 – a production database will store
information about the partition ID of each vertex while the image database
contains it as already defined. In the case of a production database this action
could seem unnecessary. Nonetheless, the explicit presence of partition ID as a
property of a vertex allows better performance of the ensuing algorithm – if the
redistribution algorithm had to always ask about a partition ID of each vertex,
it could slow down the algorithm as its retrieval can involve computational
steps, and this information is necessary very frequently. At the same time,
the demands for physical space of the extra property are negligible.
52
4.5. Algorithm Design
4.5.1 Balancing
Vaquero et al. constraints the label propagation with upper bound defined in
Equation 2.2. This equation ensures that the number of vertices assigned to
a partition never exceeds its capacity. Thus this constraint should be main-
tained.
Nonetheless, no lower bound is determined by the authors of Vaquero et
al. As mentioned, the original paper [39] onj which Vaquero k et al. bases,
l m
|V |
applies both lower and upper bound equal to (1 − f ) n and (1 + f ) |Vn | ,
with some fraction f ∈ [0; 1] and number of partitions n. With the usage of
|V |
n , this approach expects all the partitions to have an equal size. This does
not have to be the reality of course.
Therefore, we propose the lower bound for a partition P i as
Ci
(1 − f ) · |V | · P , (4.1)
Cj
j∈J
53
4. Analysis and Design
{0, 1}, and down to T = 0, that is b[0; 1] · 0 · (4 − 1)c = {0} – representing the
most frequent label and original approach of Vaquero et al.
54
4.5. Algorithm Design
The lower the temperature, the lower the probability of choosing a different
label. Accordingly, the proposed probability s of label adoption is
T
s=S+ · (1 − S), (4.3)
Tinit
where S is a constant corresponding to the resulting probability when the
temperature reaches 0. As already mentioned, S is equal to 0.5.
With this approach, at the beginning of the algorithm with T = Tinit , the
label is always accepted as s = 0.5+1·0.5 = 1. As the computation progresses,
the lowering temperature also lowers the probability of adoption, resulting in
T = 0, that is, the original s = 0.5 + 0 · 0.5 = 0.5.
We started with the comparison table 2.1 containing two advantages and
three disadvantages of the Vaquero et al. algorithm and three advantages and
two disadvantages of Ja-be-Ja method. Adjusting Vaquero et al. algorithm
with the proposed enhancements, we try to mitigate all the limitations from
the table – improving partition balancing, confronting local optima and incor-
porating weighted graphs. Chapter 6 will examine the effects of the proposed
parameters as well as an overall success rate of this modified algorithm.
55
Chapter 5
Implementation
This chapter presents the implementation part of this thesis that was designed
in previous chapter 4. Based on the technology described in chapter 3 it first
selects a specific graph database for the storage of extracted data. Subse-
quently, it introduces the implementation of the query data logging which is
accomplished as a module of the TinkerPop framework. Last but not least,
the inner structure of Graph Redistribution Manager is explained.
57
5. Implementation
• local mode – when the client operates in the same Java Virtual Ma-
chine (JVM) as the JanusGraph, the logging is performed as part of
the TinkerPop implementation of JanusGraph. This is shown in Figure
5.1a. In order to enable the logging functionality, the client code must
explicitly call the logging strategy.
58
5.2. Query Data Extraction
Log Log
• pom.xml – the only adjusted line adds the logging module as part of
the whole TinkerPop project
<module>proceesedResultLogging-gremlin</module>
25
POM stands for Project Object Model. pom.xml files contain configuration and other
information about a Maven project.
59
5. Implementation
• gremlin-server/(...)/AbstractEvalOpProcessor.java – processing
operations dealing with script evaluation functions, the AbstractEval-
OpProcessor contains decisions whether to trigger additional operations
based on settings from the configuration file. Therefore, the following
condition has been added
if(settings.processedResultLog.enabled){
ProcessedResultManager.Instance(settings.processedResultLog)
.log(script, itty);
}
60
5.2. Query Data Extraction
The description for users and developers of how to use the logging module
(for example how to use different options of settings or how to implement
a new extension) is provided in the README file available either on the
mentioned GitHub page [75] or as a part of the Appendix A.1, thus narrowing
the explanation in this section solely to code description.
The TinkerPop project incorporates the Apache Rat Plugin [77] (the Re-
lease Audit Tool) which prohibits a successful compilation unless the whole
code is provided with the required copyright policy. For this reason, each new
file of the logging module begins with a disclaimer of licensing the file under
the Apache License, Version 2.0.
61
5. Implementation
62
5.2. Query Data Extraction
4. It iterates over the altered traversal, that is, over the elements of the
walked paths, and creates the final result out of them.
5.2.2.4 Formatter
The ProcessedResultFormatter serves for formatting a ProcessedResult
into the final log string. Therefore, the interface ProcessedResultFormatter
declares a method format, with parameters of a ProcessedResult and a
String representing the original query of the result. The concrete implemen-
tation of the ProcessedResultFormatter can but does not have to use the
query in its output.
Presently, three formats are available
• Basic Formatter – the basic formatter logs only the result in its orig-
inal form (using the method toString of the ProcessedResult).
• Query Formatter – logs both the query and the result, unchanged, as
#QUERY:
g.V(1).outE(’knows’).inV().values(’name’)
#PR:
28
JSON stands for JavaScript Object Notation.
63
5. Implementation
v[1],e[7][1-knows->2],v[2],vadas
v[1],e[8][1-knows->4],v[4],josh
• JSON Formatter – logs the data in JSON format. Its output can look
like
{
Q:"g.V(1).outE(’knows’).inV().values(’name’)",
R:[
[{"v":1},{"e":7},{"v":2},{"string":"vadas"}],
[{"v":1},{"e":8},{"v":4},{"string":"josh"}]
]
}
For that purpose the JsonFormatter uses the open-source GSON library
by Google [78]. This is also the reason why the ProcessedResult must
implement the function serialize of JsonSerializer.
5.2.2.5 Helpers
Two helper classes have been created in order to make the code well arranged
and their functionalities reusable.
64
5.3. Graph Redistribution Manager
5.3.1 GRM.java
For evaluation purposes of chapter 6, two datasets are applied. This usage
of two datasets, both of which need several specific adjustments, lead to an
explicit division of the main class GRM into two classes GRMT and GRMP for
Twitter and Pennsylvania road map dataset, respectively. Consequently, the
GRM is an abstract class containing shared functionalities for the two subclasses
such as connecting to or injecting data into the graph.
This structure is very convenient for the current extent of the program
with the necessity of a significant number of executions of a given dataset
but if more datasets were about to be utilized, the GRM would be a subject of
refactoring.
65
5. Implementation
5.3.2 LogHandling
The package logHandling contains tools for manipulation with the log that
was generated by the Logging module. The classes could be categorized ac-
cording to two objectives
• loaders – serve for loading the data from a log file and for subsequential
storage of these data in the graph database.
The LogFileLoader loads a log file with an iterator that iterates over
individual records, each containing paths produced by one traversal. An-
other loader, PRLogToGraphLoader is then implemented to store these
results in the graph database. The PRLogToGraphLoader is a general
interface that is implemented in DefaultPRLogToGraphLoader realizing
the model of extracted data storage designed in 4.2.2.
66
5.3. Graph Redistribution Manager
5.3.3 Dataset
The dataset package includes the functionality for loading the datasets, cre-
ating their query and running them in order to generate the log files. The
interfaces DatasetLoader and DatasetQueryRunner are introduced with spe-
cific implementations for the particular datasets.
5.3.4 Cluster
Each vertex must possess the information about its original partition ID. This
explicit property (as discussed in 4.4) can either be already provided in the
database or has to be yet added. The interface PartitionMapper serves for
this purpose, offering a mapping function for partition ID retrieval.
In the evaluation part we mimic the real distributed environment as the
only information we need from it is the partition ID of each vertex. As the
datasets already contain consecutive IDs of its elements, we take these IDs and
return modulo number-of-nodes-in-cluster as their partition ID. This opera-
tion is provided in DefaultPartitionMapper implementing the Partition-
Mapper interface. The discussion of how to obtain the real values of partition
IDs in a genuine distributed graph database is provided at the end of this
chapter in section 5.3.8.
67
5. Implementation
5.3.6 Helpers
The helpers package contains two helper classes. The HelperOperators
class implements the BinaryOperator interface, defining binary operators for
reduction of the data in the VaqueroVertexProgram.
The second class ShuffleComparator implements the Comparator inter-
face. It is utilized only in the Road network dataset. Specifically, it is used
for traversal shuffling when implementing a random walk on the graph.
5.3.7 Resources
The file config.properties serves for setting the graph.propFile property.
It should contain the name of a file with the specific backend properties.
Presently, two options are available: graph-cassandra-embedded.proper-
ties and graph-berkeley-embedded.properties. These specific property
files contain standard properties of the corresponding backend storages for
the JanusGraph. In the case of Cassandra backend usage, the JanusGraph
further supplies the Cassandra with its configuration file cassandra.yaml.
The directory datasets contains the original data [80, 81]. In both cases,
the data are provided as a set of pairs, each pair representing an edge with an
outgoing and an incoming vertex, respectively.
68
5.3. Graph Redistribution Manager
Note, that the PARTITION part of the ID is at the beginning of the ID,
which means it has the most significant vote in the lexicographic ordering. As
a result, it affects the final partition of the record most substantially.
The layout above has been, however, changed, now having this form
With this change, the ability to manipulate the ordering was lost because the
PARTITION part of the ID has now a lesser vote in the ordering and the
COUNT part cannot be modified.
The current JanusGraph documentation presents a whole chapter on how
to implement the explicit partitioning [83]. However, after the layout change,
the content of this chapter is no longer valid.
69
Chapter 6
Evaluation
This chapter presents the evaluation of the proposed enhancements of the Va-
quero et al. algorithm introduced in 4.5. In order to do so, the implementation
of 5 has been carried out, available on the GitHub web page [75, 79].
First, the applied datasets are introduced together with user queries that
have been generated for them. Subsequently, the evaluation methods are
presented followed with settings description and finally the results themselves.
At the end of the chapter a summary comparing our proposed method with
another described Pregel-like algorithm, Ja-be-Ja, is provided.
6.1 Datasets
In order to examine the implemented program, two different datasets were
utilized. They vary significantly in their characteristics, and both represent
real-world problems. First, data of Twitter [80], a social network for posting
and reading messages were examined. For the second case, the road network
of Pennsylvania [81] was selected.
For each dataset, its number of nodes, edges, average clustering coefficient,
and diameter is provided. A clustering coefficient of a vertex expresses connec-
tivity of its neighbors (equal to 1 when forming a clique31 with its neighbors,
equal to 0 if none of its neighbors are connected). A diameter of a graph is
the maximum eccentricity32 of its vertices.
71
6. Evaluation
tices and 817,090 edges. Their Twitter dataset contains only 2,731 entities
and 164,629 relationships.
Our implementation enables partition allocation mimicking (as described
in 5.3.4), so it also allows datasets of nearly any size to meet capabilities of
our physical sources without any bearing on the quality of results. We decided
for datasets containing 76,268 vertices with 1,768,149 edges (Twitter dataset)
and 1,088,092 vertices with 1,541,898 edges (Pennsylvania road map dataset).
For both of the datasets (as well as for the majority of generally available
datasets), there do not exist any attached queries. Authors of papers usually
create artificial logs, use only structure of the graph (either without weights or
with artificially generated weights) or do not state in any way how they obtain
the initial state on which they base their computations. We define the behavior
of a typical user for each dataset according to which we generate corresponding
queries. These emulated queries are then executed in the JanusGraph with
the new TinkerPop module which triggers the logging extension producing
query logs.
For the social network dataset we create |V |/8 ≈ 9, 500 queries, and for
the road map dataset, we generate a comparable number of |V |/100 ≈ 10, 000
queries.
Both datasets are described in more detail below together with their access
patterns applied for the generated queries.
6.1.1 Twitter
The Twitter dataset is obtained from [80] gathered by crawling the public
sources. Only files with the graph structure were utilized, ignoring the data
with actual user data (that is, properties of nodes).
The dataset represents data of the Twitter social network where users
“tweet” – post short messages called “tweets” – and read these posts from
other users. A user can “follow” other users so that their messages would
appear to the user when signed in the application. The relationship is not
reciprocal, meaning a user does not have to follow the user who follows him.
In other words, a node represents a user, an out-going edge is a relation
of “follows” and an in-coming edge means an “is being followed” relationship.
The dataset statistics are stated in Table 6.1.
Graph 6.1 contains the information about distribution of vertex degrees –
overall degrees, in-degrees and out-degrees. Note, that the y-axis has a log
scale. The majority of vertices has a lower degree, but there also exist individ-
ual nodes with a very high degree. The number of vertices grows exponentially
with a lower degree. This power-law behavior33 of degree distribution is called
33
Power law is a relationship in which one variable varies as a power of another variable.
72
6.1. Datasets
Property Value
Nodes 76,268
Edges 1,768,149
Average clustering coefficient 0.5653
Diameter (longest shortest path) 7
the scale-free network and is common for social networks, World Wide Web
network or airline systems [84].
6.1.1.1 Queries
For the first dataset of the Twitter social network, two access patterns have
been devised.
• A typical Twitter user signs in the application and reads posts of people
he or she follows. This basic and probably the most frequent behavior
could be expressed as selection of a vertex and traversing all of its out-
going neighbors. In other words, the breadth-first search34 uncovering
the first layer of nodes on out-going edges.
• This basic behavior is extended with another type of user action – search-
ing for new people to follow. To improve the probability of finding rele-
vant users, the search is defined as looking for people who are followed
by people being followed by the user. For instance, if Luke Skywalker
followed Obi-Wan Kenobi who followed user Yoda it would be likely that
Luke also wants to follow Yoda.
where r is a random number from [0; 1], max is a function returning the
maximum value from the set, out degree is a function returning an out-degree
of the provided vertex and max out degree is a maximum out-degree present
in the graph. The idea is that users who do not follow larger number of people,
34
The breadth-first search is a graph traversal method during which a starting vertex is
selected, and then the graph is explored “layerwise” – uncovering all the neighbor vertices
in layer 1, after that uncovering all neighbors of that neighbors in layer 2, et cetera.
73
6. Evaluation
in-degree
1000
100
10
1
0 500 1000 1500 2000 2500 3000 3500
Degree
out-degree
1000
100
10
1
0 500 1000 1500 2000 2500 3000 3500
Degree
74
6.1. Datasets
Property Value
Nodes 1,088,092
Edges 1,541,898
Average clustering coefficient 0.0465
Diameter (longest shortest path) 786
6.1.2.1 Queries
One of the first ideas of a typical user behavior on a road map could be finding
the shortest path between two points. The general task of the shortest path,
however, is an OLAP query for which the logging module is not intended as
explained in section 4.1. Therefore, a modified behavior has been created. A
user searches for the shortest path between two points of maximal distance
equal to 10.
75
6. Evaluation
35
Note, that it is also possible to create an OLTP type of query that finds the shortest
path within the whole graph. However, the task is so demanding that the execution crashes
on lack of resources.
76
6.2. Evaluation Methods
6.2.1 Factors
• Cooling Factor – a temperature of the simulated annealing is used as
presented in equations 4.2 and 4.3. It means that the temperature is
always applied in a fraction, therefore, its initial value does not matter.
The cooling factor, however, used for cooling the temperature Tnew =
Tinit × coolingF actoriteration , influences the speed of the cooling process
which has a crucial effect on getting trapped in a local optimum.
• Imbalance Factor – the equation 2.2 of a lower constraint introduces
an imbalance factor f . It determines how much percent of the propor-
tionally assigned number of vertices a node can be undersized. This
also means that, for example, with imbalance factor of 10% and three
identical physical nodes, it is possible, that two nodes are undersized to
10%, thus the third node being oversized to 20%. The capacity of the
nodes is always set in the way that the upper bound of the capacity of
a node does not restrict the migration – in the previous example, it is
always allowed to oversize the node to 20%.
• Adoption Factor – the equation 4.3 proposed a new probability of
adoption incorporating temperature into its computation. The equation
can be written as
T
s=S+a· · (1 − S),
Tinit
where the a denotes an adoption factor. When set to 0, the equation
equals back the original s = 0.5. When equal to 1, the proposed equation
holds. A middle value of a = 21 is examined as well.
6.2.2 Effects
• Improvement – as discussed in 4.2, we measure the performance ac-
cording to network communication, that is, the number of crosses be-
tween physical nodes a traversal has to make in order to process a query.
For this reason, we count the improvement as a percentage value of
number of crossings after the redistribution
1− .
number of crossings before the redistribution
The measurement is done on queries that have been used as an input
log for the redistribution.
77
6. Evaluation
6.3 Settings
Partition IDs For the measurement purposes our cluster contains three
nodes of equal sizes by default. Emulating our environment, we do not store
the data on three physical nodes in reality, but we assign the partition IDs
artificially. We take advantage of the provided data with already assigned
consecutive vertex IDs and use a modulo function to distribute them initially.
78
6.4. Results
We used the JanusGraph version 0.3.0 with TinkerPop version 3.3.3. For
the backend storage, we operated both with Cassandra, version 2.1.20 and
Oracle Berkeley DB, version 7.4.5 (the backend storage does not influence our
results). All these product versions are provided natively with JanusGraph
distribution.
6.4 Results
For each of the examined values, we performed ten measurements in the case
of the Twitter dataset and four measurements in the case of the Road net-
work dataset. There are two reasons for this difference – first, the Road map
contains about fourteen times more nodes than the Twitter dataset, therefore,
the computation is much slower. Second, thanks to the nature of the Road
network data (discussed below) the standard deviation between its results is
much lower, meaning that more repetitions do not bring much added value.
Complete results with all the graphs and tables are available in the Ap-
pendix B. More detailed data are also provided on the attached medium of
this work. In this section, we mainly discuss individual effects and depict
graphs containing meaningful behavior. The text is structured according to
the particular factors introduced in 6.2.1.
79
6. Evaluation
50
40
30
20
10 0.95 0.97 0.99 0.999
0.96 0.98 0.995
0
0 20 40 60 80 100 120 140 160 180 200
Number of iterations
On the other hand, from the Figure 6.4 it seems that the dependency
of number of iterations on the cooling factor is independent on the graph
structure. The number of iterations always grows with the value of the cooling
factor exponentially.
Taking into consideration the dependency on communication improvement
and the number of iterations, in both cases the cooling factor of 0.99% pro-
duces very good results regarding cross-node communication, and its number
of iterations is still of a reasonable value. That is why this value has been
chosen for further experiments.
80
6.4. Results
Effect of cooling factor on cross-node communication Effect of cooling factor on number of iterations
80 200
75 max
180
avg
70 160 min
Number of iterations
Improvement (%)
65
140
60
120
55
100
50
80
45
40 max 60
avg
35 min 40
30 20
0.95 0.96 0.97 0.98 0.99 0.995 1 0.95 0.96 0.97 0.98 0.99 0.995 1
Cooling factor Cooling factor
75 140
120
74
100
73 80
60
72
40
71 20
0.95 0.96 0.97 0.98 0.99 0.995 1 0.95 0.96 0.97 0.98 0.99 0.995 1
Cooling factor Cooling factor
during which the very slight imbalance of the initial distribution is evened up
and no further migrations are allowed.
In the Road network dataset, the improvement grows with higher imbal-
ance allowed. This behavior can be expected, because the higher the imbalance
permitted, the more relevant data together on one cluster, which means the
lower the necessary communication.
The high improvement even with very small imbalance factor of 1% could
be rather unanticipated. With this value, the improvement of cross-node
communication is still tightly around 75.5%. The reason is most probably the
fact that with 1,088,092 vertices, the 1% of allowed underloading on a physical
node is equal to 3, 627 vertices. That is still quite a generous space, evidently
large enough for the necessary migration.
In the Twitter dataset, the behavior in the interval of [0.05;0.5] has the
same characteristic as in the Road map graph. However, the small values of
the imbalance factor perform unanticipated conduct, receiving slightly bet-
ter results with even lower values. We explain this behavior as a potential
81
6. Evaluation
Effect of imbalance factor on cross-node communication Effect of imbalance factor on number of iterations
90 120
80
100
70
Number of iterations
Improvement (%)
60 80
50
60
40
30 40
20 max max
avg 20 avg
10
min min
0 0
0 0.05 0.1 0.15 0.2 0.3 0.4 0.5 0 0.05 0.1 0.15 0.2 0.3 0.4 0.5
Imbalance factor Imbalance factor
60
50
50
40
40
30
30
20 20
max max
avg 10 avg
10
min min
0 0
0 0.05 0.1 0.15 0.2 0.3 0.4 0.5 0 0.05 0.1 0.15 0.2 0.3 0.4 0.5
Imbalance factor Imbalance factor
100
80
60
40
20
0
-20
-40
-60
0 0.01 0.02 0.03 0.04 0.05 0.1 0.15 0.2 0.3 0.4 0.5
Imbalance factor
node 1 node 2 node 3
82
6.4. Results
• The higher the imbalance allowed, the higher the migration of vertices
to one physical node. Accordingly, with a lower factor, the vertices tend
to move more within the nodes, back and forth, creating better local
solutions per node. That can be convenient for the given queries that
are defined as very local with a maximum diameter of the length 3.
• From the figure 6.5a we can see that the lower the factor in the given
interval [0.01;0.05] the roughly higher the number of iterations. Com-
monly, with a higher number of iterations, the results evince better im-
provements because more potential redistributions have been performed.
• The number of executed runs can be insufficient, the lower values of the
factor had several better performing runs in a row above their actual
average.
The effect of the imbalance factor on the number of iterations does not
seem to be significant. In the Twitter dataset, the number of iterations slightly
grow with higher imbalance factor as it takes a longer time to migrate more
vertices to one node. In the Road network dataset, all the iterations are within
the range 70 − 73 for all the examined values of imbalance factor.
While the other analyzed factors do not tend to influence the capacity
usage of the nodes in the cluster, the imbalance factor has, of course, an effect
on it. The data always tend to maximally use the allowed space and reorganize
themselves mainly on one cluster, underloading the other nodes as much as
permitted. It seems reasonable to take advantage of the capacity available.
On the other hand, the final result can be in total imbalanced – even more
with the higher the imbalanced factor or, the higher the number of nodes in
a cluster.
83
6. Evaluation
Effect of adoption factor on cross-node communication Effect of adoption factor on number of iterations
80 105
max
100 avg
75 min
Number of iterations
95
Improvement (%)
70 90
65 85
80
60
75
max avg min
55 70
0 0.5 1 0 0.5 1
Adoption factor Adoption factor
95
Improvement (%)
74
90
72
85
70
80
max
68 avg 75
min
66 70
0 0.5 1 0 0.5 1
Adoption factor Adoption factor
because it did not reject so many labels from the beginning of the process as
the value 0. On the contrary, in the Road network dataset, the number of
iterations for these values equals, while the improvement is better in the case
of adoption factor set to 1.
The middle value of 0.5 then also behaves differently. While in the Twitter
dataset it has the worse improvement with the middle average value of the
number of iterations, in the Road network dataset it has the best improvement
but with the cost of the much higher number of iterations.
Nevertheless, in both the datasets, it seems that the best value to apply is
1 (regarding the improvement and the number of iterations, combined), but
the behavior should always be examined for each dataset separately.
84
6.4. Results
Cross-node communication with different # of nodes in cluster Number of iterations with different number of nodes in cluster
82 200
80 max
180
avg
78 160 min
Number of iterations
Improvement (%)
76
140
74
120
72
100
70
80
68
66 60
64 40
max avg min
62 20
2 3 4 5 6 7 2 3 4 5 6 7
Number of nodes in cluster Number of nodes in cluster
78
80
76
70
74
60
72
70 50
68 40
66 30
2 3 4 5 6 7 2 3 4 5 6 7
Number of nodes in cluster Number of nodes in cluster
iterations with the higher number of nodes in the cluster as it takes a longer
time to migrate the vertices to suitable nodes.
The average improvement in the Twitter dataset stays within the range of
[70; 77] with all the examined number of nodes. The topology of small amount
of vertices with very high degree and substantial number of vertices with very
low degree allow such reorganization within the nodes of cluster.
85
6. Evaluation
6.5 Summary
With the enhanced Vaquero et al. algorithm proposed in 4.5 it is possible to
create results of high communication improvement and of a reasonable balance
in very satisfactory time. The table 6.3 sums up the most important results
of the evaluation.
Even with small imbalance values of 1–10% the cross-node communication
can be improved up to 70–80%. The necessary number of iterations for the
algorithm in such case moves around 80–85 or 72 depending on the dataset.
The Ja-be-Ja algorithm claims to produce the same improvement of 70–
80% with four hosts in the cluster. We did our measurements mainly on three
hosts, but in our Twitter dataset, the four hosts caused even better results
than the three hosts – the improvement increased by 2.5% (with the cost of
50 extra iterations). In the Road network dataset the results decreased by 4%
(still > 70%) in improvement and increased by 11 iterations on average.
The Ja-be-Ja result is always balanced but the necessary number of iter-
ations for the Twitter set containing only 2,731 vertices, and 164,629 edges is
350. Moreover, one iteration in Ja-be-Ja is more computationally demanding
and with much higher communication overhead. Furthermore, the variance in
the improvement of proposed results with the same setting can be significant;
therefore, in order to obtain the best solution possible, more executions of the
algorithm should be performed. It is highly probable that this is the case of
Ja-be-Ja algorithm as well.
We can conclude that we have an algorithm creating comparable improve-
ments of cross-node communication to another well-known method yet with
extensively better computational and communication demands. On the other
hand, it is necessary to allow an imbalance of nodes in the cluster, prevent-
ing the redistribution from providing a hundred percent balanced solution.
However, even small and acceptable imbalances produce great commensurate
results.
86
6.5. Summary
Table 6.3: The most significant results of the evaluation. Unless stated differ-
ently, the factors were set as: coolingF actor = 0.99, imbalanceF actor = 0.1,
adoptionF actor = 1, numberOf N odes = 3.
87
Chapter 7
Enhancements
The implementation output of this work contains several parts which could
be further enhanced or experimented with. In this short chapter, we propose
some of these improvements, but the real possibilities are certainly far more
abundant.
• data preprocessing – the GRM reads log files containing individual paths
of traversals. The resulting weight on a newly added edge between two
vertices then represents the number of occurrences of the real edges
between these vertices in the log file (more details can be found in 4.2.2).
Therefore, rather then always incrementing the weight by one while
89
7. Enhancements
• best result selection – the GRM could be extended with the possibility
of running several executions while storing each result separately. Later,
the best solution could be selected and applied.
7.3 Algorithm
The adjusted Vaquero et al. algorithm could be further modified in several
areas
• replicas – the notion of replicas has been omitted in this work. Their
introduction would bring new possibilities to the repartitioning task,
which would have to be incorporated in the algorithm as well.
• fading – a trend of the database usage can change over time. It means
that during the computation of a redistribution algorithm, the most
recently utilized connections should be preferred over the older ones.
The information about the last update on the edges could be used for
such algorithm modification.
• vertex weight – until now only edges contain the property of weight
because the task was defined as a minimalization of edge-cuts, that is,
the optimization of cross-node communication. The problem could also
be extended with a simultaneous balancing of physical node access. That
would require the introduction of vertex weight as a user can access the
node asking only about one vertex as well.
90
7.4. Experiments
7.4 Experiments
Apart from the possible inner modifications of current implementation, more
experiments should be performed. It would be beneficial to run both the
adjusted Vaquero et al. algorithm and Ja-be-Ja method on identical data
and with the same environment setting. Comparison of the number of it-
erations, time requirements on an iteration and other characteristics would
provide more detailed information about the real benefits and limitations of
one method over the other.
Further analysis and implementation of more redistributing algorithms
could be encountered, followed by subsequent comparison with the other al-
ready implemented solutions.
Last but not least, more datasets of various sizes and topologies should be
used to examine and compare the methods.
91
Conclusion
The main goal of this master thesis was an analysis of queries executed in
distributed graph databases. First, the current practices of data storage in
distributed graph databases were researched with focus on open-source prod-
ucts. Afterwards, we analyzed how to extract the necessary information for
further query analysis and implemented this solution as a new module of
the general graph computing framework TinkerPop [64]. As a target graph
database for storage of that extracted data, the JanusGraph [86] was chosen.
A new implementation providing the storage of the data in the database was
performed. It also offers a redistribution algorithm producing a more efficient
solution for data distribution in the database.
The implementation part of this work has two separate outputs. The new
TinkerPop module for logging purposes has been designed in the way that it
could be applied both as a silent server logger set in server configuration or as
an explicitly called logger during query creation. The module is written with
the usage of several interfaces, which makes it easily extensible either with
new formats of the logged data or with new functions applied on the result
of a query. The currently supported operation run on the query result is a
path-step returning all the paths that have been traversed in order to resolve
a query. The anonymization of the data is available as well.
The other implementation part is a proof of concept, provisionally called
the Graph Redistribution Manager. It can load and store datasets for eval-
uation purposes together with the generation and execution of their defined
queries. With the application of the new module, the queries produce log files
that serve as an input for the primary functionality of the Graph Redistribu-
tion Manager. First, the log files are loaded in the database in a simplified
form of newly added weighted edges. Second, a partition ID is stored for
each vertex simulating the physical node of a cluster on which the vertex
is located. Finally, a redistribution algorithm is executed, resulting in a pro-
posal of more efficient data distribution regarding the communication between
physical hosts.
93
Conclusion
94
Bibliography
[2] Berg, K. L.; Seymour, T.; et al. History of Databases. International Jour-
nal of Management & Information Systems, volume 17, no. 1, 2013: pp.
29–35, doi:10.19030/ijmis.v17i1.7587.
[5] Codd, E. F. A Relational Model of Data for Large Shared Data Banks.
Communications of the ACM, volume 13, no. 6, June 1970: pp. 377–387,
doi:10.1145/362384.362685.
95
Bibliography
96
Bibliography
[19] Ferreira, C. E.; Martin, A.; et al. The node capacitated graph partitioning
problem: A computational study. Mathematical Programming, volume 81,
no. 2, January 1998: pp. 229–256, doi:10.1007/BF01581107.
[24] Karypis, G.; Kumar, V. A Fast and High Quality Multilevel Scheme for
Partitioning Irregular Graphs. SIAM Journal on Scientific Computing,
volume 20, no. 1, 1998: pp. 359–392, doi:10.1.1.39.3415.
[28] Rahimian, F.; Payberah, A. H.; et al. A Distributed Algorithm for Large-
Scale Graph Partitioning. ACM Transactions on Autonomous and Adap-
tive Systems, volume 10, no. 2, June 2015: pp. 1–24, doi:10.1145/2714568.
97
Bibliography
[33] Tashkova, K.; Korošec, P.; et al. A distributed multilevel ant–colony al-
gorithm for the multi–way graph partitioning. International Journal of
Bio–Inspired Computation, volume 3, no. 5, January 2011: pp. 286–296,
doi:10.1504/IJBIC.2011.042257.
[35] Malewicz, G.; Austern, M. H.; et al. Pregel: A System for Large-Scale
Graph Processing. In Proceedings of the 2010 ACM SIGMOD Interna-
tional Conference on Management of data, Indianapolis, Indiana, USA,
2010, pp. 135–146, doi:10.1145/1807167.1807184.
[37] Vaquero, L. M.; Cuadrado, F.; et al. Adaptive Partitioning for Large-
Scale Dynamic Graphs. In 2014 IEEE 34th International Conference on
Distributed Computing Systems, Madrid, Spain, 2014, pp. 144–153, doi:
10.1109/ICDCS.2014.23.
[38] Raghavan, U. N.; Albert, R.; et al. Near linear time algorithm to de-
tect community structures in large-scale networks. Physical Review E,
volume 76, no. 3, October 2007, doi:10.1103/PhysRevE.76.036106.
98
Bibliography
[46] Google, Inc. Cloud Bigtable [online]. [Accessed 23 September 2018]. Avail-
able from: https://cloud.google.com/bigtable/
99
Bibliography
[59] Dgraph Labs, Inc. Dgraph [online]. GitHub repository, [Accessed 07 Oc-
tober 2018]. Available from: https://github.com/dgraph-io/dgraph
100
Bibliography
[67] The Apache Software Foundation. Apache License [online]. January 2014,
[Accessed 25 August 2018]. Available from: http://www.apache.org/
licenses/LICENSE-2.0
101
Bibliography
[77] The Apache Software Foundation. The Rat Maven Plugin [online]. [Ac-
cessed 24 December 2018]. Available from: http://creadur.apache.org/
rat/apache-rat-plugin/
[80] McAuley, J.; Leskovec, J. Learning to discover social circles in ego net-
works. In Advances in Neural Information Processing Systems, 2012, [Ac-
cessed 1 October 2018]. Available from: https://snap.stanford.edu/
data/ego-Twitter.html
[81] Leskovec, J.; Lang, K.; et al. Community Structure in Large Networks:
Natural Cluster Sizes and the Absence of Large Well-Defined Clusters. In-
ternet Mathematics, volume 6, no. 1, 2009: pp. 29–123, [Accessed 1 Octo-
ber 2018]. Available from: https://snap.stanford.edu/data/roadNet-
PA.html
102
Bibliography
from: https://groups.google.com/forum/?fbclid=IwAR15q5tw9y_
BvsSZigLueT5KHY5Y07aiTmUTnX-ons0hsXzkvoa7b7ZyBIs#!topic/
gremlin-users/rhIhEY9R4E0
103
Appendix A
README
105
A. README
• PathProcessor
– org.apache.tinkerpop.processedResultLogging.processor
.PathProcessor
– supports anonymized logging
• basic
– org.apache.tinkerpop.processedResultLogging.formatter
.BasicProcessedResultFormatter
– is compatible with anonymized logging
• query
– org.apache.tinkerpop.processedResultLogging.formatter
.QueryProcessedResultFormatter
– is not yet compatible with anonymized logging
Settings
In order to set a processed result logging, corresponding options must be set
in a configuration.
106
A.1. Processed Result Logging
Example
Settings for Processed Result Logging with the PathProcessor and the Query-
Formatter can, for example, look as follows
107
A. README
processedResultLog: {
enabled: true
processor: org.apache.tinkerpop.processedResultLogging.processor.
PathProcessor
formatter: org.apache.tinkerpop.processedResultLogging.formatter.
QueryProcessedResultFormatter
}
Processor property does not have to be mentioned in this case as the Path-
Processor is a default value. For an anonymized property we used false value
(by default).
Processors
PathProcessor
anonymized
Formatters
BasicProcessedResultFormatter
Basic formatter is logging only a processed result without any other piece of
information.
108
A.1. Processed Result Logging
QueryProcessedResultFormatter
Query formatter first logs the query and then its processed results. In order
to determine the two types of information, query is preceded with #QUERY:
line and the set of processed results is preceded with #PR: line. This format
is not yet compatible with anonymized logging.
LLOJsonFormatter
LLO JSON formatter logs the query and its processed results in a JSON
format. This formatter is implemented to work with PathProcessor which
returns LLOProcessedResult . The serialization to JSON is implemented in
LLOProcessedResult.Serializer and will work with Gson library. This for-
mat is not compatible with anonymized logging.
For Developers
New extensions of Processed Result Logging are welcomed, but please fol-
low the rules below.
109
A. README
processor
formatter
If you want to create a new formatter, create a class called <formatter-name>
Formatter which implements the interface ProcessedResultFormatter
and locate it within formatter package.
110
A.2. Graph Redistribution Manager
VaqueroVertexProgram
VaqueroVertexProgram is the Vaquero et al. [37] algorithm implemented in
the TinkerPop VertexProgram framework which is bases on Pregel com-
putation system. Therefore, the VaqueroVertexProgram works in iterations.
After initial setup, the execute method is ran for each vertex of the graph.
These iterations are ran in parallel manner, which also means that after each
iteration, there is a synchronization barrier and the terminate method is
called. The terminate method determines whether the algorithm should
continue into the next iteration or whether the program should halt. After the
end of the execution, each vertex is assigned a new partition ID which can
be accessed via the vertex.value(PARTITION) method. The PARTITION
is a constant with the key of the property of the new partition ID.
Iteration process
In each iteration, vertices communicate with each other via messages. Every
vertex sends its partition ID (PID) to all of its neighbors. A new partition ID
of the vertex is determined by the frequency of PIDs of the vertex neighbors.
The more frequently the PID is represented among the neighbors, the higher
the chance that it will be acquired. However, there are more conditions which
determine whether the new PID will be acquired. One of them is the current
balance of the partitions. The imbalanceFactor sets the lower bound of
how much the partitions can be imbalanced regarding a proportional vertex
distribution. The upper bound of each partition is determined by its maximum
111
A. README
Datasets
The current implementation supports two datasets for testing the Vaquero et
al. algorithm.
vertexProgram = VaqueroVertexProgram.build()
.clusterMapper(cm)
.acquirePartitionProbability(0.5)
.imbalanceFactor(0.80)
.coolingFactor(0.99)
.adoptionFactor(1)
.evaluatingMap(runner.evaluatingMap())
.evaluateCrossCommunication(true)
.scopeIncidentTraversal(__.outE())
.evaluatingStatsOriginal(runner.evaluatingStats())
.maxPartitionChangeRatio(1)
.maxIterations(200)
.create(graph);
algorithmResult = graph.compute().program(vertexProgram).workers(12)
.submit().get();
112
A.2. Graph Redistribution Manager
Configuration
113
A. README
Project structure
logHandling
dataset
cluster
114
A.2. Graph Redistribution Manager
helpers
GRMP
Executable class that runs the complete ”benchmark” of the Pennsylvania
road network dataset.
GRMT
Executable class that runs the complete ”benchmark” of the Twitter net-
work dataset.
GRM
The base class of the GRMP and the GRMT , containing shared compo-
nents and resources.
115
Appendix B
Evaluation Results
50
40
30
20
10 0.95 0.97 0.99 0.999
0.96 0.98 0.995
0
0 20 40 60 80 100 120 140 160 180 200
Number of iterations
117
B. Evaluation Results
Effect of cooling factor on cross-node communication Effect of cooling factor on number of iterations
80 200
75 max
180
avg
70 160 min
Number of iterations
Improvement (%)
65
140
60
120
55
100
50
80
45
40 max 60
avg
35 min 40
30 20
0.95 0.96 0.97 0.98 0.99 0.995 1 0.95 0.96 0.97 0.98 0.99 0.995 1
Cooling factor Cooling factor
25
20
15
10
5
0
-5
-10
-15
0.95 0.96 0.97 0.98 0.99 0.995 0.999
Cooling factor
node 1 node 2 node 3
118
B.1. Twitter Dataset
Table B.3: Effect of cooling factor on capacity usage. The average number of
|V |
vertices per node, |N | , is equal to approximately 25, 423. The results are based
on ten individual measurements for each factor value, on the Twitter dataset.
119
B. Evaluation Results
Effect of imbalance factor on cross-node communication Effect of imbalance factor on number of iterations
90 120
80
100
70
Number of iterations
Improvement (%)
60 80
50
60
40
30 40
20 max max
avg 20 avg
10
min min
0 0
0 0.05 0.1 0.15 0.2 0.3 0.4 0.5 0 0.05 0.1 0.15 0.2 0.3 0.4 0.5
Imbalance factor Imbalance factor
80
60
40
20
0
-20
-40
-60
0 0.01 0.02 0.03 0.04 0.05 0.1 0.15 0.2 0.3 0.4 0.5
Imbalance factor
node 1 node 2 node 3
120
B.1. Twitter Dataset
Table B.5: Effect of imbalance factor on number of iterations. Measured with cooling
factor = 0.99, adoption factor = 1, number of clusters = 3. The results are based on
ten individual measurements for each factor value, on the Twitter dataset.
121
B. Evaluation Results
Table B.6: Effect of imbalance factor on capacity usage. The average number of
|V |
vertices per node, |N | , is equal to approximately 25, 423. The results are based on ten
individual measurements for each factor value, on the Twitter dataset.
Effect of adoption factor on cross-node communication Effect of adoption factor on number of iterations
80 105
max
100 avg
75 min
Number of iterations
95
Improvement (%)
70 90
65 85
80
60
75
max avg min
55 70
0 0.5 1 0 0.5 1
Adoption factor Adoption factor
25
20
15
10
5
0
-5
-10
-15
0 0.5 1
Adoption factor
node 1 node 2 node 3
122
B.1. Twitter Dataset
Table B.9: Effect of adoption factor on capacity usage. The average number
|V |
of vertices per node, |N | , is equal to approximately 25, 423. The results are
based on ten individual measurements for each factor value, on the Twitter
dataset.
123
B. Evaluation Results
Cross-node communication with different # of nodes in cluster Number of iterations with different number of nodes in cluster
82 200
80 max
180
avg
78 160 min
Number of iterations
Improvement (%)
76
140
74
120
72
100
70
80
68
66 60
64 40
max avg min
62 20
2 3 4 5 6 7 2 3 4 5 6 7
Number of nodes in cluster Number of nodes in cluster
40
30
20
10
-10
2 3 4 5 6 7
Number of nodes in cluster
node 1 node 2 node 3 node 4 node 5 node 6 node 7
124
B.1. Twitter Dataset
Table B.12: Capacity usage with different number of nodes in cluster. The
results are based on ten individual measurements for each number of nodes,
on the Twitter dataset.
125
B. Evaluation Results
Effect of cooling factor on cross-node communication Effect of cooling factor on number of iterations
77 200
max max
180
76 avg avg
min Number of iterations 160 min
Improvement (%)
75 140
120
74
100
73 80
60
72
40
71 20
0.95 0.96 0.97 0.98 0.99 0.995 1 0.95 0.96 0.97 0.98 0.99 0.995 1
Cooling factor Cooling factor
25
20
15
10
5
0
-5
-10
-15
0.95 0.96 0.97 0.98 0.99 0.995 0.999
Cooling factor
node 1 node 2 node 3
126
B.2. Road Network Dataset
Table B.14: Effect of cooling factor on number of iterations. Measured with imbal-
ance factor = 0.1, adoption factor = 1, number of clusters = 3. The results are based
on four individual measurements for each factor value, on the Road network dataset.
Table B.15: Effect of cooling factor on capacity usage. The average number of
|V |
vertices per node, |N | , is equal to approximately 362, 697. The results are based on
four individual measurements for each factor value, on the Road network dataset.
127
B. Evaluation Results
Effect of imbalance factor on cross-node communication Effect of imbalance factor on number of iterations
90 80
80 70
70 60
Number of iterations
Improvement (%)
60
50
50
40
40
30
30
20 20
max max
avg 10 avg
10
min min
0 0
0 0.05 0.1 0.15 0.2 0.3 0.4 0.5 0 0.05 0.1 0.15 0.2 0.3 0.4 0.5
Imbalance factor Imbalance factor
100
80
60
40
20
0
-20
-40
-60
0 0.01 0.02 0.03 0.04 0.05 0.1 0.15 0.2 0.3 0.4 0.5
Imbalance factor
node 1 node 2 node 3
128
B.2. Road Network Dataset
129
B. Evaluation Results
Table B.18: Effect of imbalance factor on capacity usage. The average number of
|V |
vertices per node, |N | , is equal to approximately 362, 697. The results are based on
four individual measurements for each factor value, on the Road network dataset.
Effect of adoption factor on cross-node communication Effect of adoption factor on number of iterations
78 105
max
76 100 avg
min
Number of iterations
95
Improvement (%)
74
90
72
85
70
80
max
68 avg 75
min
66 70
0 0.5 1 0 0.5 1
Adoption factor Adoption factor
25
20
15
10
5
0
-5
-10
-15
0 0.5 1
Adoption factor
node 1 node 2 node 3
130
B.2. Road Network Dataset
Table B.21: Effect of adoption factor on capacity usage. The average number
|V |
of vertices per node, |N | , is equal to approximately 362, 697. The results are
based on four individual measurements for each factor value, on the Road
network dataset.
131
B. Evaluation Results
Cross-node communication with different # of nodes in cluster Number of iterations with different number of nodes in cluster
84 110
max max
82 100
avg avg
80 min min
90
Number of iterations
Improvement (%)
78
80
76
70
74
60
72
70 50
68 40
66 30
2 3 4 5 6 7 2 3 4 5 6 7
Number of nodes in cluster Number of nodes in cluster
60
50
40
30
20
10
0
-10
2 3 4 5 6 7
Number of nodes in cluster
node 1 node 2 node 3 node 4 node 5 node 6 node 7
132
B.2. Road Network Dataset
Table B.24: Capacity usage with different number of nodes in cluster. Mea-
sured with cooling factor = 0.99, imbalance factor = 0.1, adoption factor = 1.
The results are based on four individual measurements for each number of
nodes, on the Road network dataset.
133
Appendix C
Contents of CD
135