<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>A Distributed Implementation of GXPath</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Maurizio Nolé</string-name>
          <email>mnole@gmail.com</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Carlo Sartiani</string-name>
          <email>sartiani@gmail.com</email>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>DIMIE - Università della Basilicata</institution>
          ,
          <addr-line>Via dell'Ateneo Lucano 10, Potenza</addr-line>
          ,
          <country country="IT">Italy</country>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>DIMIE - Università della Basilicata</institution>
          ,
          <addr-line>Via dell'Ateneo Lucano 10, Potenza</addr-line>
          ,
          <country country="IT">Italy</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>In the last few years there has been an increasing number of application elds, like the Semantic Web, social networks, bioinformatics, astronomical databases, etc., where large graph datasets are analyzed, queried, and, more generally, manipulated. Graphs are usually queried by specifying reachability patterns through regular path expressions; this leads to the need for e cient and scalable tools for processing regular path queries on large graphs. In this work we present a distributed implementation of GXPath and show that this implementation, built on top of Hadoop MapReduce, can scale linearly with the number of vertices and/or edges.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1. INTRODUCTION</title>
      <p>
        In the last few years there has been a growing interest in
querying and, more generally, analyzing huge graph datasets.
These datasets arise in many real-life contexts, such as
social and instant messaging networks, biology, crime
detection and prevention, etc. As an example, social networks
like Facebook and Twitter attract everyday more and more
users from all over the world. The di usion of these services
is so wide that Facebook reported that in the second quarter
of 2015 its network comprises more than 1.4 billion active
users [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ], while Twitter has almost 288 million users [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ].
      </p>
      <p>Social network interactions can be naturally modeled by
using directed graphs, whose vertices denote users and edges
describe user-to-user interactions: indeed, Facebook and
Twitter already use graphs and graph tools to model and analyze
their networks.</p>
      <p>Given the wide di usion of graph datasets, analyzing these
graphs is becoming more and more important. This task,
however, is very challenging, partly because of the
exibility of graphs and partly because of their ever increasing size.
In the following example, we describe a paradigmatic
application of graph analysis related to crime detection and
prevention.
Example 1.1 Consider a government intelligence agency
that must seek for terrorist cells. Unlike what happens
for traditional criminal organizations, terrorists usually
exploit Internet services by exchanging messages or
uploading videos to make proselytizing campaigns, and they often
leave evidences of these interactions. Security and
intelligence agencies, hence, try to nd these evidences, by
analyzing the large amount of information exchanged on the
Internet and, in particular, on social networks like Facebook
or Twitter.</p>
      <p>The structure of terrorist cells can be usually translated
into well-determined reachability patterns in social network
graphs. A potential way to identify these cells, therefore, is
to adopt an analysis technique that inspects social network
graphs and looks for those vertices that are connected by
paths matching these reachability patterns; the results of
these queries can be further re ned by linking graph vertices
to other databases, e.g., criminal records, and by manually
inspecting collected results. Hence, while single users of a
social network may not give rise to the suspicion of belonging
to a terrorist cell, the links among them could take down the
whole organization.</p>
      <p>
        In Figure 1 we show the connections between the terrorists
that participated to the 9-11 attacks in Washington and New
York, and other people involved with terrorist activities [
        <xref ref-type="bibr" rid="ref15">15</xref>
        ].
In this gure green lines are used to denote direct
connections among two Al Qaeda original suspects, while grey lines
show indirect connections with other potential suspects. As
it can be observed, the social network topology reveals
Mohammed Atta emerging as the local leader, and all
hijackers are connected to the two original Al Qaeda suspects by
single-step or two-step paths.
      </p>
      <p>
        Graph reachability patterns are usually expressed by means
of Regular Path Queries (RPQs) [
        <xref ref-type="bibr" rid="ref18">18</xref>
        ]. A regular path query
q is a regular expression whose semantics comprises all the
pairs of vertices in the input graph that are connected by a
path labeled with a string matching q. Basic RPQs contain
the operators of plain regular expressions only, and they
have been extended in several ways obtaining CRPQs [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ],
2RPQs [
        <xref ref-type="bibr" rid="ref10 ref12 ref8">12, 8, 10</xref>
        ], 2CRPQs [
        <xref ref-type="bibr" rid="ref12 ref8">8, 12</xref>
        ], and NREs [
        <xref ref-type="bibr" rid="ref19">19</xref>
        ]. The
most powerful extension of RPQ is GXPath [
        <xref ref-type="bibr" rid="ref17">17</xref>
        ], that can
be considered an adaptation of XPath to graphs.
      </p>
      <p>
        Unfortunately, traditional relational database systems are
not well-suited for this kind of queries and do not scale well
on large graphs. On the other hand, most existing graph
database systems are inherently centralized (e.g., Neo4j [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ]),
which strongly limits the size of the graphs that can be
queried, and support only small fragments of regular path
query languages; distributed graph database systems like
In niteGraph [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ], instead, can deal with bigger graphs, but
they still impose severe restrictions on the class of queries
that can be evaluated.
      </p>
      <p>Our Contribution. In this paper we describe a system for
