Docsity

Transaction Processing System (TPS), Exams of Business and Society

Toggle sidebar
bg1
Thrifty Label Propagation: Fast Connected
Components for Skewed-Degree Graphs
Mohsen Koohi Esfahani
0000-0002-7465-8003
Peter Kilpatrick
0000-0003-0818-8979
{mkoohiesfahani01, p.kilpatrick, h.vandierendonck}@qub.ac.uk
Queen’s University Belfast, Northern Ireland, UK
https://blogs.qub.ac.uk/GraphProcessing
Hans Vandierendonck
0000-0001-5868-9259
Abstract—Various concurrent algorithms have been proposed
in the literature in recent years that mostly focus on the disjoint
set approach to the Connected Components (CC) algorithm.
However, these CC algorithms do not take the skewed structure
of real-world graphs into account and as a result they do not
benefit from common features of graph datasets to accelerate
processing.
We investigate the implications of the skewed degree distribu-
tion of real-world graphs on their connectivity and we use these
features to introduce Thrifty Label Propagation as a structure-
aware CC algorithm obtained by incorporating 4 fundamental
optimization techniques in the Label Propagation CC algorithm.
Our evaluation on 15 real-world graphs and 2 different
processor architectures shows that Thrifty accelerates the flow
of labels and processes only 1.4% of the edges of the graph.
In this way, Thrifty is up to 16×faster than state-of-the-art
CC algorithms such as Afforest, Jayanti-Tarjan, and Breadth-
First Search CC. In particular, Thrifty delivers 1.5× −19.9×
speedup for graph datasets larger than one billion edges.
Index Terms—Connected components, Label propagation,
High performance computing, Graph Connectivity, Graph al-
gorithms, Graph traversal, Data analysis.
I. INTRODUCTION
Connected Components (CC) is a graph analytic algorithm
widely used in different fields of science, industry and technol-
ogy including biology [1], [2], [3], image processing [4], [5],
economy [6], and astronomy [7], and acts also as a preliminary
tool in several graph analytics like graph clustering [8], [9],
[10], locality optimizing graph relabeling (reordering) [11],
graph partitioning and processing [12], [13].
Algorithms for finding connected components in a graph
can be placed in one of three classes:
1) Flood Filling CC [14], [15], [16], [17] performs breadth-
first search (BFS) or depth-first search (DFS) to identify
all vertices that are reachable from a chosen starting point.
A BFS/DFS search is required for each component.
2) Label Propagation CC (LP-CC) [18] iteratively updates
the label of each vertex by calculating the minimum value
between labels of its neighbours. Label Propagation CC
can be specified in terms of generalized Sparse Matrix-
Vector (SpMV) multiplication.
Speedup
0
5
10
15
20
25
SkyLakeX Epyc
DO-LP JT Afforest Thrifty
Fig. 1: Average speedup normalized to DO-LP
3) Disjoint Set CC [19], [20], [21], [22] uses the disjoint set
data structure to group connected vertices in the same set.
As sets are often represented as trees, these algorithms
have also been called “tree-hooking” algorithms [23].
Some studies have identified that Disjoint Set CC is more
efficient than Flood Filling and Label Propagation [22], [24].
This is especially true for graph datasets with high diame-
ters [25], such as road networks. Moreover, in the case of
graphs with skewed degree distribution, such as those found
in social networks and web graphs, Disjoint Set CC minimizes
the number of times each edge is processed. Jayanti and Tarjan
process each edge just once [21] while Afforest processes
each edge on average slightly more than once [22]. However,
Disjoint Set CC is not scalable and has not been effective in
distributed processing [26]. In contrast, the Label Propagation
CC follows a SpMV model that has been successfully scaled
to distributed systems [27], [28], [29].
In this paper, we present a new perspective on the CC algo-
rithm by investigating the implications imposed by real-world
graphs on the efficiency of the label propagation process of the
LP-CC algorithm. Many real-world graphs derived from social
networks, the internet, and the world-wide web show a heavy-
tailed skewed degree distribution. In other words, a very small
fraction of the vertices are connected to a disproportionately
large fraction of edges. This particular relationship between
vertices merits special attention.
We identify 4 main problems in LP-CC: (1) repeated wave-
fronts, (2) propagating labels to converged vertices, (3) incor-
© 2021 IEEE. Personal use of this material is permitted. Permission from IEEE must be obtained for all other uses, in any current or future media, including
reprinting/republishing this material for advertising or promotional purposes, creating new collective works, for resale or redistribution to servers or lists, or
reuse of any copyrighted component of this work in other works.
2168-9253/21/©2021 IEEE
https://doi.org/10.1109/Cluster48925.2021.00042
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download Transaction Processing System (TPS) and more Exams Business and Society in PDF only on Docsity!

Thrifty Label Propagation: Fast Connected

Components for Skewed-Degree Graphs

Mohsen Koohi Esfahani

Peter Kilpatrick

{mkoohiesfahani01, p.kilpatrick, h.vandierendonck}@qub.ac.uk

Queen’s University Belfast, Northern Ireland, UK

https://blogs.qub.ac.uk/GraphProcessing

Hans Vandierendonck

