scieee AI-readable full text Open interactive document viewer

Maintaining the minimum spanning forest of fully dynamic graphs on the dynamic pipeline computational pattern

Benedí García, Daniel

Abstract

In this work we tackle the problem of using the Dynamic Pipeline Approach to parallelize the Kruskal's algorithm and thus compute and maintain the Minimum Spanning Tree of dynamic graphs in parallel and distributed settings. To achieve this, we introduce a characterization of graphs that we call an underlying forest of a graph. This characterization gives the basis for representing graphs in a distributed way along a dynamic pipeline. The proposed algorithm, named DP_Kruskal, utilizes a pipeline architecture where the graph is partitioned into trees and distributed across a sequence of stages each handling different aspects of computation. Under this algorithm it possible to keep efficiently graph updates as well as to apply Kruskal's Algorithm at every stage of the pipeline to compute incrementally the minimum spanning tree of the stored graph. A working implementation was developed to analyze the suitability of DP_Kruskal against other algorithms. The programming language Go was chosen because of its concurrency features, as its goroutines and communication channels naturally align with the Dynamic Pipeline Approach. Several key optimizations were introduced in DP_Kruskal. Some of them regarding the implementation and others the Dynamic Pipeline Approach. Notably, we propose a way to disentangle the message passing from computational tasks which is a general optimization that enhances the entire Dynamic Pipeline Approach framework, not just for DP_Kruskal. These optimizations not only improve program's efficiency but also address and resolve memory management issues within Go. Extensive experimental evaluations were conducted to compare DP_Kruskal with both sequential and parallel algorithms. Kruskal's algorithm was selected for sequential comparisons, while Filter_Kruskal and a message-passing implementation of Prim's algorithm for parallel algorithms. The results demonstrate that DP_Kruskal significantly outperforms its counterparts in both single-core and parallel environments, showcasing its superior performance and scalability for handling large and dynamic graphs. This work substantiates the effectiveness of the Dynamic Pipeline Approach in addressing complex graph problems and underscores its potential for wider application in parallel computing.

Full text