processing GXPath queries on large data graphs. In this
system, built on top Hadoop MapReduce, a query is compiled
into an acyclic graph of MapReduce jobs, similar in spirit to
a database query plan. Intermediate results are stored in a
compressed format to decrease the I/O overhead implied by
MapReduce. As proved by several experiments, our system
scales linearly with the number of vertices and/or edges.
Paper Outline. The rest of the paper is organized as
follows. In Section 2 we describe the data model and the query
language being used. In Section 3, then, we sketch our query
processing technique. In Section 4, next, we present an
extensive experimental evaluation of our system. In Sections
5 and 6, nally, we discuss some related works and draw our
conclusions.</p>
    </sec>
    <sec id="sec-2">
      <title>GRAPHS</title>
    </sec>
    <sec id="sec-3">
      <title>Data Model</title>
      <p>To describe a graph, we consider a model in which edges
are labeled by symbols from a nite alphabet and vertices
can contain data values from a countably in nite set D. For
the sake of simplicity, we assume that a vertex can contain
a single data value.</p>
      <p>De nition 2.1 A data graph (over
G = hV; E; i where:</p>
      <sec id="sec-3-1">
        <title>V is a nite set of vertices; and D) is a triple</title>
        <p>E
V</p>
      </sec>
      <sec id="sec-3-2">
        <title>V is a set of labeled edges; and</title>
        <p>When we deal with purely navigational queries, we refer
to a graph as G = hV; Ei omitting .</p>
        <p>A path from a vertex v1 to a vertex vn in a graph is a
sequence = v1a1v2 : : : vn 1an 1vn such that each (vi; ai; vi+1)
for i &lt; n is an edge in E. We use ( ) to denote the ordered
concatenation of the labels of .
2.2</p>
      </sec>
    </sec>
    <sec id="sec-4">
      <title>Query Language</title>
      <p>Most navigational formalisms for querying data graphs
are based on RPQs and their extensions. An RPQ is an
expression of the form x !L y, where L is a regular language
over (typically represented by a regular expression or a
NFA). Given a -labeled graph G = hV; Ei, the answer to
an RPQ as above is the set of pairs of vertices (v; v0) such
that there is a path from v to v0 with ( ) 2 L.</p>
      <p>
        GXPath, proposed by Libkin et al. in [
        <xref ref-type="bibr" rid="ref17">17</xref>
        ], extends other
languages like RPQs or NREs [
        <xref ref-type="bibr" rid="ref19">19</xref>
        ] with the introduction
of the complement operator, data tests on the value stored
into vertices, as well as counters, which generalize the Kleene
star.
      </p>
      <p>In this paper we focus our attention on the navigational