Abstract—Various concurrent algorithms have been proposed in the literature in recent years that mostly focus on the disjoint set approach to the Connected Components (CC) algorithm. However, these CC algorithms do not take the skewed structure of real-world graphs into account and as a result they do not benefit from common features of graph datasets to accelerate processing. We investigate the implications of the skewed degree distribu- tion of real-world graphs on their connectivity and we use these features to introduce Thrifty Label Propagation as a structure- aware CC algorithm obtained by incorporating 4 fundamental optimization techniques in the Label Propagation CC algorithm. Our evaluation on 15 real-world graphs and 2 different processor architectures shows that Thrifty accelerates the flow of labels and processes only 1 .4% of the edges of the graph. In this way, Thrifty is up to 16 × faster than state-of-the-art CC algorithms such as Afforest, Jayanti-Tarjan, and Breadth- First Search CC. In particular, Thrifty delivers 1. 5 × − 19. 9 × speedup for graph datasets larger than one billion edges. Index Terms—Connected components, Label propagation, High performance computing, Graph Connectivity, Graph al- gorithms, Graph traversal, Data analysis.

I. INTRODUCTION

Connected Components (CC) is a graph analytic algorithm widely used in different fields of science, industry and technol- ogy including biology [1], [2], [3], image processing [4], [5], economy [6], and astronomy [7], and acts also as a preliminary tool in several graph analytics like graph clustering [8], [9], [10], locality optimizing graph relabeling (reordering) [11], graph partitioning and processing [12], [13]. Algorithms for finding connected components in a graph can be placed in one of three classes:

  1. Flood Filling CC [14], [15], [16], [17] performs breadth- first search (BFS) or depth-first search (DFS) to identify all vertices that are reachable from a chosen starting point. A BFS/DFS search is required for each component.
  2. Label Propagation CC (LP-CC) [18] iteratively updates the label of each vertex by calculating the minimum value between labels of its neighbours. Label Propagation CC can be specified in terms of generalized Sparse Matrix- Vector (SpMV) multiplication.

Speedup

0

5

10

15

20

25

SkyLakeX Epyc

DO-LP JT Afforest Thrifty

Fig. 1: Average speedup normalized to DO-LP

  1. Disjoint Set CC [19], [20], [21], [22] uses the disjoint set data structure to group connected vertices in the same set. As sets are often represented as trees, these algorithms have also been called “tree-hooking” algorithms [23]. Some studies have identified that Disjoint Set CC is more efficient than Flood Filling and Label Propagation [22], [24]. This is especially true for graph datasets with high diame- ters [25], such as road networks. Moreover, in the case of graphs with skewed degree distribution, such as those found in social networks and web graphs, Disjoint Set CC minimizes the number of times each edge is processed. Jayanti and Tarjan process each edge just once [21] while Afforest processes each edge on average slightly more than once [22]. However, Disjoint Set CC is not scalable and has not been effective in distributed processing [26]. In contrast, the Label Propagation CC follows a SpMV model that has been successfully scaled to distributed systems [27], [28], [29]. In this paper, we present a new perspective on the CC algo- rithm by investigating the implications imposed by real-world graphs on the efficiency of the label propagation process of the LP-CC algorithm. Many real-world graphs derived from social networks, the internet, and the world-wide web show a heavy- tailed skewed degree distribution. In other words, a very small fraction of the vertices are connected to a disproportionately large fraction of edges. This particular relationship between vertices merits special attention. We identify 4 main problems in LP-CC: (1) repeated wave- fronts, (2) propagating labels to converged vertices, (3) incor-

© 2021 IEEE. Personal use of this material is permitted. Permission from IEEE must be obtained for all other uses, in any current or future media, including reprinting/republishing this material for advertising or promotional purposes, creating new collective works, for resale or redistribution to servers or lists, or reuse of any copyrighted component of this work in other works. 2168-9253/21/©2021 IEEE https://doi.org/10.1109/Cluster48925.2021.

rect initial label assignment, and (4) weak bootstrapping label propagation. Then, we introduce Thrifty Label Propagation as our solution to remedy these problems using four optimiza- tion techniques: (1) Unified Labels Array, (2) Zero Conver- gence, (3) Zero Planting, and (4) Initial Push. We evaluate the Thrifty algorithm against state-of-the-art CC algorithms Afforest [22], Jayanti-Tarjan (JT) [21], BFS- CC [30], and Shiloach-Vishkin (SV) [19]. Moreover, we eval- uate Thrifty for 2 different processor architectures: Intel Sky- LakeX and AMD Epyc with 32 and 128 cores, respectively. Figure 1 compares the speedup of different CC algorithms for different architectures. Our evaluation shows that Thrifty is faster than Afforest, JT, BFS-CC, and SV by 1. 4 ×, 7. 3 ×,

  1. 7 ×, and 51. 2 ×, respectively. In comparison to Direction Optimizing Label Propagation, Thrifty shows 25. 2 × speedup. This paper is structured as follows: Section II explains key background materials. Section III explains the main in- efficiencies in the Label Propagation algorithm in processing real-world graphs with power-law degree distribution, and Section IV introduces four optimization techniques to solve these problems. Section V evaluates our new Thrifty algorithm and Section VI discusses further related work. Future work is discussed in Section VII.