id188441   MAINTAINING THE MINIMUM SPANNING FOREST OF FULLY DYNAMIC GRAPHS ON THE DYNAMIC PIPELINE COMPUTATIONAL PATTERN DANIEL BENEDÍ GARCÍA Thesis supervisor AMALIADUCHBROWN(DepartmentofComputerScience) Thesis co-supervisor EDELMIRAPASARELLASANCHEZ(DepartmentofComputerScience) Degree Master'sDegreeinInnovationandResearchinInformatics(AdvancedComputing) Master's thesis Facultat d'Informàtica de Barcelona (FIB) Universitat Politècnica de Catalunya (UPC) - BarcelonaTech 28/06/2024  I have attempted science - Strange Planet. Nathan W Pyle ii Abstract In this work we tackle the problem of using the Dynamic Pipeline Approach to parallelize the Kruskal’s algorithm and thus compute and maintain the Minimum Spanning Tree of dynamic graphs in parallel and distributed settings. To achieve this, we introduce a characterization of graphs that we call an underlying forest of a graph. This characterization gives the basis for representing graphs in a distributed way along a dynamic pipeline. The proposed algorithm, named DP Kruskal, utilizes a pipeline architecture where the graph is partitioned into trees and distributed across a sequence of stages each handling different aspects of computation. Under this algorithm it possible to keep efficiently graph updates as well as to apply Kruskal’s Algorithm at every stage of the pipeline to compute incrementally the minimum spanning tree of the stored graph. A working implementation was developed to analyze the suitability of DP Kruskal against other algorithms. The programming language Go was chosen because of its concurrency features, as its goroutines and communication channels naturally align with the Dynamic Pipeline Approach. Several key optimizations were introduced in DP Kruskal. Some of them regarding the implementation and others the Dynamic Pipeline Approach. Notably, we propose a way to disentangle the message passing from computational tasks which is a general optimization that enhances the entire Dynamic Pipeline Approach framework, not just for DP Kruskal. These optimizations not only improve program’s efficiency but also address and resolve memory management issues within Go. Extensive experimental evaluations were conducted to compare DP Kruskal with both sequential and parallel algorithms. Kruskal’s algorithm was selected for sequential comparisons, while Filter Kruskal and a message-passing implementation of Prim’s algorithm for parallel algorithms. The results demonstrate that DP Kruskal significantly outperforms its counterparts in both single-core and parallel environments, showcasing its superior performance and scalability for handling large and dynamic graphs. This work substantiates the effectiveness of the Dynamic Pipeline Approach in addressing complex graph problems and underscores its potential for wider application in parallel computing. iii Acknowledgements I would like to express my deepest appreciation to the supervisors of this work, Amalia Duch and Edelmira Pasarella, for their invaluable patience, insightful feedback, and refreshing motivation throughout this journey. Your guidance has been instrumental in the completion of this project. Additionally, I extend my sincere thanks to the /RDLab-UPC for providing the computational resources necessary for the experimental evaluation. Your support made the technical aspects of this research possible. I am also grateful to my colleagues and friends from the master program. You provided a warm welcome to this new step in my life, tolerated my moments of stress, and inspired me to dream big. And to my friends from Zaragoza for accompanying me up to this point no matter what happened. Last but not least, I could not have undertaken this journey without my family and their constant support throughout this research. To my parents, thank you for always supporting me and allowing me to return to my roots; to my sister, for being a beacon of inspiration; and to my significant other, for your constant love and understanding. iv Contents 1 Introduction 1 2 Preliminaries 3 2.1 Minimum Spanning Tree . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 2.2 Algorithms for Fully Dynamic MST ..................... 9 2.3 DynamicPipeline............................... 10 3 Graphs and MSTsin the DPA 13 3.1 Underlying Forests and MSTs........................ 13 3.2 DPA and MSTsof Dynamic Graphs. . . . . . . . . . . . . . . . . . . . . 15 3.3 Implementation................................ 17 3.4 Optimizations................................. 21 4 Experimental Study 25 4.1 Generation of Test Cases . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 4.2 Analysis of DP Kruskal Architecture and Optimizations . . . . . . . . . . 28 4.3 Comparison with other algorithms . . . . . . . . . . . . . . . . . . . . . . 33 4.4 Runningenvironment............................. 37 5 Conclusions and Future Work 38 References 40 A Code for simulate static random graphs in the DP Kruskal 45 B Code for simulate real dynamic graphs in the DP Kruskal 46 v Chapter 1 Introduction “The Future is Big Graphs” states the CACM paper [52] of the same title, where forty-one experts from the data management and large-scale-systems communities settled –after Dagstuhl Seminar 19491 held in Dec. 2019– their conclusions about the opportunities and challenges of graph processing in the next decade. Beyond the corroboration that graph algorithms should be scalable to deal with the huge amount of data required by nowadays applications, this group of experts claims, among other issues, that, in order to succeed, graph algorithms have to deal with dynamic and streaming aspects of graph processing. This is, coping with updates such as edge insertions, changes, and deletions (dynamicity), as well as indefinitely growth and/or evolution as new data arrive (stream model). Additionally, one of the challenges these experts identified was to define a reference architecture for big graph processing. Some representative examples are server networks, mobile phone networks, or sensor networks [41], where the devices involved in the network are represented as nodes of a graph and the communications among devices are the weighted edges of the graph, since linking a pair of devices has an associated cost. The resulting resulting graph is fully dynamic as it captures the evolution of the networks along time: new devices can be added to the network, some others might be removed, and the links among them might be modified, involving therefore the insertion and deletion of edges of the graph. Given an undirected and connected graph with weighted edges, a minimum weight spanning forest, minimum spanning forest, or simply minimum spanning tree (MST); is a subset of the edges that connects all vertices and has minimum total weight among all such sets. The MST problem is not only of theoretical interest, but also has a wide range of uses, including but not limited to clustering [8, 33], image segmentation [38, 61], and the design of networks [36]. To comprehend and forecast the dynamics of evolving networks effectively, it is essential to maintain a minimum weight spanning forest of the dynamic graph. This ensures that the network can be adjusted and reconfigured as new connections are established or existing ones are disconnected. Moreover, in current applications, it is crucial to efficiently compute and maintain a large number of network updates involving potentially a huge number of devices that might be distributed in distant spatial locations [56, 57]. 1 2CHAPTER 1. INTRODUCTION An example of dynamic graphs in which we need to maintain a minimum weight spanning forest can be found in the standard IEEE 802.1Q [28]. This standard outlines the support of the Media Access Control (MAC) Service in Bridged Networks, the operational principles of such networks, and the functioning of MAC Bridges and VLAN Bridges, encompassing aspects like management, protocols, and algorithms. In order to provide simple and full connectivity throughout a bridged network comprising arbitrarily interconnected bridges, the Spanning Tree Protocol and some of its variants, such as Rapid Spanning Tree Protocol (RSTP) or the Multiple Spanning Tree Protocol (MSTP), are used in each bridge. The primary purpose of STP is to avoid bridge loops and the broadcast storms they cause. Additionally, Spanning Tree enables a network architecture to incorporate redundant links to ensure system reliability in case a primary link malfunctions. This work focuses on applying the Dynamic Pipeline Approach (DPA) [46] to maintain a dynamic graph as well as its MST providing a parallel Kruskal’s algorithm. The study includes the development, optimization, and analysis of the DP Kruskal algorithm. Several optimizations are explored from the implementation of the characterization to optimizations of the DPA itself. The performance of DP Kruskal is compared with Filter Kruskal and a message-passing implementation of Prim’s algorithm on various graph sizes and densities to assess scalability and efficiency. The study is limited to specific types of graphs, focusing on random static and real-world dynamic graphs. Experiments are conducted primarily on single-core and multi-core machines, not extending to distributed computing environments. While comparisons with Filter Kruskal and Prim’s algorithm are included, not all existing MST algorithms are covered since mostly are theoretical, little implementations are available and it some experimental results show that they do not behave properly in large graphs. The research does not encompass all possible optimizations or address comprehensive memory management techniques beyond those relevant to Go and DPA. By defining these boundaries, the study aims to provide a focused investigation into the parallelization of Kruskal’s algorithm using DPA within the specified context. This work comprises five chapters, with this introductory chapter laying the foundation. Chapter 2 -Preliminaries- provides an overview of the state of the art, as well as relevant algorithms used throughout the research. Chapter 3 -MST characterization in the DPA- explains the main contribution of this project: how the DPA is utilized to solve the MSTproblem.Chapter 4 -Experimental Studydescribes the experiments conducted, their motivation, the results, and the subsequent analysis. Finally, a conclusion is presented in Chapter 5, summarizing the findings and suggesting future research directions. Chapter 2 Preliminaries In this chapter, we lay the groundwork for the research conducted in this thesis by presenting an overview of the fundamental concepts and algorithms related to the MST problem. We begin with a detailed examination of classical MST algorithms including Prim’s algorithm, Kruskal’s algorithm—along with its associated Union-Find data structure—and Boruvka’s algorithm. Following this, we explore parallel and distributed approaches to the MST problem, providing a general overview before delving into specific methods such as the Filter Kruskal algorithm and the Message Passing Prim algorithm. The chapter also covers the topic of fully dynamic MSTs, discussing both sequential and parallel/distributed approaches, most of them theoretical since there is little work in experimental. Finally, we introduce the Dynamic Pipeline Approach, setting the stage for its application in solving the MST problem, which will be further elaborated in the subsequent chapters. This comprehensive review equips the reader with the necessary background to understand the innovations and experimental analyses presented later in the thesis. 2.1 Minimum Spanning Tree Definition 1. A graph Gconsists of two sets: a set of vertices Vand a set of edges E, where Eis a set of unordered pairs from Vsuch that E⊆ {{u, v}|u, v ∈V}.Gis usually denoted as G= (V, E). From now on, unless stated otherwise, for any graph G= (V, E), we will refer to the elements of Vindistinctly as the vertices or the nodes of Gand to its size as n(|V|=n). Likewise we will refer to the elements of Eas the set of edges of Gand we will say that the size of Eis m(|E|=m). Definition 2. A weighted graph G= (V, E)is a graph in which its edges are assigned numerical values (known as weights) given by a function ω:E→R+. An example of a weighted graph is shown in Figure 2.1a. Definition 3. A spanning tree Tof a graph Gis a subgraph of Gthat is a tree and 3 4CHAPTER 2. PRELIMINARIES a b c d e fg 10.3 2.5 10 2 1.5 5.57 0.05 (a) A weighted graph. a b c d e fg 10.3 2.5 10 2 1.5 5.57 0.05 (b) A spanning tree. Figure 2.1: An example of a weighted graph and one of its spanning trees includes all the vertices of G. For the purposes of our work, if a graph Gis not connected, we will work with its spanning forest. A spanning forest of a graph Gis a subset Fof Gconformed by a set of trees such that for every connected component of G, exactly one spanning tree of the connected component is in F. From now on, abusing of notation, we will refer to a spanning forest of a non connected graph Gas a spanning tree of G. Figure 2.1b shows a spanning tree of the graph of Figure 2.1a. The light-gray dashed edges have not been added to the spanning tree. Definition 4. [53] Given a weighted graph G= (V, E),ω:E→R+, we say that T= (V, E′), with E′⊆E, is a minimum spanning tree of Gif Tis a spanning tree of G that minimizes: ω(T) = X e∈E′ ω(e) Let us observe that the spanning tree shown in Figure 2.1b is a minimum spanning tree of the graph shown therein. From now on, abusing of notation, as long as it does not generate ambiguities and unless stated differently, we will use MST as an abbreviation of minimum spanning tree and MST(G) as the minimum spanning tree of graph G. The finding and computation of MSTsremains as a common challenge in graph theory, leading to the development of various algorithms to address it. Notable among these are Prim’s [48], Kruskal’s [35], and Bor˚uvka’s [10] algorithms, each leveraging different useful properties of MSTs. These algorithms will be succinctly discussed in the subsequent subsections. MSTshave some useful properties: the cut-property and the cycle-property [1]. A cut is a partition of the vertices of a graph into two disjoint subsets. The cut-set of a cut is the set of edges that have one endpoint in each subset of the partition. The cut-property states that for any cut Cof the graph, if the weight of an edge ein the cut-set of Cis strictly 2.3. DYNAMIC PIPELINE 11 execution schedulers and computational structures to current input data conditions, are essential for managing continuous data streams. Data Streaming (DS) has been approached through various methods to efficiently process large volumes of data with high parallelization. Two distinct parallelization models have been identified: Data Parallelism (DAP) and Pipeline Parallelism (PP). Data-driven frameworks, which adapt execution schedulers and computational structures to current input data conditions, are essential for managing continuous data streams. However, traditional parallel paradigms like MapReduce [15, 31], which rely on the Divide & Conquer approach, have limitations. They partition problems into subproblems that must be fully executed before proceeding, resulting in a blocking behavior that impedes incremental result generation and limits the flexibility needed for real-world applications. In contrast, the Dynamic Pipeline Approach [46, 62] (DPA) is a PP computational model that operates as a one-dimensional, unidirectional chain of stages implemented as an asynchronous model of computation synchronized by channels, enabling the simultaneous execution of dependent tasks on different data items. In the DPA stages can be categorized into several types: input stages, filter stages, generator stages, and output stages. Input stages are responsible for reading and feeding data into the pipeline. Filter stages process the data, applying transformations or filtering operations as needed. Generator stages can produce new filter stages based on the current data flow. Finally, output stages handle the end result, such as writing data to storage or presenting it to the user. Modeling a problem within the DPA involves breaking it down into filters. For example, a graph-processing problem can be approached by having filter stages apply partitioning to the graph and algorithms to process the vertices and edges, ensuring that the solution can be built incrementally from the output of the previous filter. Many different problems have been implemented in the DPA, see Figure 2.2. Authors in [45] use DP for the well-known problem of counting triangles in a graph. Results suggest that pipeline allows for the implementation of an efficient solution of the problem of counting triangles in a graph, particularly, in dense and large graphs, drastically reducing the execution time with respect to the MapReduce implementation. The problem of enumerating bitriangles in large bipartite nerworks [50, 51] have also been implemented efficiently in the DPA. Another example of problems solved in DPA is given in [39]. In this work, authors propose a working implementation for solving the problem of multidimensional range queries, the retrieval of points of a multidimensional space that fall inside a given region. 12 CHAPTER 2. PRELIMINARIES (a) Dynamic Pipeline for triangles in graphs. Images from [45] (b) Dynamic Pipeline for bitriangles in bigraphs. Images from [51] (c) Dynamic Pipeline for Quadtrees. Image from [39] Figure 2.2: Examples of different problems in DPA. Chapter 3 Graphs and MSTsin the DPA In this chapter we introduce a representation of static and dynamic graphs suitable to characterize graphs in the DPA. A particular property of MSTsrepresented as we propose will allow us to compute the MST of a graph in the DPA. We show also the DP Kruskal Algorithm that uses this representation for tailor the DPA, and delve into its detailed implementation and various optimizations. We begin by explaining the representation and proving the above mentioned property, followed by its usage in the dynamic pipeline with a comprehensive breakdown of the implementation, which includes the Communication, Source Stage, Filter Stage, Generator Stage, and Sink Stage. Afterwards we include a cost analysis section, where we evaluate the time and memory complexity of DP Kruskal, providing insights into its efficiency and scalability. We then introduce several key optimizations designed to enhance the performance of DP Kruskal. These include the use of multiple roots per filter, Decoupled Event Handling, adaptive MST caching, and improved memory management. Notably, the Decoupled Event Handling optimization is highlighted as a general improvement that can be applied to any problem implemented using the DPA, not just the MST problem. Through these sections, we aim to demonstrate how the DP Kruskal algorithm, bolstered by these optimizations, offers a robust and scalable solution for maintaining the MST in dynamic graphs. This sets the stage for the experimental analyses presented in subsequent chapters, where the effectiveness of these enhancements is empirically validated. 3.1 Underlying Forests and MSTs In this section we present our algorithm for computing minimum spanning forests of dynamic weighted graphs according to the dynamic pipeline approach. In order to simplify the following definitions, we assume that the graphs have no isolated vertices (vertices with no incident edges), but can be easily adapted. We start by introducing the preliminaries to define the algorithm. In the literature [14], there are many possible computational representations of graphs: as adjacency lists, as adjacency matrices, as a computable function, as a list of edges and many more. We propose a representation based on its underlying forest. 13 14 CHAPTER 3. GRAPHS AND MSTsIN THE DPA Definition 5. Given a graph G= (V, E), we say that the sequence FG=⟨T1, . . . , Tk⟩, k≥1, is an underlying forest of Gif Ti⊆E∀i,∪k i=1Ti=E,∀i, j, i =j, Ti∩Tj=∅ and ∀i Ti∈FGthere exists a distinguished vertex vi∈V, called the root of Ti, such that ∀e∈Ti,eis incident to vi. Notice that every element of an underlying forest of Gis a tree of height 1. Indeed, ∀Ti∈FGheight(Ti) = 1. Notice also that if Ticonsists of a unique edge any of its two vertices could be distinguished as the root of Ti. Moreover, Gcan be characterized as G= (V, Sk j=1 Tj), k ≥1 and hence, in what follows, by an abuse of notation we might also write G=Sk i=1 Ti. Likewise, we will also refer by Gito the graph of Ggiven by Gi=Si j=1 Tj, 1 ≤i≤k. In Figure 3.1, we show a weighted graph Gtogether with one of its possible underlying forests. Edges are represented by 3-tuples of the form (u, v, ω({u, v})), where ω({u, v}) is the cost of the edge {u, v}(according to Definition 2). The graph therein is G= (V, E), with V={a, b, c, d, e}and E={(a, b, 2),(a, e, 1),(b, e, 1),(c, e, 1),(b, d, 7),(c, d, 4),(b, c, 1)}. a b c d e 2 1 11 7 4 1 a be 21 b cde 171 c de 41 Figure 3.1: The sequence of trees on the right form an underlying forest of the graph shown in the left. This characterization allows to analyze various properties of graphs in the DPA, however, our interest is to study the way to compute and maintain dynamically the MST of a dynamic graph. To do so, next proposition is crucial. Proposition 1. Given a weighted graph G= (V, E)represented by the underlying forest FG=⟨T1, . . . , Tk⟩(k≥1) and the subgraphs Gi,1≤i≤k, of Gsuch that Gi=∪k j=1Ti, it holds that MST(Gi) = T1if i= 1 MST(Ti∪MST(Gi−1)) if i > 1 where MST(G) is any correct procedure to compute a MST of G. Proof. We proceed by induction on the size of FG. Base case, i= 1:FG1=⟨T1⟩and thus G1=T1. Since T1is a tree containing all the edges of G1, it corresponds to its own minimum spanning tree. Let us observe that for the case i= 2 the property follows trivially since MST(G2) = MST(T1∪T2) = MST(MST(T1)∪T2). Induction Hypothesis (HI): Let us suppose that MST(Gi) = MST(Ti∪MST(Gi−1)) is, effectively, a MST of Gi. We want to proof that if (HI) holds then MST(Gi+1) = MST(Ti+1 ∪MST(Gi)). 3.2. DPA AND MSTsOF DYNAMIC GRAPHS. 15 Induction Step: Let e∈Ebe any edge of MST(Gi+1), then eis either in Gior in Ti+1 If ebelongs to Ti+1, then MST(Gi+1) will consider it (since it looks at all the edges of Ti) and add it to MST(Gi+1). If, on the other hand, ebelongs to Githen there are two options for it to belong to MST(Gi+1): 1) edoes not belong to any cycle in Gi+1, which implies that the edge does not belong neither to any cycle in Gi, so it will also be part of MST(Gi) and hence will be considered by MST(Gi+1). 2) ebelongs to at least one cycle of Gi+1. If ebelongs only to cycles that include edges from Ti+1, then as Gidoes not include such edges, edoes not belong to any cycle in Giand hence has to be part of MST(Gi). The last option left is that the ebelongs to cycles in Gi. In such case, it cannot be the weightiest edge in any of that cycles, otherwise it would not be part of MST(Gi+1), hence it has to be in MST(Gi). With all this cases covered, we can state that we can build the MST(Gi+1) as the MST of the union of the tree Ti+1 with the MST(Gi). We have not considered here the case in which the graphs Gi, 1 ≤i≤k, are not connected. If this is the case, then the final result is the sequence of MSTsof every connected component of Gi. Since the proposition holds for any connected component, it is valid for the union of all connected components. Proposition 1 gives us the foundation to compute the MST of graphs represented by any of their underlying forests. To get insights about how this can help us to design an algorithmic proposal, let us consider the Example 1. Example 1 (Computation of MST(G) from FG).Let Gbe the forest FG=⟨T1, T2, T3⟩, where T1={(a, b, 2),(a, e, 1)},T2={(b, c, 1),(b, d, 7),(b, e, 1)}and, T3={(c, d, 4),(c, e, 1)} shown in Figure 3.1. The computation of MST(G)is done according to Proposition 1. This is, MST(G)is MST(T3)and is computed as follows: 1. MST(G1) = T1={(a, b, 2),(a, e, 1)} 2. MST(G2) = MST(T2∪MST(G1)) = {(a, e, 1),(b, c, 1),(b, d, 7),(b, e, 1)} 3. MST(G3) = MST(T3∪MST(G2)) = {(a, e, 1),(b, c, 1),(b, e, 1),(c, d, 4)} 3.2 DPA and MSTsof Dynamic Graphs. In the classical sequential model of computation one could easily implement the traversal of forest FGby a simple loop running over its trees. However, thinking in alternative ways of computation, it would be natural to distribute the trees of FGalong a pipeline, distributing the sequence among several processors. Then, the sequence of computations given in Example 1 would also been distributed along the processors holding the trees implied in the computation. That is exactly the idea of the dynamic pipeline,DP Kruskal. The benefit of using this graph representation is threefold: 16 CHAPTER 3. GRAPHS AND MSTsIN THE DPA (i) The graph can be updated in a very simple way, just by adding or deleting edges of one element of FG. Moreover, as we will see, this representation is adequate for the DPA [46] since the trees of FGcan be very easily spread out across a dynamic pipeline producing the distributed representation of the graph that we will refer to as DP Kruskal. Hence, while the dynamic pipeline is active, Gremains updated along time. (ii) At any time t, the concurrent (and parallel) computational structure of DP Kruskal is able to compute effectively the MST(G) of the current graph when required. (iii) During the computation of the MST(G), the priority queue required for the implementation is of size at most O(n) in contrast with the sized mpriority queue required by the implementation of Kruskal’s sequential algorithm because there will be at most 2nedges. Following the definition in [46], to define a dynamic pipeline, we have to define (i) the configuration and the behaviour of the four kind of different stages (stateful functions): source or input, generator, (instances of) filter and sink or output, in this order; and (ii) the channels connecting stages. Each filter instance’s state contains a tree of the forest FGand is parameterized by the root of this tree. Besides filter instances’ behaviour correspond to the operation defined in Proposition 1. The different stages of the pipeline are connected by means of two communication channels carrying the events and the MST(Tk) for passing the temporal MST(G), respectively. When a pipeline is initialised, only the Source, the Generator and the Sink stages exist. Then, the pipeline shrinks and expands dynamically depending on the sequence of insertions and deletions of the edges of the graph but all these operations can modify only the number of filter stages, the underlying structure is not modified, unless the DP Kruskal terminates. Figure 3.2 depicts the state of an instance of DP Kruskal, and below we describe all the stages with more precision. Source (I): Whenever this stage receives an event it passes it to the rest of the pipeline through the event channel, if op =mst it also passes the empty set through the graph channel. Filter (F(v)): The parameter vis called the root of the filter stage. Whenever an event (op,e={v,w}) arrives to F(v), the following things can happen: (i) If op = {insert,update,delete}and eis incident to the root v, the event is treated in F(v) according to op. On the contrary, if it is not incident, the event is passed through the event channel to the next stage of the pipeline; (ii) If op =mst, a partial MST is computed and passed to the rest of the pipeline through the graph channel by computing the MST of the graph resulting of the union of the MST that arrives through the graph channel with the tree in F(v). As explained, a possible implementation would consist on joining the temporal graph from the graph channel with the filter’s tree and the compute the MST with Kruskal’s algorithm. Generator (Gen): Whenever an event (op,e={v,w}) arrives to this stage by the event channel, if op ∈ {insert,update}, a new instance of Filter stage, F(v), is spawned and added to the pipeline between the last filter and Gen. The edge eis stored in the local 3.3. IMPLEMENTATION 17 memory of F(v). Besides, whenever op =mst, it passes the MST that arrives by the graph channel to the sink stage O. Sink (O): When an event mst arrives to this stage, it outputs the MSTG. a b c d e f 0.4 0.3 0.6 0.1 0.8 0.9 I FaFcFd Gen O Op MST Op MST Op MST Op MST Op MST a b cd c de d fa b c d e f 0.4 0.3 0.6 0.1 0.9 Figure 3.2: A DP Kruskal at some point of its execution, the input graph and the MST that it returns. The graph is distributed along filters Fa,Fcand Fd. Complexity. Conducting a precise cost analysis is inherently challenging due to the numerous influencing factors. In particular, the order in which graph modifications occur and the frequency of each type of operation significantly impact the structure of the pipeline and the overall performance. The following analyses provide a rough approximation based on the worst-case scenario and some amortised cost, ignoring the fact that we need to pass through all the filters. The insert event is simply O(1), since we are appending to the tree. The update and remove require to scan the list of adjacent edges of a tree, so it will be O(n). The mst can be implemented using the Kruskal Algorithm of Section 2.1. Each tree has at most nedges and the Kruskal Algorithm takes O(nlog n) as mentioned in Section 2.1. This operation is performed at most ntimes as there are at most ntrees in the underlying forest. So it has a cost O(n2log n), but the each operation in the trees can be performed in parallel for several MSTs, which implies that we have an amortised cost of O(nlog n). Each mst operation takes at most O(n) memory since the resulting MST has that size, the input graph as well and the priority queue needed for Kruskal takes also O(n). 3.3 Implementation The implementation was done using Golang 1.20 and it is available at Github 1. The choice of Go was influenced by several factors. Firstly, the language supports lightweight green threads called goroutines, which are efficiently managed by the Go runtime scheduler. Additionally, the communication between stages is naturally facilitated by channels, enabling unidirectional communication between goroutines. Communication To communicate between stages, as already explained, we use Go channels. To avoid undesired synchronizations, we use buffered channels with up to 4096 item, a totally arbitrary number. Then, we packed the channels in in_comm if the channels are only incoming and out_comm for out-coming as shown in Figure 3.3. 1https://github.com/danielbenedi6/MasterThesis 18 CHAPTER 3. GRAPHS AND MSTsIN THE DPA type in comm struct { Req <−chan cmn. Request Graph <−chan cmn. Graph } type out comm struct { Req chan<−cmn. Request Graph chan<−cmn . Graph } Figure 3.3: Source code for the Channels in Go. Source Stage The source stage consists of an element that will feed the pipeline either reading an input file or by generating random graphs, so-called in-memory. When reading from a file, we defined a file format in order to unify the different formats from all the dynamic graph databases that we used. Although we started with a version that stated the operation with a keyword, we opted to change this definition because of performance issues. Instead, the operation is defined by an integer: the insert an edge operation is represented by number 1, the update the weight operation is number 2, the delete an edge operation is defined by number 3, the operation to obtain the minimum spanning tree is number 4, the number 5 represents the end of the file and the number 6 returns the whole graph. The operations of inserting and updating will be followed by three arguments representing the two vertices and the weight of the edge. The operation of deleting will be followed by the two vertices that form the edge. Golang offers different methods to parse data from a file. The most straightforward is based on the package fmt in which we can simply define the format of the desired input and it will manage all the exceptions and ensure the parsing is correct. Another option is the package bufio that allows to implement a parser and uses buffers to access to the files. An experimental analysis of both packages and why bufio was chosen is given in 4.2. When the source stage is chosen to be a generator of random graphs, we opted to use binomial random graphs. A binomial random graph is a graph constructed by connecting nodes randomly in which each edge is included in the graph with probability p, independently from every other edge. A detailed explanation in Section 4.1. Since both vertices of an edge can be the root in the underlying forest, before sending the edge through the DP Kruskal, a ”normalization” operation is done in which the vertices are ordered lexicographically, so the smallest one will be the root. This order, instead of a random order for instance, affects the shape of the pipeline and it will be studied in Section 4.2. Filter Stage The filter stage is a functional stage, as defined in [46], responsible for processing input data. The size of the DP Kruskal structure depends entirely on the number of filter 3.3. IMPLEMENTATION 19 stages present. The grouping property, R, of our filter stage ensures that each edge is adjacent to the root of the filter. Consequently, the filter retains only events with an adjacent edge. Instead of checking both vertices, we opted to check only the first vertex of the edge. The insert operation adds the edge to the end of the edge list, Ti. The remove operation replaces the edge with the last one in the list and reduces the array size. The update operation scans the edge list and updates the edge weight. The mst operation is more complex as it involves implementing an MST algorithm and merging two trees. We assume the incoming MST,K, is a sorted list of edges by weight. The operation then performs the Kruskal algorithm, as explained in Algorithm 2. To find the connected component in which a vertex belongs to, we proposed the usage of the Union-Find data structure described in Algorithm 6. Instead of selecting the lightest edge of the graph, the algorithm selects the lightest edge from either Kor Ti. Algorithm 5 provides a pseudocode of a possible implementation of this process. Algorithm 5 Possible implementation of Kruskal for Filter Stage of DP Kruskal Require: Tiand MST(Gi−1) are represented as a sequence of the edges and MST(Gi−1) is already in weight-ascending order. procedure KruskalDP(Ti,MST(Gi−1)) F←∅ Sort(Ti)▷Sort Tiby weight CC ←0▷Number of connected components I←[] ▷DS for Union-Find M← {} ▷Map for vertex id to conected component id j, k ←0,0▷Indices for Tiand MST(Gi−1) while j < |Ti|∧k < |MST(Gi−1)|do e= (u, v)←arg min{Ti[j],MST(Gi−1)[k]}ω(e) if u /∈Mthen M[u]←CC, CC ←CC + 1 if v /∈Mthen M[v]←CC, CC ←CC + 1 if Find(M[u], I)=Find(M[v], I)then F←F∪{e} Union(M[u], M[v], I) end if if e=Ti[j]thenj←j+ 1 else k←k+ 1 end while return F end procedure UnionFind The sketch for Kruskal’s algorithm given in Algorithm 2 needs a data structure to keep record of the connected component in which each vertex belongs to. Such data structure can be the Union-Find. The Union-Find data structure, also known as Disjoint Set Union (DSU), is a fundamental data structure used to manage and merge disjoint sets. It plays a crucial role in the implementation of Kruskal’s algorithm for finding the MST 20 CHAPTER 3. GRAPHS AND MSTsIN THE DPA of a graph and it is used in Kruskal’s variation for DP Kruskal Algorithm 5. The origins of the Union-Find data structure trace back to algorithms proposed by Bernard Galler and Michael Fischer in [22]. Their seminal work introduced efficient methods for union and find operations, which have become essential in various areas of computer science, including network connectivity. This section delves into the mechanics and efficiency of the Union-Find algorithm, detailing its union by rank and path compression techniques that ensure nearly constant time complexity for union and find operations. The usual description of the algorithm is making use of pointers and trees, but in Algorithm 6 we provide a sketch for implementing in a single array, I, of length the number of elements. In order to find the set to which the i-th element belong, the procedure Find will go to the i-th position of the array I, and the value in that position is the parent of that element, so the algorithm repeats until it finds an element that has itself as parent. On its way, the algorithm performs path compressing which consists on assign as parent of the i-th element the parent of its parent. This implementation of the Find algorithm is based on Tarjan and Van Leeuwen algorithm in [58]. The Union algorithm for joining the i-th element and the j-th element is as simple as finding the roots of the subtrees with the Find algorithm and assigning a new parent – since Find(i) = I[Find(i)] and Find(j) = I[Find(j)]. When a new elements is needed to be added to the Union Find data structure, we append it to the array Iand assign an id equal to the position in the array. Algorithm 6 Both methods needed in Union-Find. procedure Find(p, I)▷ I is passed by reference while p=I[p]do I[p]←I[I[p]] p←I[p] end while return p end procedure procedure Union(p, q, I)▷ I is passed by reference i←Find(p, I) j←Find(q, I) I[i]←j end procedure Generator Stage In Figure 3.4, we present an implementation of the generator stage in Go. As previously described, when a generator stage receives a insert or update event, it instantiates a new filter and assigns the event to it. To prevent any event loss, this new filter is equipped with the input channels of the generator stage. Subsequently, the generator replaces these input channels with new ones, which serve as the output channels of the filter and the input channels for the generator itself. 4.1. GENERATION OF TEST CASES 27 and 1. Further details on the internal workings of the generator can be found on the Go Blog1. To ensure the quality and reliability of this pseudo-random number generator, we conducted several validation tests. We generated over a million random numbers using the seed ‘1707242827149724922’ and performed two statistical tests: the Chi-square test and the Kolmogorov-Smirnov test. The Chi-square test [34, 40] is a statistical method used to compare the distribution of a sample of random numbers to an expected uniform distribution. This test involves dividing the range of possible values into several bins, counting the number of random numbers that fall into each bin, and then computing the Chi-square statistic to assess how well the observed distribution matches the expected distribution. A p-value is then calculated; in our case, we used a significance level of 0.05. If the p-value is below this threshold, we reject the null hypothesis that the numbers are uniformly distributed. Our test results indicated no rejection with a p-value of 0.001, confirming that the distribution of our generated numbers was consistent with uniformity at the 0.05 significance level. The Kolmogorov-Smirnov (K-S) test is another statistical test used to compare a sample distribution to a reference probability distribution (in our case, the uniform distribution) [30, 34]. This test calculates the maximum distance between the empirical distribution function of the sample and the cumulative distribution function of the reference distribution. A p-value is then derived from this maximum distance. For our generated numbers, we performed the K-S test and obtained a p-value of 0.02. Since this p-value is above the common significance threshold of 0.05, we do not reject the null hypothesis, indicating that our random number generator produces numbers that follow the expected uniform distribution. Both the Chi-square test and the Kolmogorov-Smirnov test results validate the high quality and reliability of the math/rand pseudo-random number generator in Go for our application needs. Hot start In our experimental study, we implemented two additional operations in the DP Kruskal algorithm specifically for static graph testing: savestate saving the current state of the filters and  loadstate loading this saved state. These operations enable what we term a ”Hot Start”, allowing the algorithm to resume from a pre-saved state rather than initializing from scratch for each test run. This method significantly enhances efficiency during experimentation without compromising the validity of the results. By using Hot Starts, we can isolate the performance of the algorithm itself from the overhead of repeated initializations, providing a clearer assessment of the algorithm’s behavior under various conditions. These test cases were designed to evaluate the performance improvements achieved by the optimizations in DP Kruskal and to ensure that the results are both accurate and reproducible. 1https://go.dev/blog/randv2 28 CHAPTER 4. EXPERIMENTAL STUDY 4.2 Analysis of DP Kruskal Architecture and Optimizations In this section, we delve into the experimentation and optimization of the DP Kruskal algorithm. Through a series of tests, we examine various design elements including input handling, edge ordering, event decoupling, filter sizing, and pre-processing. Our goal is to refine the pipeline architecture and enhance its performance for computing and maintaining the MST. Read Input As discussed in Section 3.3, Go provides two standard library packages for handling program input and output. The fmt package implements formatted I/O with functions similar to C’s printf and scanf, while the bufio package implements buffered I/O. bufio wraps an io.Reader or io.Writer object, creating another object (Reader or Writer) that also implements the interface but adds buffering and assists with textual I/O. Since bufio uses buffers to read from a file and includes specific readers for various data types without needing a parser to infer the format as scanf does, it intuitively offers better performance than fmt. To verify this, we generated a file with the same format as our input graphs and measured the time taken to read it. This experiment was repeated 100 times to obtain stable time measurements. Figure 4.1 shows that, as expected, bufio outperformed fmt. On average, bufio required around 1.04 microseconds per line, whereas fmt needed 18.69 microseconds per line. This indicates that using bufio instead of fmt resulted in a speed-up of approximately 18 times. Consequently, due to these results, bufio was chosen for our implementation. 10 2 10 3 10 4 10 5 10 6 Number of lines 0 10 20 30 40 50 Time per line [ms] Time comparison of reading file Package fmt bufio Figure 4.1: Running time comparison between bufio and fmt 4.2. ANALYSIS OF DP KRUSKAL ARCHITECTURE AND OPTIMIZATIONS 29 Edge order We observed that the ordering of the vertices in an edge has a significant impact on the overall performance of the system. Several possible orderings can be proposed, such as a random order of the vertices, a lexicographical increasing order, or an order based on the vertex that has appeared the least number of times, and many more. Each of these strategies or heuristics has its own advantages and complexities. For our analysis, we focused on two ordering methods: random order and lexicographical order. These methods were chosen because they are relatively simple to implement and do not require prior knowledge of the graph’s history. Instead of performing the analysis on the complete DP Kruskal, we created a simplified model to simulate the behavior of the pipeline. This model allowed us to count where each filter ended up and provided insights into the performance impact of each ordering strategy. The code used for simulate can be found in Appendix A and Appendix B. Figure 4.2 illustrates the simulation results for a random graph with 100,000 vertices and a density of 0.9. Figure 4.3 shows the simulation results for a real dynamic graph with 2,212,682 vertices and 31,624,375 operations. In both cases, we observed that the lexicographical order resulted in fewer filters, which helps to reduce the overhead associated with managing multiple goroutines. However, this reduction in filters comes at a cost: the remaining filters tend to accumulate more edges, leading to more costly operations. The results indicate that while the lexicographical order can help streamline the pipeline by reducing the number of filters, it can also increase the workload on each filter. This trade-off highlights the importance of carefully choosing the vertex ordering strategy based on the specific characteristics and requirements of the application. Further research and experimentation may reveal additional strategies that balance these trade-offs more effectively. But at this point of time, we chose the lexicographical order for the rest of the experiments. At this point in time, we chose the lexicographical order for the rest of the experiments. This decision was based on its demonstrated ability to minimize the number of filters, thereby reducing the goroutine overhead despite the increased workload on each filter. Decoupled Event Handling As detailed in Section 3.4, the MailBox/Worker optimization, termed “Decoupled Event Handling”, was introduced to address inefficiencies in the original filter stage implementation. By separating the event handling and processing responsibilities into distinct stages —the MailBox and the Workerwe aimed to enhance the overall performance and responsiveness of the system. To evaluate the impact of this optimization, we conducted an experiment that involved generating files of different sizes and measuring the execution time with and without the optimization. The results are shown in Table 4.2. For a file with 7,500 random requests, we observed a speed-up of 20% with the optimization. When the file size increased to 10,000 random requests, the speed-up increased to 38%. These results clearly indicate that the optimization significantly reduces the locking of the pipeline, allowing 30 CHAPTER 4. EXPERIMENTAL STUDY 0 1000 2000 3000 4000 5000 Filter ID 10 2 10 3 10 4 10 5 Number of edges Filter utilization with constant filter size. G(N=50000,p=0.9) Random Normalized Figure 4.2: Simulation of the DP Kruskal with 10 roots per filter using a random graph. 0 25000 50000 75000 100000 125000 150000 175000 Filter ID 100 101 102 103 104 105 Number of edges Filter utilization with constant filter size. frwiki.requests Random Normalized Figure 4.3: Simulation of the DP Kruskal with 10 roots per filter using a real dynamic graph. 4.2. ANALYSIS OF DP KRUSKAL ARCHITECTURE AND OPTIMIZATIONS 31 for more efficient processing as the number of operations increases. The more operations there are, the more pronounced the performance improvement becomes, demonstrating the effectiveness of the MailBox/Worker optimization in handling larger workloads and enhancing system throughput. Operations No optimization With optimization 7500 1h 9m 31.48s 57m 28.23s 10000 3h 46m 46.73s 2h 44m 14.19s Table 4.2: Execution time of DP Kruskal of different file sizes with and without the MailBox/Worker optimization. Filter size As mentioned in Section 3.4, having multiple roots per filter can lead to a more efficient utilization of computational resources, but it also brings an additional parameter that can affect the performance of the DP Kruskal. To study the effect of the number of roots in each filter, we consider three options: a constant number of roots DP Kruskal const, log(n) roots DP Kruskal log, and √n roots DP Kruskal sqrt (where nis the number of vertices of the input graph). We will initialize the DP Kruskal and then measure the performance in a single core machine in order to compare their behaviour. Figure 4.4 shows the corresponding experimental results. We can observe that, as expected, this value influences the performance of the algorithm. For small graphs it seems that the version that works with filters with a √nnumber of roots is better and faster than the others, but as the graph becomes larger and denser the versions with a logarithmic or even constant number of roots per filter become more efficient. 103104 Number of nodes 104 105 106 107 Execution Time [µs] Evolution with random graph of expected density of 0.1 Type Prim DP-const DP-sqrt DP-log FilterKruskal 103104 Number of nodes 104 105 106 107 Execution Time [µs] Evolution with random graph of expected density of 0.25 Type Prim DP-const DP-sqrt DP-log FilterKruskal 103104 Number of nodes 105 106 107 Execution Time [µs] Evolution with random graph of expected density of 0.9 Type DP-const DP-sqrt DP-log FilterKruskal Figure 4.4: A comparison of three versions of the DP Kruskal algorithm varying the number of roots at each filter: DP Kruskal const,DP Kruskal log and DP Kruskal sqrt with a single core This trend is more evident when we group the results by different densities and the expected number of edges, computed as n·(n−1) ·p. Figure 4.5 illustrates that there 32 CHAPTER 4. EXPERIMENTAL STUDY 105106107108 Expected edges 104 105 106 Execution Time [µs] Type DP-const DP-sqrt DP-log Figure 4.5: A comparison of three versions of the DP Kruskal algorithm varying the number of roots at each filter and focusing on the number of edges: DP Kruskal const, DP Kruskal log and DP Kruskal sqrt with a single core is a clear point at which the efficiency of the log(n) and constant root versions surpasses that of the √nversion. This transition point depends on the graph size and density, highlighting the importance of choosing an appropriate number of roots based on the specific characteristics of the input graph. Pre-processing Some experimental work [2, 12, 21, 29] comparing different algorithms to maintain a dynamic MST involves a pre-processing step, which is typically considered insignificant. These studies often compare data structures based on Euler Trees [54], which require vertices to have a maximum degree of 3. To meet this requirement, vertices with a degree greater than 3 are “exploded” into multiple vertices, equal to the initial vertex’s degree, and connected in a loop with edges of weight 0. This ensures that all but one edge will be added during processing. An example of this process is shown in Figure 4.6. To verify the insignificance of this pre-processing step and to determine whether the DP Kruskal could benefit from it, we conducted our own experiments. Figure 4.7 demonstrates that this pre-processing step actually results in a higher initialization time compared to processing without it. For instance, in a binomial graph originally consisting of 1000 vertices with a density of 0.75, transforming the graph so that no vertex has a degree greater than 3 resulted in a 100% slow-down (The average time with preprocess divided by the time without it). Similarly, for a graph with 7500 vertices and the same density, this transformation led to a 75% slow-down. These results indicate that the pre-processing time is not negligible and that this approach is not advantageous for the DP Kruskal. 4.3. COMPARISON WITH OTHER ALGORITHMS 33 v 1 2 3 4 5 v0 v1 v2v3 v4 1 2 3 4 5 0 0 0 0 0 Figure 4.6: Example of the pre-processing step on a vertex with degree 5. 10 3 10 4 N 10 0 10 1 10 2 time [s] Constr ction time for size of filters of √N p 0.1 0.25 0.5 0.75 0.9 type No Preprocess Max Deg 3 Figure 4.7: Comparison of DP Kruskal initialization with and without preprocessing. 4.3 Comparison with other algorithms In this section, as usual in parallel applications [6] we have captured the elapsed wall-clock time T(k, n, p), which is the time elapsed from the moment in which the first processor started working to the moment in which the last processor completed the computation for a graph of nvertices and expected density of pusing kprocessors. We will refer to absolute speed up and efficiency as: •Absolute speedup:speedupa(k) = T(1, n, p)/T(k, n, p). •Efficiency:speedupa(k)/k. where T(1, n, p) is the execution time of the MST sequential implementation. 34 CHAPTER 4. EXPERIMENTAL STUDY 103104 Number of nodes 104 105 106 107 Execution Time [µs] p 0.1 0.25 0.5 0.75 0.9 Type FilterKruskal Kruskal DP-Kruskal-sqrt Figure 4.8: A comparison of DP-MST with different algorithms with a single core. Static graphs In Figure 4.8, we compare the performance of the Dynamic Pipeline (DP Kruskal) against the standard Kruskal algorithm and the Filter-Kruskal (Filter Kruskal) algorithm, as explained in Section 2.1. The results clearly demonstrate that DP Kruskal offers a significant reduction in execution time across all graph densities. This indicates that the partitioning strategy utilized by DP Kruskal is highly effective, providing superior performance regardless of the density of the graph. This efficiency is evident from the consistently lower execution times of DP Kruskal compared to Kruskal. Parallel algorithms: If we focus on the algorithms that can be easily parallelized, we compare DP Kruskal with our implementation of Filter Kruskal and the results presented in [37] of an implementation of Prim using message-passing parallelism. In Figure 4.9, we can observe that Prim is far from optimal. Although Filter Kruskal is faster at the beginning, for larger graphs it is easily outperformed by DP Kruskal. This comparison highlights the superior scalability and efficiency of DP Kruskal in handling large, dynamic graphs. Our experiments demonstrate that while Filter Kruskal can provide competitive performance on smaller datasets, its efficiency diminishes as the graph size increases. In evaluating the performance of DP Kruskal and Filter Kruskal on random graphs, the experimental results reveal significant insights into the scalability and efficiency of these algorithms. By examining the speed-up achieved with an increasing number of cores, as illustrated in Figure 4.10, we observe that DP Kruskal consistently demonstrates superior parallel performance compared to Filter Kruskal. For instance, in graphs with varying sizes and densities —such as G(n= 1000, p = 0.25), G(n= 5000, p = 0.75), and G(n= 4.3. COMPARISON WITH OTHER ALGORITHMS 35 103104 Number of nodes 104 105 106 107 Execution Time [µs] Evolution with random graph of expected density of 0.1 Type Prim DP-const DP-sqrt DP-log FilterKruskal 103104 Number of nodes 104 105 106 107 Execution Time [µs] Evolution with random graph of expected density of 0.25 Type Prim DP-const DP-sqrt DP-log FilterKruskal 103104 Number of nodes 105 106 107 Execution Time [µs] Evolution with random graph of expected density of 0.9 Type DP-const DP-sqrt DP-log FilterKruskal Figure 4.9: Comparison of DP Kruskal with DP Kruskal const(10),DP Kruskal log, DP Kruskal sqrt,Prim and Filter Kruskal on a single core. 2021222324 Cores 0 2 4 6 8 10 Speed-Up Speed-up of DP-const Graph G(n=1000,p=0.25) G(n=5000,p=0.75) G(n=10000,p=0.90) 2021222324 Cores 0 2 4 6 8 10 Speed-Up Speed-up of DP-log Graph G(n=1000,p=0.25) G(n=5000,p=0.75) G(n=10000,p=0.90) 2021222324 Cores 0 2 4 6 8 10 Speed-Up Speed-up of DP-sqrt Graph G(n=1000,p=0.25) G(n=5000,p=0.75) G(n=10000,p=0.90) 2021222324 Cores 0 2 4 6 8 10 Speed-Up Speed-up of Filter-Kruskal Graph G(n=1000,p=0.25) G(n=5000,p=0.75) G(n=10000,p=0.90) Figure 4.10: Speed-up comparison of DP Kruskal and Filter Kruskal 10000, p = 0.90)— DP Kruskal exhibits substantial speed-ups across all configurations. Notably, DP Kruskal with a logarithmic number of roots per filter (DP Kruskal log) achieves near-linear speed-up and almost a perfect efficiency (Figure 4.11) as the number of cores increases, highlighting its effectiveness in leveraging parallelism. In contrast, while Filter Kruskal also benefits from parallel execution, its performance gains are comparatively modest, particularly for larger and denser graphs. This underscores the efficiency of the DP Kruskal architecture in distributing computational workload and minimizing synchronization overhead, thereby making it a highly scalable solution for computing MST in parallel environments. Real dynamic graphs We compare DP Kruskal and Filter Kruskal on realistic dynamic graphs to evaluate their performance in maintaining the minimum spanning tree (MST) after each edge insertion or deletion. For each operation, we request an update of the MST to assess how efficiently the algorithms handle dynamic changes. In Table 4.12a, we observe that DP Kruskal effectively maintains the MST across various datasets. This table highlights the execution times for different graph sizes and densities, illustrating how DP Kruskal consistently outperforms Filter Kruskal in maintaining the MST. Figure 4.12b further demonstrates the scalability and efficiency of DP Kruskal in a parallel processing environment. By leveraging the parallelism capabilities inherent in its design, DP Kruskal achieves significant speed-ups, especially as the number of processing 36 CHAPTER 4. EXPERIMENTAL STUDY 2021222324 #Cores 0.0 0.2 0.4 0.6 0.8 1.0 Efficiency G(n=1000,p=0.1) Type DP-const DP-log DP-sqrt FilterKruskal 2021222324 #Cores 0.2 0.4 0.6 0.8 1.0 Efficiency G(n=1000,p=0.5) Type DP-const DP-log DP-sqrt FilterKruskal 2021222324 #Cores 0.2 0.4 0.6 0.8 1.0 Efficiency G(n=1000,p=0.9) Type DP-const DP-log DP-sqrt FilterKruskal 2021222324 #Cores 0.2 0.4 0.6 0.8 1.0 Efficiency G(n=5000,p=0.1) Type DP-const DP-log DP-sqrt FilterKruskal 2021222324 #Cores 0.2 0.4 0.6 0.8 1.0 Efficiency G(n=5000,p=0.5) Type DP-const DP-log DP-sqrt FilterKruskal 2021222324 #Cores 0.2 0.4 0.6 0.8 1.0 Efficiency G(n=5000,p=0.9) Type DP-const DP-log DP-sqrt FilterKruskal 2021222324 #Cores 0.2 0.4 0.6 0.8 1.0 Efficiency G(n=10000,p=0.1) Type DP-const DP-log DP-sqrt FilterKruskal 2021222324 #Cores 0.2 0.4 0.6 0.8 1.0 Efficiency G(n=10000,p=0.5) Type DP-const DP-log DP-sqrt FilterKruskal 2021222324 #Cores 0.2 0.4 0.6 0.8 1.0 Efficiency G(n=10000,p=0.9) Type DP-const DP-log DP-sqrt FilterKruskal Figure 4.11: Efficiency comparison of DP Kruskal and Filter Kruskal BIBLIOGRAPHY 43 [39] Daniel Lugosi Enes. “Concurrent Implementation of Multidimensional Range Queries”. UPC, Facultat d’Inform`atica de Barcelona, Departament de Ci`encies de la Computaci´o, July 2019. url:http://hdl.handle.net/2117/169246. [40] M. Donald MacLaren and George Marsaglia. “Uniform Random Number Generators”. In: J. ACM 12.1 (Jan. 1965), pp. 83–89. issn: 0004-5411. doi:10.1145/ 321250.321257.url:https://doi.org/10.1145/321250.321257. [41] M.J. Neely, E. Modiano, and C.E. Rohrs. “Dynamic power allocation and routing for time-varying wireless networks”. In: IEEE Journal on Selected Areas in Communications 23.1 (2005), pp. 89–103. doi:10.1109/JSAC.2004.837349. [42] Krzysztof Nowicki and Krzysztof Onak. “Dynamic graph algorithms with batch updates in the massively parallel computation model”. In: Proceedings of the 2021 ACM-SIAM Symposium on Discrete Algorithms (SODA). SIAM. 2021, pp. 2939– 2958. [43] Vitaly Osipov, Peter Sanders, and Johannes Singler. “The Filter-Kruskal Minimum Spanning Tree Algorithm”. In: 2009 Proceedings of the Workshop on Algorithm Engineering and Experiments (ALENEX). 2009, pp. 52–61. doi:10 . 1137 / 1 . 9781611972894.5. eprint: https://epubs.siam.org/doi/pdf/10.1137/1. 9781611972894 . 5.url:https : / / epubs . siam . org / doi / abs / 10 . 1137 / 1 . 9781611972894.5. [44] Gopal Pandurangan, Peter Robinson, Michele Scquizzato, et al. “The distributed minimum spanning tree problem”. In: Bulletin of EATCS 2.125 (2018). [45] Edelmira Pasarella, Maria-Esther Vidal, and Cristina Zoltan. “Comparing MapReduce and Pipeline Implementations for Counting Triangles”. In: PROLE. 2017. url:https://api.semanticscholar.org/CorpusID:11937418. [46] Edelmira Pasarella, Maria-Esther Vidal, Cristina Zoltan, and Juan Pablo Royo Sales. “A computational framework based on the dynamic pipeline approach”. In: Journal of Logical and Algebraic Methods in Programming 139 (2024), p. 100966. issn: 2352-2208. doi:10.1016/j.jlamp.2024.100966.url:http://dx.doi. org/10.1016/j.jlamp.2024.100966. [47] Mihai Patrascu and Erik D. Demaine. “Logarithmic Lower Bounds in the Cell- Probe Model”. In: SIAM Journal of Computing 35.4 (2006), pp. 932–963. [48] R. C. Prim. “Shortest connection networks and some generalizations”. In: The Bell System Technical Journal 36.6 (1957), pp. 1389–1401. doi:10.1002/j.1538- 7305.1957.tb01515.x. [49] Celso C. Ribeiro and Rodrigo F. Toso. “Experimental Analysis of Algorithms for Updating Minimum Spanning Trees on Graphs Subject to Changes on Edge Weights”. In: Experimental Algorithms. Ed. by Camil Demetrescu. Berlin, Heidelberg: Springer Berlin Heidelberg, 2007, pp. 393–405. isbn: 978-3-540-72845-0. [50] J. Royo, Edelmira Pasarella, C. Zolt´an, and Maria-Esther Vidal. “Towards a dynamic pipeline framework implemented in (parallel) Haskell”. In: Actas de las XX Jornadas de Programaci´on y Lenguajes (PROLE 2021). Sociedad de Ingenier´ıa de Software y Tecnolog´ıas de Desarrollo de Software (SISTEDES), 2021, pp. 1–17. url:http://hdl.handle.net/2117/365477. [51] Juan Pablo Royo Sales. “An algorithm for incrementally enumerating bitriangles in large bipartite networks”. UPC, Facultat d’Inform`atica de Barcelona, Departament de Ci`encies de la Computaci´o, Oct. 2021. url:http://hdl.handle.net/2117/ 361615. 44 BIBLIOGRAPHY [52] Sherif Sakr, Angela Bonifati, Hannes Voigt, Alexandru Iosup, Khaled Ammar, Renzo Angles, Walid Aref, Marcelo Arenas, Maciej Besta, Peter A Boncz, et al. “The future is big graphs: a community view on graph processing systems”. In: Communications of the ACM 64.9 (2021), pp. 62–71. [53] Maria J. Serna. Lecture notes in Algorithmics. [54] Daniel D. Sleator and Robert Endre Tarjan. “A data structure for dynamic trees”. In: Journal of Computer and System Sciences 26.3 (1983), pp. 362–391. issn: 0022- 0000. doi:https://doi.org/10.1016/0022-0000(83)90006-5.url:https: //www.sciencedirect.com/science/article/pii/0022000083900065. [55] Daniel D. Sleator and Robert E. Tarjan. “Amortized efficiency of list update and paging rules”. In: Commun. ACM 28.2 (Feb. 1985), pp. 202–208. issn: 0001-0782. doi:10.1145/2786.2793.url:https://doi.org/10.1145/2786.2793. [56] Chenhao Tan, Jie Tang, Jimeng Sun, Quan Lin, and Fengjiao Wang. “Social action tracking via noise tolerant time-varying factor graphs”. In: Proceedings of the 16th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining. KDD ’10. Washington, DC, USA: Association for Computing Machinery, 2010, pp. 1049–1058. isbn: 9781450300551. doi:10.1145/1835804.1835936.url: https://doi.org/10.1145/1835804.1835936. [57] John Tang, Mirco Musolesi, Cecilia Mascolo, and Vito Latora. “Temporal distance metrics for social network analysis”. In: Proceedings of the 2nd ACM Workshop on Online Social Networks. WOSN ’09. Barcelona, Spain: Association for Computing Machinery, 2009, pp. 31–36. isbn: 9781605584454. doi:10.1145/1592665. 1592674.url:https://doi.org/10.1145/1592665.1592674. [58] Robert E. Tarjan and Jan van Leeuwen. “Worst-case Analysis of Set Union Algorithms”. In: J. ACM 31.2 (Mar. 1984), pp. 245–281. issn: 0004-5411. doi:10. 1145/62.2160.url:https://doi.org/10.1145/62.2160. [59] Alok Ranjan Tripathy and BNB Ray. “A New Parallel Algorithm for Minimum Spanning Tree (MST)”. In: International Journal of Advanced Studies in Computers, Science and Engineering 2.5 (2013), p. 7. [60] Leslie G. Valiant. “A bridging model for parallel computation”. In: Commun. ACM 33.8 (Aug. 1990), pp. 103–111. issn: 0001-0782. doi:10.1145/79173.79181.url: https://doi.org/10.1145/79173.79181. [61] Jan Wassenberg, Wolfgang Middelmann, and Peter Sanders. “An Efficient Parallel Algorithm for Graph-Based Image Segmentation”. In: Computer Analysis of Images and Patterns. Ed. by Xiaoyi Jiang and Nicolai Petkov. Berlin, Heidelberg: Springer Berlin Heidelberg, 2009, pp. 1003–1010. isbn: 978-3-642-03767-2. [62] Cristina Zoltan, Ana Edelmira Pasarella S´anchez, Juli´an Arturo Ar´aoz Durand, and Maria-Esther Vidal. “The dynamic pipeline paradigm”. In: 2019. url:https: //api.semanticscholar.org/CorpusID:208111957. Appendix A Code for simulate static random graphs in the DP Kruskal from math import exp , log import random def simulate random graph (N, p , normalize ) : f i l t e r s = [ 0 ] root s = [ 0 ] mapToFilter = dict( ) v = 1 u = −1 while v<N: u += 1 + int( log (1 −random . random ( ) ) / log (1 −p )) while u>= v and v<N: u=u−v v = v + 1 i f v<N: # Edge i s in t he graph and s hou ld be added to DP e = (u , v ) # Normalization operation i f normalize : i f e [ 0 ] >e[1]: e [ 0 ] , e [ 1 ] = e [ 1 ] , e [ 0 ] else : # Random order o f v e r t i c e s i f random . choice ( [ True , False ] ) : e [ 0 ] , e [ 1 ] = e [ 1 ] , e [ 0 ] i f e [ 0 ] not in mapToFilter : # I f ve rte x has not been assigned to a f i l t e r yet i f roots[−1] == Fsize : # I f l a s t f i l t e r has reached i t s maximum, we should make a new one f i l t e r s . append (0) root s . append (0) roots[−1] += 1 mapToFilter [ e [ 0 ] ] = len(filters) −1 f i l t e r s [ mapToFilter [ e [ 0 ] ] ] += 1 return filters 45 Appendix B Code for simulate real dynamic graphs in the DP Kruskal from math import exp , log import random def simulate ( path , normalize ) : filters = [dict ()] mapToFilter = dict( ) f i l e =open( path , ” r ” ) l i n e = f i l e . r ead l i n e ( ) V = set ( ) E = set ( ) while l i n e : l i n e = l i n e . s p l i t () for iin range ( 3 ) : l i n e [ i ] = int( l i n e [ i ] ) V. add ( l i n e [ 1 ] ) V. add ( l i n e [ 2 ] ) # Normalization operation i f normalize : i f l i n e [ 1 ] >li n e [ 2 ] : l i n e [ 1 ] , l i n e [ 2 ] = l i n e [ 2 ] , l i n e [ 1 ] else : # Random order o f v e r t i c e s i f random . cho ice ( [ True , False ] ) : l i n e [ 1 ] , l i n e [ 2 ] = l i n e [ 2 ] , l i n e [ 1 ] i f l i n e [ 0 ] == 1: # I n s er t Operation E. add ( ( l i n e [ 1 ] , l i n e [ 2 ] ) ) i f l i n e [ 1 ] not in mapToFilter : # I f ve r t ex has not been assigned to a f i l t e r yet i f len (filters[−1]) == Fsize : # I f l a s t f i l t e r has reached i t s maximum, we should make a new one f i l t e r s . append ( dict ()) filters[−1 ][ l i n e [ 1 ] ] = set() mapToFilter [ l in e [ 1 ] ] = len(filters) −1 f i l t e r s [ mapToFilter [ l i n e [ 1 ] ] ] [ l i n e [ 1 ] ] . add ( l i n e [ 2 ] ) e l i f l i n e [ 1 ] == 2: # Delete Operation i f l i n e [ 1 ] in mapToFilter and l i n e [ 2 ] in f i l t e r s [ mapToFilter [ l in e [ 1 ] ] ] [ l i n e [ 1 ] ] : f i l t e r s [ mapToFilter [ l i n e [ 1 ] ] ] [ l i n e [ 1 ] ] . remove ( l i n e [ 2 ] ) l i n e = f i l e . r ead l i n e ( ) density = [ sum( [ len(filter [ root ] ) for root in f i l t e r ] ) for f i l t e r in filters ] return density 46