fragment of GXPath, without value tests, as described by
the following grammar:
:=
j j a j a j
+ j
j j
m;n j [ ]
Here, denotes the empty word, is a wildcard matching any
symbol, 1 2 and 1 + 2 are the standard concatenation
and union operators. m;n denotes the repetition of from
m to n times (m n; m 2 N; n 2 N [ f g); a , nally,
denotes the backward navigation, is the complement of
, and [ ] is a nested condition. The Kleene star can be
represented as 0; .</p>
      <p>Given a data graph G = hV; E; i, the semantics J KG of
a query on G is a set of pairs of vertices de ned as follows:
J KG
J KG
a G
J K
Ja KG
J 1 2KG
J 1 + 2KG
J KG
[ ]KG
Jam;n G
J K
= f(v; v) j v 2 V g
= f(u; v) j 9a 2 (_u; a; v) 2 Eg
= f(u; v) j (u; a; v) 2 Eg
= f(u; v) j (v; a; u) 2 Eg
= J 1KG J 2KG
= J 1KG [ J 2KG
= V V J KG
= f(kv=;vm)J2rKkGG j (v; u) 2 J KGg
= Sn
where is the concatenation of binary relations and Ri
denotes the concatenation of R with itself i times.
Example 2.2 Consider the graph depicted in Figure 2 and
the query a0; [b]. This query returns all the pairs of
vertices (x; y) where x and y are connected by an a-labeled path
of any length and y has an outgoing b edge. In the case of the
graph of Figure 2, this query returns f(v4; v4); (v2; v4); (v1; v4);
(v3; v4)g.</p>
      <p>Consider now the following query: a2;3 (b + d). This
query returns all vertex pairs (u; v) connected by the
following paths: aab; aaab; aad; aaad. The result of this query is
f(v1; v6); (v1; v5); (v2; v5); (v3; v6)g.</p>
      <p>: V ! D is a function that assigns data values to
vertices.</p>
      <p>
        In [
        <xref ref-type="bibr" rid="ref17">17</xref>
        ] Libkin et al. proved that the combined complexity
of GXPath is polynomial.
7 v3
      </p>
      <p>d</p>
    </sec>
    <sec id="sec-5">
      <title>QUERY PROCESSING</title>
      <p>We rst illustrate our query processing technique through
examples and, then, present in more detail the operators
used in our system.
3.1</p>
    </sec>
    <sec id="sec-6">
      <title>Overview</title>
      <p>In our system, before processing queries on an input graph
G = hV; E; i, G must be indexed. During graph
indexing, the system creates a distinct binary relation per label,
containing all the edges in E having that label. These
relations are stored in the distributed le system and form
the actual input data that will be analyzed. In the
following, we will assume that the indexing phase returns a set
R = fRa j a 2 g, where Ra = f(x; y) j (x; a; y) 2 Eg; more
generally and with a little abuse of notation, we will use R
and R to denote the result of the evaluation of with and
without duplicates, respectively.</p>
      <p>When a query is submitted to the system, it is rst
translated into its abstract syntax tree. After a simpli cation
phase, where common rewritings (e.g., = = )
are applied, the resulting AST is transformed in an acyclic
graph of MapReduce jobs; each job consumes and produces
binary relations of vertices.</p>
      <p>Example 3.1 Consider again the query a2;3 (b + d) on the
graph of Figure 2. This query can be translated in the AST
of Figure 3.</p>
      <p>In our system this AST is transformed in the query plan
shown in Figure 4. Here, Symbol(a), Symbol(b), and Symbol(d)
are operators that access the system catalog and return the
location of binary relations Ra, Rb, Rd in the distributed
le system. In the case of our input graphs, these relations
have the following extensions:</p>
      <p>
        Count(Ra; 2; 3), then, evaluates the bounded transitive
and re exive closure of Ra. To this aim, Count(Ra; 2; 3)
exploits a MapReduce implementation of the SemiNaive
algorithm described by Bancilhon in [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ]. In our example,
Count(Ra; 2; 3) returns the following binary relation: f(v1; v4);
(v2; v3); (v4; v1); (v3; v2); (v1; v3); (v2; v1); (v4; v2); (v3; v4)g.
      </p>
      <p>Union(Rb; Rd) accesses Rb and Rd, and returns their union.</p>
      <p>The output of Count(Ra; 2; 3) and Union(Rb; Rd) is passed
as input to the concatenation operator Concat(Ra2;3 ; Rb+d).
Concat(R; S) takes as input two binary relations R and S,
and returns their composition, by applying a standard
matrix product algorithm. In our example, Concat(Ra2;3 ; Rb+d)
returns the following binary relation: f(v1; v6); (v2; v5); (v1; v5);
(v3; v6)g.</p>
      <p>Finally, the output of Concat(Ra2;3 ; Rb+d) is sent to the
duplicate elimination operator Distinct( ). In our system,
indeed, query operators do not return sets of vertex pairs,
as prescribed by GXPath set-based semantics, but
collections that may contain repeated entries. Duplicates are
eliminated at the end of query evaluation by relying on the
Distinct( ) operator. We made this choice as early
experiments showed that set-based operators were much slower
than sequence-based ones.</p>
      <p>Example 3.2 Consider now the query b [c] a1;3. This
query rst looks for all vertex pairs (x; y) such that (x; y) 2
Jb [c] a1;3KG, and, then, computes the complement of
Jb [c] a1;3KG (i.e., V V Jb [c] a1;3KG). In particular, in
each pair (x; y) y is reachable from x by traversing backward
an incoming b-labeled edge, by ltering out vertices without
c-labeled outgoing edges, and by traversing a path labeled
with a, aa, or aaa.</p>
      <p>In the case of the graph of Figure 2, Jb
[c] a1;3 G =</p>
      <p>K
f(v6; v3); (v6; v1); (v6; v2)g and Jb [c] a1;3KG = f(vi; vj ) j
i = 1; : : : ; 7; j = 1; : : : ; 7g f(v6; v3); (v6; v1); (v6; v2)g.</p>
      <p>To evaluate the result of this query, our system creates the
query plan shown in Figure 5. Here, BackSymbol(b) accesses
relation Rb, created during the indexing phase and stored
in the distributed le system, and returns a relation Rb
obtaining by adding a pair (vx; vy) for each pair (vy; vx) 2
Rb. Operator Cond(Rc), instead, just accesses relation Rc
and outputs a relation R[c] containing a pair (vx; vx) for each
(vx; vy) 2 Rc.</p>
      <p>The Compl( ) operator, nally, computes the complement
of the binary relation passed as input. To this aim, it just</p>
      <p>Concat(Rb [c]; Ra1;3 )
generates all the pairs of vertices (u; v) 2 V V and, during
the generation process, it discards those belonging to its
input. As Compl() already suppresses duplicates by itself,
the system does not introduce a Distinct() operator.
3.2</p>
    </sec>
    <sec id="sec-7">
      <title>Indexing</title>
      <p>As already stated, each graph must be indexed before
becoming available for querying. To this aim, our system
preprocesses each graph by using a MapReduce job whose
Map phase returns, for each edge (x; label; y), the key-value
pair (label; (x; y)); during the Reduce phase, each reducer
receives a pair (label; L), where L = f(x; y) j (x; label; y) 2 Eg,
creates a compressed le for label, and add each pair (x; y)
to the le. As a result, the indexer creates a collection of
binary relations Ra, stored as compressed les on HDFS by
relying on the Snappy codec of Hadoop. During this
indexing phase, the system also records in the system catalog
the number of edges and vertices of the graph (for the sake
of simplicity, we assume that input graphs have no isolated
vertices, i.e., vertices without incoming and outgoing edges).
3.3</p>
    </sec>
    <sec id="sec-8">
      <title>Operators</title>
      <p>Our system exploits several basic query operators. In this
section we will discuss the most prominent ones, and assume,
unless otherwise noted, that each operator reads and writes
compressed les.</p>
      <p>Epsilon. Epsilon() just returns a set of pairs (u; u), where
u 2 V . This operator is implemented as a Map-only
MapReduce job, where each mapper is in charge of generating pairs
(u; u) for a given interval of vertices (vertices are uniquely
identi ed by integers). By relying on the NLineInputFormat
class of Hadoop, each mapper is forced to process exactly one
vertex interval, i.e., the system creates as many mappers as
intervals.</p>
      <p>Symbol and BackSymbol. Symbol(a) takes as input a symbol
a 2 , and returns the relation Ra. As input graphs are
assumed to have been previously indexed, Symbol(a) just looks
in the catalog for the compressed le storing Ra, and returns
its location in the distributed le system. BackSymbol(a),
instead, returns a relation Ra = f(y; x) j (x; a; y) 2 Eg.
To this end, BackSymbol(a) is implemented as a Map-only
MapReduce job, whose mappers just reads the pairs in Ra
and return their inverse.</p>
      <p>Wildcard. The Wildcard() operator implements the
operator of GXPath. To this end, it exploits the fact the input
graphs have been previously indexed, and just returns the
locations in the distributed le system of the les that store
relations Ra, for any a 2 , hence leveraging on Hadoop
ability to work on multiple input les.</p>
      <p>
        Concat. Concat(R 1 ; R 2 ) takes as input two binary
relations and returns their composition. This is obtained by
applying a matrix multiplication algorithm. In MapReduce
there are di erent ways to evaluate matrix multiplication
[
        <xref ref-type="bibr" rid="ref16">16</xref>
        ], that di er for communication cost, computational cost,
and memory management. In our system we use a variant of
the Two Step MapReduce Matrix Multiplication algorithm;
in this variant there is just one single step that performs
the multiplication row per column, without the need of a
duplicate elimination second step.
      </p>
      <p>Union. Union(R 1 ; R 2 ) implements the union between two
binary relations R 1 and R 2 . As MapReduce jobs can
work on multiple input les and in our system duplicate
elimination is performed at the end of the computation,
Union(R 1 ; R 2 ) just returns to its father operator the
location of the compressed les in the distributed le system
containing the pairs of R 1 and R 2 , without the need to
activate a MapReduce job.</p>
      <p>Cond. Cond(R) takes as input a binary relation R and
returns a new relation R0 such that (x; x) 2 R0 if and only if
9y:(x; y) 2 R. Cond(R) is implemented as a single
MapReduce job, whose Mappers create a (x; x) pair for each (x; y)
pair being read.</p>
      <p>Compl. Compl(R) takes as input a binary relation R and
returns its complement, i.e., V V R. This operator is
particularly challenging as the topology of the graph
cannot be used to guide the evaluation process. This operator
is implemented by loading R in a persistent hash set, and
by running a MapReduce job, where each Mapper creates a
fragment of V V and, for each generated pair (x; y),
discards (x; y) if (x; y) is contained in the hash set. The job
has no Reduce phase.</p>
      <p>
        Count. Count(R; m; n) takes as input a binary relation R,
and returns the result of Rm;n. To this end, our system
actually computes the bounded transitive and re exive
closure of R by exploiting a MapReduce implementation of a
variation of the Seminaive algorithm [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ]. This
implementation creates a chain of MapReduce jobs, hence making
Count(R; m; n) the only operator that requires more than
one MapReduce job.
      </p>
      <p>Distinct. The Distinct(R) operator takes as input a binary
relation with duplicates R, and returns a binary relation R
without duplicates. Duplicate elimination is implemented
through a MapReduce job, whose Map phase, for each pair
(x; y) 2 R, returns a pair (K; V ), where K = (x; y) and V
is empty; in the Reduce phase, then, each reducer receives
a pair ((x; y); L), where L is an empty list, and just outputs
(x; y).</p>
    </sec>
    <sec id="sec-9">
      <title>EXPERIMENTAL EVALUATION</title>
      <p>In this section we analyze the performance and the
scalability of our query processor. As there is no standard
benchmark for evaluating the performance of graph query
processors, we generated a set of 15 random queries and evaluated
them on three datasets comprising large synthetic power-law
graphs.
4.1</p>
    </sec>
    <sec id="sec-10">
      <title>Experimental Setup</title>
      <p>We performed our experiments on a 4-node, multitenant
Hadoop cluster which is part of the Cineca1 PICO cluster.
Each node features an Intel Xeon E5 2650 v2 @ 2.6GHz
CPU with 16 cores, 64 GB of main memory, and 32TB of
local disks. Cluster nodes run RHEL Linux 6.5 and Hadoop
2.6.0, with HDFS block size set to 128MB and up to 2GB
of memory per container.
4.2</p>
    </sec>
    <sec id="sec-11">
      <title>Datasets</title>
      <p>
        We performed our experiments on three datasets
comprising synthetic graphs generated, according to the power
law, by using the R-MAT generator of GTGraph [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ]. These
datasets, that we indicate with G1, G2, and G3, serve the
purpose of evaluating the scalability of our tool with the
number of edges, the number of vertices, and both the
number of edges and vertices, respectively.
      </p>
      <p>The R-MAT algorithm generates random graphs
according to the power law distribution; the inputs of the algorithm
are the desired number of vertices n and the requested
number m of edges; we set the minimum and maximum label
value to 0 and 1000, respectively. The graphs generated by
R-MAT are summarized in Tables 1, 2, and 3.</p>
      <p>
        As there is no standard benchmark for evaluating the
performance and the scalability of graph query processors, we
based our experiments on a set of random GXPath queries.
To create this set of queries, we implemented an extended
version of the random regular expression generator described
by Colazzo et al. in [
        <xref ref-type="bibr" rid="ref11">11</xref>
        ].
      </p>
      <p>In our generator, operators are divided in two main classes:
intermediate operators and terminal operators. The rst
class comprises unary and binary operators, such as + ,
, [ ], m;n, and , while the second class only contains
operators that may appear in a leaf of the parse tree of a
query: a, a , , and .</p>
      <p>The generation algorithm takes as input an expected query
AST depth, as well as a distribution of probability for
intermediate and terminal operators, and it works recursively.
During each recursive call, it veri es whether the current
AST has reached the expected depth: if so, the algorithm
randomly selects a leaf operator; otherwise, it randomly
chooses a unary or binary operator and performs another
recursive call.</p>
      <p>Operators are selected by using a random generator, that
generates doubles between 0 (inclusive) and 1 (exclusive).
These range values are mapped, according to the operator
probability set in Table 4.(a), into GXPath operators. In a
similar way, the algorithm chooses the leafs using the
probability set in Table 4.(b). m and n indexes of counting
operators are extracted in a random way, in the integer range
between 0 and . Label values are randomly selected in the
interval ]0; 1000[.</p>
      <p>(a) Unary and
binary operators.</p>
      <p>Operator</p>
      <p>+
[ ]
m;n
p
0,36
0,36
0,18
0,09
0,01
(b) Terminal
operators.</p>
      <p>Operator
a
a
p
0,48
0,48
0,01
0,01</p>
      <p>We generated, through the above random generator, 15
queries, shown in Table 5 These queries do not contain the
complement operator. Indeed, the evaluation of this
operator requires to materialize intermediate results whose size
can be quadratic in the size of the input graph; this leaded,
in all our preliminary experiments, to the exhaustion of
the available HDFS space, even with compression enabled;
therefore, we decided to remove queries with complement
from our query set.
4.4</p>
    </sec>
    <sec id="sec-12">
      <title>Experimental Results</title>
      <p>In our experimental evaluation we performed several kinds
of experiments. As a preliminary test, we measured the
indexing time for all datasets; then, we evaluated the
performance and the scalability of the system by executing each
query of Section 4.3 on each dataset.</p>
      <sec id="sec-12-1">
        <title>4.4.1 Indexing Time</title>
        <p>1Cineca is an Italian university consortium for
supercomputing services.</p>
        <p>In these preliminary tests we measured the time required
for preprocessing and indexing each graph in our datasets.</p>
        <p>The results we obtained are shown in Figures 6(a), 6(b), and
6(c).</p>
        <p>As it can be observed, the preprocessing and indexing time
grows linearly with the size of the input graphs.
4.4.2</p>
      </sec>
      <sec id="sec-12-2">
        <title>Performance and Scalability Tests</title>
        <p>In these tests we evaluated the performance and the
scalability of our system when processing the queries of Section
4.3 on the datasets of Section 4.2.</p>
        <p>The results we obtained are shown in Figures 7(a), 7(b),
and 7(c). As query Q6, which contains the wildcard
operator, showed a signi cant overhead wrt the remaining queries,
we also reported in Figures 8(a), 8(b), and 8(c) these results
without query Q6. As it can be observed, the system
preforms well on all queries (except for Q6), and scales linearly
with the number of edges and/or vertices.</p>
        <p>To better understand the behavior of the system, we can
analyze in more detail the results obtained so far for queries
Q5, Q6, Q9, and Q12. Indeed, queries Q5 and Q6 are the only
ones that include, respectively, and ; query Q9 contains
counting operators with relatively high values of m and n;
query Q12, nally, contains all the remaining operators.
Query Q5. Query Q5 includes an operator inside a union
at the top level of the query. This implies that the system
must materialize an intermediate relation J KG = f(u; u) j
u 2 V g containing jV j pairs. In turn, this implies that the
selectivity of Q5 is quite low and explains why its processing
cost is higher than those of the other queries, as shown in
Figs. 8(a), 8(b), and 8(c).</p>
        <p>To understand if by itself can signi cantly worsen the
processing time of a query, we compared in Figure 9 the
query execution time with the time required for generating
J KG. As it can be observed, on large graphs impact on the
system performance can be quite signi cant.</p>
        <p>Query Q6. From Figures 7(a), 7(b), and 7(c), we can
observe that query Q6 is the most expensive one in our query
set, as its execution time may exceed four hours on large
graphs. Indeed, to process this query the system must read
the whole input graph, even if it has been previously
indexed. Indexing, however, helps in decreasing Q6
processing time, since the system can read the compressed les
produced during the indexing phase.</p>
        <p>epsilon
1E+08
2E+08
4E+08</p>
        <p>5E+08
3E+08</p>
        <p>Vertices
Query Q9. This query includes a counting operator with
relatively high values of m1 and n (59 and 63, respectively).
This implies that our evaluation algorithm must perform
several iterations; however, this does not a ect Q6
processing time so badly, which con rms that our system has good
scalability properties.</p>
        <p>Query Q12. This query contains all operators of the
language with the exception of counting, , and . From
Figures 8(a), 8(b), and 8(c) we can observe that the system
behaves very well while processing this query, and scales
linearly with the number of vertices and edges. This
suggests that counting, , and (together with complement) are
the most expensive operators to evaluate.
5.</p>
      </sec>
    </sec>
    <sec id="sec-13">
      <title>RELATED WORKS</title>
      <p>There exist several systems for managing and querying
data graphs. In this section we review a few of them.
5.1</p>
    </sec>
    <sec id="sec-14">
      <title>Graph Databases</title>
      <p>
        Neo4j [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ] is a disk-based, transactional graph database
system. Neo4J allows one to use di erent graph query
languages such as Gremlin and Cypher [
        <xref ref-type="bibr" rid="ref13">13</xref>
        ]. While very di
erent, both Gremlin and Cypher can be used to express a very
limited subset of GXPath. Neo4J is inherently centralized
and it is not clear how it can scale on large or very large
data graphs.
      </p>
      <p>
        In niteGraph [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ] is a distributed graph database system
based on a distributed object store. In niteGraph query
language allows one to express navigational queries
containing forward navigation operators, unions among symbols, as
well as counting and Kleene star operators on symbols only:
therefore, simple queries of the form (ab + c)0; cannot be
easily expressed. To the best of our knowledge, there is no
independent experimental evaluation of the performance of
In niteGraph.
5.2
      </p>
    </sec>
    <sec id="sec-15">
      <title>Regular Path Queries Processors</title>
      <p>
        G-Path [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ] is a system for processing regular path queries
on graphs, based on the BSP model and built on top of
Hadoop HDFS and HAMA. The query language allows the
user to de ne regular expressions by means of twig patterns.
The language allows the user to impose conditions on edge
labels and vertex values, but it seems very limited wrt the
language supported by our system.
4x1010
5x1010
2x108
4x108
8x108
1x109
      </p>
      <p>Q1
Q2
Q3
Q4
Q5
Q6
Q7
Q8
Q9
Q10
Q11
Q12
Q13
Q14
Q15
Q1
Q2
Q3
Q4
Q5
Q7
Q8
Q9
Q10
Q11
Q12
Q13
Q14</p>
      <p>Q15
0</p>
      <p>Q1
Q2
Q3
Q4
Q5
Q6
Q7
Q8
Q9
Q10
Q11
Q12
Q13
Q14
Q15
Q1
Q2
Q3
Q4
Q5
Q7
Q8
Q9
Q10
Q11
Q12
Q13
Q14
Q15
(a) G
1
results.
(b) G
2
results.
(c) G
3
results.</p>
      <p>
        The system described by Koschmieder and Leser in [
        <xref ref-type="bibr" rid="ref14">14</xref>
        ]
is a centralized query processor for evaluating RPQs on
relatively small graphs. This system adopts a non standard
semantics for RPQs, as it focuses on simple paths only.
The evaluation algorithm is based on the idea of performing
searches starting from vertices of the graph having rare
labels. These rare labels are used to split the input query in
smaller queries, and form the starting points of path
traversal. Authors reported several experiments describing the
performance of the system when evaluating queries on
relatively small graphs (up to 1-2 million vertices): these
experiments seem suggesting that the proposed system cannot
scale linearly with the number of vertices and/or edges.
      </p>
      <p>
        In [
        <xref ref-type="bibr" rid="ref20">20</xref>
        ] Sarwat et al. describe Horton+, a distributed
query processor for reachability queries over data graphs.
Horton+ query language is strongly based on RPQs and also
allows the user to test for vertex values. Graphs are
partitioned on a set of partition servers, which gather statistics
about the partitioned graphs and cooperate in evaluating
queries. An extensive experimental evaluation shows that
Horton+ scales linearly with the number of vertices in sparse
graphs, but there are no experiments studying the scalability
in the number of edges.
      </p>
    </sec>
    <sec id="sec-16">
      <title>CONCLUSIONS AND FUTURE WORK</title>
      <p>In this work we investigated the problem of querying
massive graph datasets and, in particular, we implemented a
scalable and e cient distributed query processor for the
navigational fragment of GXPath. Our query processor exploits
a MapReduce infrastructure to coordinate the work of
multiple machines in a cluster and to distributed the computing
load among them.</p>
      <p>To evaluate the performance and the scalability of our
implementation, we performed several experiments on a very
small Hadoop cluster, using synthetic graph datasets with
size up to 500 million vertices and 50 billion edges; given
the lack of benchmarks for graph queries, we relied on a set
of randomly generated queries. These experiments showed
that our system is scalable and that it can e ciently process
complex queries on large graphs.</p>
      <p>In the near future we would like to extend our system in
two ways. First of all, we would like to widen the fragment
of GXPath being supported by our implementation, and, in
particular, to cover the value test fragment of the language.
This is a challenging task, as GXPath allows for comparing
values stored in vertices reachable from di erent paths.</p>
      <p>In the second place, while our system is very scalable,
queries containing complement operations are still too
expensive to be evaluated. To overcome this limitation, we
plan to introduce more sophisticated processing techniques
that, looking at the part of the query following a
complement operator, could limit the scope of the complement.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>[1] In niteGraph. http://www.objectivity.com/products/infinitegraph/.</mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <fpage>Neo4J</fpage>
          . http://neo4j.com.
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3] Statistics on Facebook,
          <year>2015</year>
          . Available at http://www.statista.com/statistics/264810/numberof-monthly
          <article-title>-active-facebook-users-worldwide.</article-title>
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <surname>Twitter</surname>
            <given-names>statistics</given-names>
          </string-name>
          ,
          <year>2015</year>
          . Available at http://www.beevolve.com/twitter-statistics/.
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>D. A.</given-names>
            <surname>Bader</surname>
          </string-name>
          and
          <string-name>
            <given-names>K.</given-names>
            <surname>Madduri. GTgraph</surname>
          </string-name>
          :
          <article-title>A synthetic graph generator suite</article-title>
          ,
          <year>2006</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>Y.</given-names>
            <surname>Bai</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>Wang</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Y.</given-names>
            <surname>Ning</surname>
          </string-name>
          ,
          <string-name>
            <given-names>H.</given-names>
            <surname>Wu</surname>
          </string-name>
          , and
          <string-name>
            <given-names>H.</given-names>
            <surname>Wang</surname>
          </string-name>
          . G-Path:
          <article-title>exible path pattern query on large graphs</article-title>
          .
          <source>In 22nd International World Wide Web Conference, WWW '13</source>
          , Rio de Janeiro, Brazil, May
          <volume>13</volume>
          -17,
          <year>2013</year>
          , Companion Volume, pages
          <volume>333</volume>
          {
          <fpage>336</fpage>
          . ACM,
          <year>2013</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <given-names>F.</given-names>
            <surname>Bancilhon</surname>
          </string-name>
          .
          <article-title>Naive evaluation of recursively de ned relations</article-title>
          .
          <source>In On Knowledge Base Management Systems (Islamorada)</source>
          , pages
          <fpage>165</fpage>
          {
          <fpage>178</fpage>
          ,
          <year>1985</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <given-names>D.</given-names>
            <surname>Calvanese</surname>
          </string-name>
          , G. De Giacomo,
          <string-name>
            <given-names>M.</given-names>
            <surname>Lenzerini</surname>
          </string-name>
          , and
          <string-name>
            <given-names>M. Y.</given-names>
            <surname>Vardi</surname>
          </string-name>
          .
          <article-title>Containment of conjunctive regular path queries with inverse</article-title>
          .
          <source>In KR 2000, Principles of Knowledge Representation and Reasoning Proceedings of the Seventh International Conference</source>
          , Breckenridge, Colorado, USA, April
          <volume>11</volume>
          -
          <issue>15</issue>
          ,
          <year>2000</year>
          ., pages
          <volume>176</volume>
          {
          <fpage>185</fpage>
          . Morgan Kaufmann,
          <year>2000</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [9]
          <string-name>
            <given-names>D.</given-names>
            <surname>Calvanese</surname>
          </string-name>
          , G. De Giacomo,
          <string-name>
            <given-names>M.</given-names>
            <surname>Lenzerini</surname>
          </string-name>
          , and
          <string-name>
            <given-names>M. Y.</given-names>
            <surname>Vardi</surname>
          </string-name>
          .
          <article-title>Rewriting of regular expressions and regular path queries</article-title>
          .
          <source>J. Comput. Syst. Sci.</source>
          ,
          <volume>64</volume>
          (
          <issue>3</issue>
          ):
          <volume>443</volume>
          {
          <fpage>465</fpage>
          ,
          <year>2002</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          [10]
          <string-name>
            <given-names>D.</given-names>
            <surname>Calvanese</surname>
          </string-name>
          , G. De Giacomo,
          <string-name>
            <given-names>M.</given-names>
            <surname>Lenzerini</surname>
          </string-name>
          , and
          <string-name>
            <given-names>M. Y.</given-names>
            <surname>Vardi</surname>
          </string-name>
          .
          <article-title>Reasoning on regular path queries</article-title>
          .
          <source>SIGMOD Record</source>
          ,
          <volume>32</volume>
          (
          <issue>4</issue>
          ):
          <volume>83</volume>
          {
          <fpage>92</fpage>
          ,
          <year>2003</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          [11]
          <string-name>
            <given-names>D.</given-names>
            <surname>Colazzo</surname>
          </string-name>
          ,
          <string-name>
            <given-names>G.</given-names>
            <surname>Ghelli</surname>
          </string-name>
          ,
          <string-name>
            <given-names>L.</given-names>
            <surname>Pardini</surname>
          </string-name>
          , and
          <string-name>
            <given-names>C.</given-names>
            <surname>Sartiani</surname>
          </string-name>
          .
          <article-title>E cient asymmetric inclusion of regular expressions with interleaving and counting for XML type-checking</article-title>
          .
          <source>Theor. Comput. Sci.</source>
          ,
          <volume>492</volume>
          :
          <fpage>88</fpage>
          {
          <fpage>116</fpage>
          ,
          <year>2013</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          [12]
          <string-name>
            <given-names>M. P.</given-names>
            <surname>Consens</surname>
          </string-name>
          and
          <string-name>
            <given-names>A. O.</given-names>
            <surname>Mendelzon</surname>
          </string-name>
          .
          <article-title>Graphlog: a visual formalism for real life recursion</article-title>
          . In D. J. Rosenkrantz and Y. Sagiv, editors,
          <source>PODS</source>
          , pages
          <volume>404</volume>
          {
          <fpage>416</fpage>
          . ACM Press,
          <year>1990</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          [13]
          <string-name>
            <given-names>F.</given-names>
            <surname>Holzschuher</surname>
          </string-name>
          and
          <string-name>
            <given-names>R.</given-names>
            <surname>Peinl</surname>
          </string-name>
          .
          <article-title>Performance of graph query languages: comparison of Cypher, Gremlin and native access in Neo4J</article-title>
          . In G. Guerrini, editor, Joint 2013 EDBT/ICDT Conferences, EDBT/ICDT '13,
          <string-name>
            <surname>Genoa</surname>
          </string-name>
          , Italy, March
          <volume>22</volume>
          ,
          <year>2013</year>
          , Workshop Proceedings, pages
          <volume>195</volume>
          {
          <fpage>204</fpage>
          . ACM,
          <year>2013</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          [14]
          <string-name>
            <given-names>A.</given-names>
            <surname>Koschmieder</surname>
          </string-name>
          and
          <string-name>
            <given-names>U.</given-names>
            <surname>Leser</surname>
          </string-name>
          .
          <article-title>Regular path queries on large graphs</article-title>
          . In A. Ailamaki and S. Bowers, editors,
          <source>SSDBM</source>
          , volume
          <volume>7338</volume>
          of Lecture Notes in Computer Science, pages
          <volume>177</volume>
          {
          <fpage>194</fpage>
          . Springer,
          <year>2012</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref15">
        <mixed-citation>
          [15]
          <string-name>
            <given-names>V. E.</given-names>
            <surname>Krebs</surname>
          </string-name>
          .
          <article-title>Uncloaking terrorist networks</article-title>
          .
          <source>First Monday</source>
          ,
          <volume>7</volume>
          (
          <issue>4</issue>
          ),
          <year>2002</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref16">
        <mixed-citation>
          [16]
          <string-name>
            <given-names>J.</given-names>
            <surname>Leskovec</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Rajaraman</surname>
          </string-name>
          , and
          <string-name>
            <given-names>J. D.</given-names>
            <surname>Ullman</surname>
          </string-name>
          . Mining of Massive Datasets, 2nd Ed. Cambridge University Press,
          <year>2014</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref17">
        <mixed-citation>
          [17]
          <string-name>
            <given-names>L.</given-names>
            <surname>Libkin</surname>
          </string-name>
          ,
          <string-name>
            <given-names>W.</given-names>
            <surname>Martens</surname>
          </string-name>
          , and
          <string-name>
            <given-names>D.</given-names>
            <surname>Vrgoc</surname>
          </string-name>
          .
          <article-title>Querying graph databases with XPath</article-title>
          . In W. Tan,
          <string-name>
            <given-names>G.</given-names>
            <surname>Guerrini</surname>
          </string-name>
          ,
          <string-name>
            <given-names>B.</given-names>
            <surname>Catania</surname>
          </string-name>
          ,
          <article-title>and</article-title>
          <string-name>
            <surname>A</surname>
          </string-name>
          . Gounaris, editors,
          <source>ICDT</source>
          , pages
          <volume>129</volume>
          {
          <fpage>140</fpage>
          . ACM,
          <year>2013</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref18">
        <mixed-citation>
          [18]
          <string-name>
            <given-names>A. O.</given-names>
            <surname>Mendelzon</surname>
          </string-name>
          and
          <string-name>
            <given-names>P. T.</given-names>
            <surname>Wood</surname>
          </string-name>
          .
          <article-title>Finding regular simple paths in graph databases</article-title>
          .
          <source>SIAM J. Comput.</source>
          ,
          <volume>24</volume>
          (
          <issue>6</issue>
          ):
          <volume>1235</volume>
          {
          <fpage>1258</fpage>
          ,
          <year>1995</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref19">
        <mixed-citation>
          [19]
          <string-name>
            <given-names>J.</given-names>
            <surname>Perez</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Arenas</surname>
          </string-name>
          , and
          <string-name>
            <given-names>C.</given-names>
            <surname>Gutierrez</surname>
          </string-name>
          . nSPARQL:
          <article-title>A navigational language for RDF</article-title>
          . J. Web Sem.,
          <volume>8</volume>
          (
          <issue>4</issue>
          ):
          <volume>255</volume>
          {
          <fpage>270</fpage>
          ,
          <year>2010</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref20">
        <mixed-citation>
          [20]
          <string-name>
            <given-names>M.</given-names>
            <surname>Sarwat</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Elnikety</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Y.</given-names>
            <surname>He</surname>
          </string-name>
          , and
          <string-name>
            <given-names>M. F.</given-names>
            <surname>Mokbel</surname>
          </string-name>
          . Horton+
          <article-title>: A distributed system for processing declarative reachability queries over partitioned graphs</article-title>
          .
          <source>PVLDB</source>
          ,
          <volume>6</volume>
          (
          <issue>14</issue>
          ):
          <year>1918</year>
          {
          <year>1929</year>
          ,
          <year>2013</year>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>