II. BACKGROUND A simple graph or undirected graph G = (V, E) has a set of vertices V , and a set of edges E between these vertices. Edges are unordered pairs of elements of V. Nv is the set of neighbours of vertex v. We consider algorithms for static graphs, which are immutable during the evaluation of the algorithms. We represent undirected graphs using a compressed sparse (rows or columns) representation [31]. This is a compact representation that is generally assumed in graph processing. A drawback of this representation is that each edge is represented twice: once pointing from a vertex to its neighbour, and once pointing back from the neighbour to the vertex. This representation simplifies information flow across edges in both directions. Afforest also assumes this representation in support of sampling edges incident to specific vertices [22]. Some algorithms, like the Jayanti and Tarjan algorithm, operate correctly on a coordinate representation, where each edge appears precisely once [21]. A frontier F is a data structure that represents a set of active vertices F.V and a set of active edges F.E that is induced by the vertex set: F.E = {(v, u) ∈ E|v ∈ F.V ∧ u ∈ Nv }. Frontiers may be implemented as worklists (listing specifically the active vertices in F.V ), or as a bitmap or boolean array (storing a boolean value for each vertex v ∈ V that indicates if v ∈ F.V ). Graph processing systems dynamically switch between these representations depending on the density of the frontier, i.e., the number of vertices and edges it contains compared to the size of the graph [32]. The principle of LP is that each vertex is initially assigned a unique integer label. Each vertex subsequently compares its label to the labels of its neighbours and updates its label to

Algorithm 1: Direction Optimizing LP CC Input: G(V, E), new lbls[ ], old lbls[ ] 1 F rontier old f r(V ), new f r; /* Initial label assignment (^) / 2 par for v ∈ V 3 old lblsv = new lblsv = v; 4 old f r.set(v); 5 do 6 new f r.reset(); / Identifying direction (^) / 7 density = (|old f r.V | + |old f r.E|)/|E|; 8 if density < threshold then / Push traversal (^) / 9 par for v ∈ old f r 10 for u ∈ Nv do 11 if atomic min(&new lblsu, old lblsv ) then new f r.set(u) ; 12 else / Pull traversal (^) / 13 par for v ∈ V 14 new label = old lblsv ; 15 for u ∈ Nv do 16 if old lblsu < new label then 17 new label = old lblsu; 18 if new label < old lblsv then 19 new lblsv = new label; 20 new f r.set(v); / Synchronizing labels arrays (^) */ 21 par for v ∈ V 22 old lblsv = new lblsv ; 23 swap(new f r, old f r); 24 while |old f r|;

be the smallest among them. This process is repeated for all vertices in the graph during one iteration of the algorithm. Subsequent iterations repeat this process until no further changes are made to the labels. The initially assigned labels can be chosen freely, as long as each vertex has a distinct label.

A. Direction Optimizing Label Propagation The direction optimizing graph traversal selects push or pull traversal based on the number of vertices and edges that should be processed [33], [34]. Direction Optimizing Label Propagation (DO-LP) has been implemented in different graph processing frameworks including [35], [25], [28], [36], [37], [38], [39]. We present here a version of the algorithm that is broadly considered as the state of the art Label Propagation algorithm (Algorithm 1). DO-LP maintains two arrays to store labels of vertices: old lbls holds the labels derived during the previous iteration, while new lbls holds the updated labels calculated in the current iteration. DO-LP uses two frontiers to manage active vertices in each iteration: (1) the new f r collects vertices

Initial Labels After Initial Push After Iteration 0 After Iteration 1

E

A

B

C

D

Fig. 4: Label propagation in the Thrifty

B. Preaching to the Converged

The DO-LP algorithm tries to minimize the amount of com- putation by tracking which vertices had their label changed. In this way, only changed labels are propagated. However, this still causes redundant work. Figure 3 shows the percentage of vertices that are active at the start of pull iterations, as well as the percentage of vertices that have converged to their final value. Converged vertices have reached their final values and do not need to be processed further. Figure 3 demonstrates that convergence is very slow in the first iterations as well as in the final iterations. In between, convergence occurs very quickly with 30–60% of the vertices converging during one iteration. These are the most effective iterations. However, during these and the following iterations, there is redundant activity: the number of active vertices is high as well as the number of converged vertices. Hence, most of the active vertices will try to propagate their label to a vertex that has already converged. In other words, DO-LP performs excess work by processing all edges of the graph in pull iterations as it is not able to identify if vertices have converged.

C. Inefficient Initial Label Assignment

The propagation of labels is in part driven by the initial label assignment. For instance, in Figure 2, a small label is assigned to the vertex A which is on the fringe of the graph. The label is propagated to the core of the graph over several iterations. During the first iterations, however, other labels are also propagated between vertices like E, D, and C. When A’s label reaches C, the traversal inside the core has to be repeated all over. However, when labels are assigned differently, LP is more efficient. Note the degree of freedom in choosing the initial label assignment: the only constraint is that all vertices initially have distinct labels. If vertex E is initially assigned the smallest label (Figure 4), then the label is first propagated in the core of the network, which then stabilises. The label is subsequently propagated out to vertex E, causing fewer label updates in total. This shows that the initial label assignment affects performance and that structure-oblivious initial label assignment prevents efficient propagation of the labels.

D. Eager Bootstrapping Label Propagation

DO-LP starts with propagating the label of each vertex to its neighbours, as indicated by initializing new f r to contain all vertices. This is necessary initially as we need to compare the label of a vertex at least once to all its neighbours.

However, doing this right at the start is inefficient as very few vertices converge to their final label in the very first iterations (Figure 3). The cause of this inefficiency can be found in the fact that most vertices have a large label. However, in skewed- degree graphs, most vertices also have neighbours with large labels. As such, in the first iterations of the DO-LP, there is little opportunity to reduce the magnitude of the label significantly. Even worse, most updates will be overridden by future wavefronts carrying smaller labels. As such, the initial pull iterations of the DO-LP are work inefficient. IV. THRIFTY LABEL PROPAGATION We introduce 4 optimization techniques to address the inef- ficiencies of DO-LP described above. These are implemented in Algorithm 2. A. Unified Labels Array DO-LP incurs a slow label propagation, with a wavefront progressing at most one hop per iteration (Section III-A). We address this by employing a Unified Labels Array that uses only one array for labels, as opposed to different arrays for the old and new labels. In this way, updated labels can be propagated already within the same iteration as they are calculated, simply by reading the values from the same array (or memory location) as they were written to. Section V-C1 shows that the number of iterations is reduced by up to 89% and on average by 39%, as a result of accelerating label propagation by using one labels array. By using one labels array, the label arrays’ synchronization in Lines 21-22 of the Algorithm 1 is removed in Algorithm 2. This reduces the execution time of sparse push iterations significantly. B. Zero Convergence DO-LP is prone to processing many vertices that have already converged on their final label (Section III-B). As such, we desire to recognise when vertices have converged and, once they have converged, we skip processing these vertices. But how can we know if a vertex has converged? Hereto, we make two observations. Firstly, the LP algorithm performs the “minimum” arith- metic operation on the labels of each pair of neighbouring vertices. The arguments to the minimum operation are the labels, which are integers. It is important to note that the LP algorithm does not create new labels. It only copies over labels from one vertex to another, in such a way that larger labels are overwritten by smaller labels. As such, we know that the

Algorithm 2: Thrifty Label Propagation Input: G(V, E), labels[ ] 1 F rontier old f r(V ), new f r; /* Initial label assignment (^) / 2 / Zero Planting (^) / 3 par for v ∈ V 4 labelsv = v + 1; 5 if v.degree > M ax Degreesthread id then 6 M ax Degreesthread id = v.degree; 7 M ax Idsthread id = v; 8 max degree id = max(M ax Degrees, M ax Ids); 9 labelsmax degree id = 0; 10 / Initial Push (^) / 11 par for v ∈ Nmax degree id 12 labelsv = 0; 13 do 14 new f r.reset(); / Identifying direction (^) / 15 density = (|old f r.V | + |old f r.E|)/|E|; 16 if density < new threshold then / Push traversal (^) / 17 par for v ∈ old f r 18 for u ∈ Nv do 19 if atomic min(&labelsu, labelsv ) then 20 new f r.set(u) 21 else / Pull traversal (^) / 22 par for v ∈ V 23 / Zero Convergence (^) / 24 if labelsv == 0 then 25 continue; 26 new label = labelsv ; 27 for u ∈ Nv do 28 if labelsu < new label then 29 new label = labelsu; 30 / Zero Convergence (^) */ 31 if new label == 0 then 32 break; 33 if new label < labelsv then 34 labelsv = new label; 35 new f r.set(v); 36 swap(new f r, old f r); 37 while |old f r|;

smallest label that any vertex can ever obtain is the same as the smallest label in the initial assignment of labels. In our case, that is zero. As such, we can safely assume that any vertex holding a zero label has converged – it cannot be updated further. Our second observation answers the question: Are there many vertices that will converge to the zero label? The answer is based on the high connectivity of vertices in real-world skewed-degree graphs. Table I shows the percentage of vertices of each dataset that are in the largest component. It shows

TABLE I: Percentage of vertices in the component containing the vertex with the maximum degree Dataset Vertices% Dataset Vertices% Dataset Vertices% Pkc 100 WWiki 99.8 LJLnks 99. LJGrp 100 Twtr10 100 Twtr 99. Wbbs 97.9 TwtrMpi 100 Frndstr 100 SK 100 WbCc 98.9 UKDls 99. UU 99.3 UKDmn 99.2 ClWb9 94.

that more than 94% of vertices of power-law graphs are connected to each other. This corresponds to the notion of a giant component, which forms naturally in skewed-degree graphs [40]. Thus, more than 94% of the vertices can converge to the zero value provided that the zero label is assigned to a vertex in the giant component. Moreover, assuming that initial labels are assigned uniformly at random, the zero label will be assigned to the giant component with a probability of 94%. The Zero Convergence optimization is implemented by adding two branches in Lines 24 and 31 of the Algorithm 2, which check if the vertex has converged to zero. If so, we do not need to process the vertex further. Moreover, the branch at line 31 implies that processing of a vertex terminates immediately, as soon as its label becomes zero. Section V-C2 shows that Zero Convergence tremendously reduces the total processed edges: on average, DO-LP pro- cesses each edge 7. 7 times, while Thrifty processes only 1.4% of the edges. C. Zero Planting In Section III-C we explained that DO-LP assigns initial labels inefficiently which results in long propagation paths and repeated wavefronts. To solve this, we need to ensure that the smallest label is initially placed in the core of the graph, and not on the fringes. Considering also the Zero Convergence optimization, we should maximize the chance that the zero label is assigned to the giant component. This is captured in the Zero Planting technique. We employ a simple heuristic to plant the zero label at the start of the algorithm, namely to plant it in the vertex with the highest degree. The rationale is two-fold: In a skewed-degree graph with a giant component, the highest-degree vertex is almost certainly a member of the giant component (if not, the component containing the highest-degree vertex cannot be giant). Secondly, the highest-degree vertex is likely a hub vertex, i.e., it has a high centrality within the graph. As such, it is few hops away from the other vertices in the same component. The Zero Planting technique is implemented in Lines 3- 9 of the Algorithm 2. The label of vertex v is initialized by v + 1 (instead of v), and the zero label is reserved for the vertex with the maximum degree. In Lines 5-7, each parallel thread (with ID thread id) finds its local maximum degree and the vertex with the maximum degree (between maximum degrees reported by threads) receives the zero label in Line 9. Section V-C3 shows that the Zero Planting technique provides a very fast convergence rate of 88% of the vertices

TABLE II: Datasets Dataset Name Type Power-Law Source (^) |V| (M) |E| (B) |CC| GBRd GB Roads Road Network No NR 8 0.016 1 USRd US Roads Road Network No NR 24 0.058 1 Pkc Pokec Social Network Yes KN 1.6 0.044 1 WWiki War Wikipedia Links Knowledge Graph Yes KN 2 0.052 1, LJLnks LiveJournal Links Social Network Yes KN 5 0.098 4, LJGrp LiveJournal Group Memberships Social Network Yes KN 7 0.225 1 Twtr10 Twitter 2010 Social Network Yes NR 21 0.530 1 Twtr Twitter Social Network Yes NR 28 0.956 31, Wbbs WebBase-2001 Web Graph Yes LWA 115 1.737 236, TwtrMpi Twitter-MPI Social Network Yes NR 41 2.405 1 Frndstr Friendster Social Network Yes NR 65 3.612 1 SK SK-Domain Web Graph Yes LWA 50 3.639 45 WbCc Web-CC12 Web Graph Yes NR 89 3.872 464, UKDls UK-Delis Web Graph Yes LWA 110 6.919 80, UU UK-Union Web Graph Yes LWA 133 9.359 278, UKDmn UK-Domain Web Graph Yes KN 105 6.603 14, ClWb9 ClueWeb09 Web Graph Yes NR 1,685 15.622 5,642, TABLE III: Computing Machines

SkyLakeX Epyc CPU Model Intel Xeon Gold 6130 AMD Epyc 7702 CPU Frequency 2.10 GHz 2 GHz Sockets 2 2 NUMA Nodes 2 8 Total CPU Cores 32 128 Hyperthreading No No Total Threads 32 128 L1 Cache 32 KB / 1 core 32 KB / 1 core L2 Cache 1 MB / 1 core 512 KB / 1 core L3 Cache 22 MB / 16 cores 16 MB / 4 cores Total Memory 768 GB 2,048 GB

V. EVALUATION

A. Machines and Datasets

We use two different machines listed in Table III for evaluation. The machines use CentOS 7. We use an optimized implementation of CC in the C language that deploys the pthread, libnuma, and papi [42] libraries. We use the in- terleaved NUMA memory policy and apply work-stealing [43] for parallel processing of graph partitions created by vertex and edge partitioning [44], [25]. We create 32 ∗ #threads edge balanced partitions and partitions [32∗t, 32 ∗(t+1)) are initially assigned to thread t. A thread processes its own partitions and then steals partitions from threads on the same NUMA node and finally from threads on other NUMA nodes. In order to preserve locality in processing consequent partitions and increase reuse of cache contents, a thread processes its own partitions in ascending order and steals partitions from other threads in descending order. We use the master-worker model for managing parallel threads and the futex syscall for thread synchronization. We compiled the source code using the gcc-9.2 compiler with -O3 optimization flag.

Table II shows the datasets and their sources: “Konect” (KN) [45], [46], [47], “NetworkRepository” (NR) [48], [49], [50], [51], [52], and “Laboratory for Web Algorithmics” (LWA) [47], [53], [49], [54], [55]. Numbers of edges are in billions and numbers of vertices are in millions, counted after removing zero degree vertices because of their destructive effect [25]. Graphs are represented in Compressed Sparse Row/Column [31] with |V | + 1 index values of 8 bytes per index value and |E| neighbour IDs of 4 bytes each. The column |CC| shows the number of connected components in each dataset. We use 4 bytes data as label of a vertex. For comparison to other CC algorithms, we use BFS-CC implemented in GraphGrind [30], [25] (commit 5099761 ), and the Shiloach-Vishkin and Afforest implementations in GAP [56] (commit 6ac1afd).

B. Comparison to Prior State of the Art

Table IV compares Thrifty to the prior state-of-the-art CC algorithms. For road networks (GBRd and USRd) that do not follow a power-law degree distribution SV, JT and Afforest are faster than Thrifty. For graphs larger than LiveJournal, Thrifty has the best results on both architectures: on the SkyLake machine, Thrifty provides up to 3. 9 × and on av- erage 1. 6 × speedup to Afforest, and 8. 4 × − 54. 6 × speedup compared to the SV, JT, and BFS-CC algorithms. On the EPYC machine Thrifty provides 1. 5 × speedup over Afforest and 7. 3 × − 65. 3 × over SV, JT, and BFS-CC algorithms. The importance of Thrifty is not limited to having faster execution time in comparison to Disjoint Set algorithms. Disjoint Set algorithms like SV, Afforest, and JT are con- current algorithms that do not scale to distributed memory systems. One attempt at distributed disjoint sets notes lack of scalability and net performance loss compared to sequential algorithms [26]. In contrast, the SpMV model of the Label Propagation algorithm allows successful scaling in distributed systems [28], [29].

TABLE IV: CC execution times in milliseconds for Shiloach-Vishkin (SV), BFS-CC, Direction Optimizing Label Propaga- tion (DO-LP), Jayanti-Tarjan (JT), Afforest, and Thrifty Label Propagation (Thrifty)

Dataset Intel SkyLakeX AMD Epyc SV BFS-CC DO-LP JT Afforest Thrifty SV BFS-CC DO-LP JT Afforest Thrifty GBRd 32 494 12,131 24 13 383 185 875 12,233 24 93 677 USRd 120 1,037 38,435 85 38 992 268 1,760 20,752 46 116 1, Pkc 34 24 52 23 6 9 28 39 69 40 6 20 WWiki 61 28 52 30 4 9 60 55 77 116 6 28 LJLnks 114 95 111 56 13 14 72 133 183 61 13 20 LJGrp 928 94 141 58 20 12 856 127 118 61 16 24 Twtr10 3,849 351 816 634 56 38 4,277 215 689 1,012 122 49 Twtr 3,017 577 918 307 50 49 2,895 1,016 734 270 117 44 Wbbs 2,794 2,931 9,822 972 187 169 3,208 5,059 6,251 956 182 143 TwtrMpi 7,544 723 3,186 1,067 264 67 5,740 556 2,793 828 152 70 Frndstr 10,405 1,556 11,709 2,559 207 159 6,516 677 13,446 2,483 225 129 SK 1,985 768 1,631 566 153 104 1,518 858 1,095 209 145 108 WbCc 25,673 4,267 5,831 1,977 213 148 28,790 7,346 6,090 1,419 248 109 UKDls 3,587 1,358 4,773 925 299 234 2,391 1,913 2,903 310 202 198 UU 4,580 3,190 6,128 1,760 343 246 3,470 4,879 3,738 708 253 187 UKDmn 3,776 1,146 3,781 877 258 235 1,934 1,462 2,527 299 213 178 ClWb9 170,879 - 47,397 13,942 3,665 3,138 210,342 148,586 36,776 11,509 2,470 1,

A second limitation of the Disjoint Set algorithms originates from the fact that concurrent algorithms are very specific solutions to a problem and require great precision in their design and implementation [57]. Concurrent algorithms have limited potential to generalize to other problems. In contrast, the Thrifty algorithm that follows a SpMV model is more generic and conceptually simple. Numerous frameworks have been defined that present a reusable interface and hide numer- ous performance optimizations behind that interface, out of the concern of the user [27], [28], [29], [37], [58], [39].

C. Has Thrifty Reached Its Goals?

In this section we consider more details of the execution of Thrifty to identify if it has reached the goals we explained in Section IV. In the experiments of this section when we refer to iterations of Thrifty, we count the Initial Push as an iteration.

  1. Faster Label Propagation and Reducing Number of Iterations: To facilitate faster propagation of the labels, we suggested using the Unified Labels Array technique and Table V shows that Thrifty reduces the total iterations by 39%, on average. For WebBase-2001, Thrifty reduces total iterations by 89%.
  2. Work Reduction: Figure 5 compares the speedup pro- vided by Thrifty in comparison to DO-LP. It also shows the percentage of edges of graphs that are processed by the Thrifty and DO-LP algorithms. It shows that Thrifty reduces the total traversed edges by at least 97%. In fact, Thrifty processes up to only 4.4% of the edges of the graph which shows the Zero Convergence can significantly reduce the total work. Figure 6 also compares Thrifty to DO-LP for reduction in (1) the last level cache misses, (2) memory accesses (load and store memory instructions), (3) branch mis-predictions, and (4) hardware instructions. It shows that Thrifty cuts at least 80% of the redundant work done by DO-LP.

TABLE V: Comparison of the number of iterations required by DO-LP and Thrifty Dataset DO-LP Thrifty Ratio Pkc 10 5 0. WWiki 17 13 0. LJLnks 15 6 0. LJGrp 7 4 0. Twtr10 17 12 0. Twtr 15 11 0. Wbbs 744 82 0. TwtrMpi 15 11 0. Frndstr 24 12 0. SK 23 20 0. WbCc 32 30 0. UKDls 79 21 0. UU 142 99 0. UKDmn 76 41 0. ClWb9 79 70 0.

  1. Faster Propagation of The Zero Label: The Zero Plant- ing technique is used in the Thrifty algorithm to propagate the zero label from the vertex with the maximum degree. To see its effect on propagation of the zero label, we compare the percentage of converged vertices in the DO-LP and Thrifty in Figures 7 and 8. It shows that in DO-LP only 34.8% of the vertices are con- verged after the first four pull iterations, but Thrifty propagates the zero label much faster which results in convergence of 88.3% of the vertices after the first pull iteration.
  2. Work Efficient Initial Iteration: To accelerate the first iterations of the Label Propagation algorithm, the Initial Push technique uses an initial push to propagate the zero label from the vertex with the maximum degree. To evaluate if this technique is useful, we compare the initial iterations of the DO-LP and Thrifty in Table VI. If we compare the time spent in the first iteration of DO-LP

0%

25%

50%

75%

100%

Pkc WWikiLJLnksLJGrpTwtr TwtrWbbs TwtrMpiFrndstr

SK WbCcUKDls

UU UKDmnClWb

Unified Label Arrays Zero Convergence + Zero Planting + Initial Push

Fig. 9: Contribution of the optimization techniques on the SkyLakeX machine

0%

25%

50%

75%

100%

Pkc WWikiLJLnksLJGrpTwtr TwtrWbbs TwtrMpiFrndstr

SK WbCcUKDls

UU UKDmnClWb

Unified Label Arrays Zero Convergence + Zero Planting + Initial Push

Fig. 10: Contribution of the optimization techniques on the Epyc machine

TABLE VI: Execution time of the first iterations on the SkyLakeX machine in milliseconds

Dataset DO-LP Thrifty Speedup Iteration 0 Iteration 0 Iteration 1

Pull Initial Push

Pull with Zero Convergence Pkc 6.1 0.9 2.0 2. WWiki 5.1 1.5 1.2 1. LJLnks 12.6 0.6 4.5 2. LJGrp 24.7 0.9 3.5 5. Twtr10 106.6 2.0 17.6 5. Twtr 170.7 3.3 17.6 8. Wbbs 136.2 1.7 71.1 1. TwtrMpi 617.4 3.4 40.2 14. Frndstr 1,415.9 0.7 107.3 13. SK 176.1 3.6 52.2 3. WbCc 799.0 5.6 73.7 10. UKDls 325.8 1.7 133.3 2. UU 452.1 3.2 144.8 3. UKDmn 319.5 1.8 122.7 2. ClWb9 4,350.2 12.2 1,435.7 3.

TABLE VII: Effect of the threshold Threshold = 1% Threshold = 5% Iteration Traversal Density Time (ms) Traversal Density Time (ms) 2 Pull 1.16% 11.7 Pull 1.13% 11. 3 Pull 0.01% 6.8 Pull Frontier - 8. 4 Pull Frontier - 5.0 Push - 20. 5 Push - 2.3 Push - 0.

of the first iterations of the Friendster dataset on the Epyc machine. By using 1% as the threshold, iteration 4 is performed in the pull direction that requires 5ms but it is 20ms in the push direction. It shows that the Zero Convergence optimization is able to accelerate the pull iterations which makes it harder for the push traversal to compete. Therefore, it is necessary to have a smaller threshold.

VI. RELATED WORK The effectiveness of push and pull traversals for different graph analytics is discussed in [59], [33], [34], and the differences between locality of push and pull traversals have

been studied in [60]. iHTL [61] optimizes temporal locality by applying push and pull directions in one graph traversal but for different types of vertices. In order to improve the performance of the CC algorithm, we have used the direction optimizing CC as the baseline. DO-LP selects push traversal for sparse iterations (where a small number of vertices are in the frontier) and applies pull traversal for dense iterations. The Shiloach-Vishkin CC algorithm [19] is the first Disjoint Set CC. It makes a number of iterations, each of which makes a pass over the graph. Each iteration is started by a hook phase that attaches roots of subgraphs based on edges and is followed by a shortcut phase that updates the label of each vertex of subgraphs by the label of its root. BFS is used in [62] to accelerate SV. FastSV [63] improves performance of LACC [64], however, both algorithms use MIN operator over labels to decide if the label of a vertex should be changed. It makes these algorithms variants of the Label Propagation CC instead of SV. The main difference between LP and SV algorithms is in the observations that result in changing the label of a vertex: SV-based algorithms consider the topology of a graph (i.e., edges between vertices) to change their labels, while LP-based algorithms consider the label of a vertex in relation to labels of its neighbours to identify its new label. Shortcutting technique is used in [65] to accelerate the label propagation CC. The Jayanti-Tarjan [21] optimizes the SV algorithm based on a linearizable randomized linking strategy. It requires only one traversal of the graph. Afforest [22] uses sampling to reduce the total number of processed edges. ConnectIt [24] extends Afforest by combining various sampling methods with various CC algorithms. We attempted to evaluate ConnectIt but its code repository was under modification and could not be compiled (we are communicating on this with the authors).

VII. CONCLUSION AND FUTURE WORK The conceptual simplicity, in conjunction with the uncon- tested dominance of Label Propagation in distributed memory systems, prompts us to revisit Label Propagation in shared memory systems. We developed performance optimization techniques to improve the DO-LP algorithm based on the features implied by the structure of real-world graph datasets that follow a scale-free degree distribution:

  1. The Unified Labels Array technique reduces the number of iterations by 39%.
  2. The Zero Convergence technique reduces the number of processed edges of the graphs to 1.4% of the edges, on average.
  3. The Zero Planting technique provides fast convergence of 88% of the vertices after the first pull iteration.
  4. The Initial Push technique accelerates the initial iteration of label propagation by 5. 3 ×, on average. We introduced Thrifty Label Propagation, which deploys these techniques. Our evaluation of Thrifty against state-of- the-art CC algorithms on two different processor architectures shows 1. 4 × speedup over Afforest, 7. 3 × over Jayanti-Tarjan,
  1. 7 × over BFS-CC, 51. 2 × over SV. The Thrifty algorithm is faster than the Direction Optimizing Label Propagation by
  2. 2 ×. An important question for future work is how Thrifty applies in a distributed processing setting, where label propagation algorithms are the norm. We plan to apply Thrifty to a distributed processing model like KLA [38]. Moreover, the unordered scheduling of the vertices based on the KLA model can be used in a shared memory system to provide better CPU utilization. The optimization techniques we expressed for the Label Propagation algorithm are not strictly limited to connected components. In future work we will investigate how these can be generalized to other algorithms expressed in the SpMV model of graph processing. In particular, we wish to explore the connection between the unified arrays optimization and asynchronous execution.

CODE AVAILABILITY Source code repository and further discussions relating to this paper are available online in https: //blogs.qub.ac.uk/graphprocessing/Thrifty-Label-Propagation- Fast-Connected-Components-for-Skewed-Degree-Graphs/.

ACKNOWLEDGEMENTS We are grateful for the constructive feedback of our CLUS- TER reviewers. This work is partially supported by the High Performance Computing center of Queen’s University Belfast and the Kelvin supercomputer (EPSRC grant EP/T022175/1) and by DiPET (CHIST-ERA project CHIST-ERA-18-SDCDN-002, EPSRC grant EP/T022345/1). First author is supported by a scholarship of the Department for the Economy, Northern Ireland and Queen’s University Belfast.

REFERENCES [1] R. Albert, “Scale-free networks in cell biology,” Journal of cell science, vol. 118, no. 21, pp. 4947–4957, 2005. [2] Y. Assenov, F. Ram´ırez, S.-E. Schelhorn, T. Lengauer, and M. Albrecht, “Computing topological parameters of biological networks,” Bioinfor- matics, vol. 24, no. 2, pp. 282–284, 11 2007. [3] F. H¨uffner, C. Komusiewicz, A. Liebtrau, and R. Niedermeier, “Partition- ing biological networks into highly connected clusters with maximum edge coverage,” IEEE/ACM transactions on computational biology and bioinformatics, vol. 11, no. 3, pp. 455–467, 2013.

[4] M. Dillencourt, H. Samet, and M. Tamminen, “A general approach to connected-component labeling for arbitrary image representations,” J. ACM, vol. 39, pp. 253–280, 1992. [5] S. Gazagnes and M. H. Wilkinson, “Distributed connected component filtering and analysis in 2d and 3d tera-scale data sets,” IEEE Transac- tions on Image Processing, vol. 30, pp. 3664–3675, 2021. [6] E. J. Ruiz, V. Hristidis, C. Castillo, A. Gionis, and A. Jaimes, “Correlat- ing financial time series with micro-blogging activity,” in Proceedings of the Fifth ACM International Conference on Web Search and Data Mining, ser. WSDM ’12. New York, NY, USA: ACM, 2012, p. 513–522. [7] W. Jang and M. Hendry, “Cluster analysis of massive datasets in astronomy,” Statistics and Computing, vol. 17, no. 3, pp. 253–262, 2007. [8] M. Ester, H.-P. Kriegel, J. Sander, and X. Xu, “A density-based al- gorithm for discovering clusters in large spatial databases with noise,” in Proceedings of the Second International Conference on Knowledge Discovery and Data Mining, ser. KDD’96. AAAI Press, 1996, p. 226–231. [9] J. Gan and Y. Tao, “DBSCAN revisited: Mis-claim, un-fixability, and ap- proximation,” in Proceedings of the 2015 ACM SIGMOD International Conference on Management of Data, ser. SIGMOD ’15. New York, NY, USA: ACM, 2015, p. 519–530. [10] X. Xu, N. Yuruk, Z. Feng, and T. A. J. Schweiger, “Scan: A structural clustering algorithm for networks,” in Proceedings of the 13th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, ser. KDD ’07. New York, NY, USA: ACM, 2007, pp. 824–833. [11] Y. Lim, U. Kang, and C. Faloutsos, “Slashburn: Graph compression and mining beyond caveman communities,” IEEE Transactions on Knowledge and Data Engineering, vol. 26, no. 12, pp. 3077–3089, Dec

[12] A. Roy, I. Mihailovic, and W. Zwaenepoel, “X-stream: Edge-centric graph processing using streaming partitions,” in Proceedings of the Twenty-Fourth ACM Symposium on Operating Systems Principles, ser. SOSP ’13. New York, NY, USA: ACM, 2013, pp. 472–488. [13] V. Singh and T. E. Carlson, “Pim-graphscc: Pim-based graph process- ing using graph’s community structures,” IEEE Computer Architecture Letters, vol. 19, no. 2, pp. 151–154, 2020. [14] R. Tarjan, “Depth first search and linear graph algorithms,” Siam Journal on Computing, vol. 1, no. 2, 1972. [15] S. Orzan, “On distributed verification and verified distribution,” Ph.D. dissertation, PhD thesis, Free University of Amsterdam, 2004. [16] L. Fleischer, B. Hendrickson, and A. Pinar, “On identifying strongly connected components in parallel,” in Proceedings of the 15 IPDPS 2000 Workshops on Parallel and Distributed Processing, ser. IPDPS ’00. Berlin, Heidelberg: Springer-Verlag, 2000, p. 505–511. [17] G. Slota, S. Rajamanickam, and K. Madduri, “BFS and coloring- based parallel algorithms for strongly connected components and related problems,” in Proceedings - IEEE 28th International Parallel and Distributed Processing Symposium, IPDPS 2014, ser. Proceedings of the International Parallel and Distributed Processing Symposium, IPDPS. United States: IEEE Computer Society, 2014, pp. 550–559. [18] U. N. Raghavan, R. Albert, and S. Kumara, “Near linear time algorithm to detect community structures in large-scale networks,” Physical review E, vol. 76, no. 3, p. 036106, 2007. [19] Y. Shiloach and U. Vishkin, “An o(logn) parallel connectivity algorithm,” Journal of Algorithms, vol. 3, no. 1, pp. 57–67, 1982. [20] R. J. Anderson and H. Woll, “Wait-free parallel algorithms for the union-find problem,” in Proceedings of the Twenty-Third Annual ACM Symposium on Theory of Computing, ser. STOC ’91. New York, NY, USA: ACM, 1991, p. 370–380. [21] S. V. Jayanti and R. E. Tarjan, “A randomized concurrent algorithm for disjoint set union,” CoRR, vol. abs/1612.01514, 2016. [22] M. Sutton, T. Ben-Nun, and A. Barak, “Optimizing parallel graph connectivity computation via subgraph sampling,” in 2018 IEEE In- ternational Parallel and Distributed Processing Symposium (IPDPS). IEEE, 2018, pp. 12–21. [23] B. Awerbuch and Y. Shiloach, “New connectivity and msf algorithms for shuffle-exchange network and pram,” IEEE Trans. Comput., vol. 36, no. 10, p. 1258–1263, Oct. 1987. [24] L. Dhulipala, C. Hong, and J. Shun, “Connectit: A framework for static and incremental parallel graph connectivity algorithms,” CoRR, vol. abs/2008.03909, 2020.