Broadcasting a file in a communication network

We study the problem of distributing a file, initially located at a server, among a set of n nodes. The file is divided into m≥1\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$m\ge 1$$\end{document} equally sized packets. After downloading a packet, nodes can upload it to other nodes, possibly to multiple nodes in parallel. Each node, however, may receive each packet from a single source node only. The upload and download rates between nodes are constrained by node- and server-specific upload and download capacities. The objective is to minimize the makespan. This problem has been proposed and analyzed first by Mundinger et al. (J Sched 11:105–120, 2008. https://doi.org/10.1007/s10951-007-0017-9) under the assumption that uploads obey the fair sharing principle, that is, concurrent upload rates from a common source are equal at any point in time. Under this assumption, the authors devised an optimal polynomial time algorithm for the case where the upload capacity of the server and the nodes’ upload and download capacities are all equal. In this work, we drop the fair sharing assumption and derive an exact polynomial time algorithm for the case when upload and download capacities per node and among nodes are equal. We further show that the problem becomes strongly NP-hard for equal upload and download capacities per node that may differ among nodes, even for a single packet. For this case, we devise a polynomial time (1+22)\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\smash {(1+2\sqrt{2})}$$\end{document}-approximation algorithm. Finally, we devise two polynomial time algorithms with approximation guarantees of 5 and 2+⌈log2⌈n/m⌉⌉/m\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$2 + \lceil \log _2 \lceil n/m\rceil \rceil /m$$\end{document}, respectively, for the general case of m packets.


Introduction
The theory and practice of computing has seen two major paradigm shifts over the past decades. First, with the rise of cloud computing services, the computations for the solution of a difficult problem are often distributed among several data centers scattered all over the world. Second, on a more microscopic level, most processor architectures have multiple cores that (ideally) solve computational problems in parallel. In both realms, it is important to efficiently distribute data available at one entity (computer, processor, etc.) to all other entities of the system, or said differently, to efficiently broadcast data (Armbrust et al. 2009). A widely accepted measure of efficiency is the time needed to complete the broadcast (called the makespan), leading to the minimum time broadcasting problem. The makespan objective is for instance important for cloud computing systems, where it is crucial that security updates are disseminated to every computing node as fast as possible.
In the minimum time broadcasting problem, we are given a graph, whose nodes correspond to the entities of the system. At time zero, a file is located at a designated node (the server),  Fig. 1 Graphical representation of the file distribution problem we consider and the task is to disseminate the file to all nodes as fast as possible. We assume that the file is divided into m equally sized packets. At any point in time, each node that possesses a certain packet may send it with an arbitrary rate to other nodes that have not yet received this packet. As it is common in cloud computing, the nodes are connected to each other via a core network which is usually overprovisioned. Thus, the sending rates to and from other nodes (via the core) are limited by two capacities. First, for each node i there is an upload capacity c u i , and the sum of the sending rates of i may not exceed c u i . Second, every node has a download capacity c d i . This problem contains elements of several classical combinatorial optimization problems such as network design, scheduling and routing. A feasible solution (for a single packet) can be thought of as a directed tree rooted at the source node with the understanding that a node receives the packet from its unique parent and sends it to its children nodes. The additional feature besides finding an optimal distribution tree is to define a schedule determining the points in time when nodes actually send the packet. In contrast to classical scheduling models, however, once nodes received the packet they may send the packet to other nodes, thus, in scheduling terminology, machines can be activated.
Alternatively, the problem can be interpreted as a dynamic multicommodity flow problem in a star-shaped topology, see Fig. 1. The central vertex of the network represents the core network. All nodes are connected to this vertex via a pair of antiparallel arcs, equipped with upload and download capacities. Packets of the file can be sent from one node to another via the unique directed simple path between them. The total flow on an arc must not exceed its capacity at any point in time.

Previous work
There is a large body of work on the (minimum time) broadcasting problem, multicast problem, and gossiping problem, see Hedetniemi et al. (1998) for a survey. In the broadcasting problem, the task is to disseminate a file from a source node to the rest of the nodes in a given communication network as fast as possible, see Ravi (1994) for an approximation algorithm. When the file needs to be disseminated only to a subset of the nodes, this task is referred to as multicasting, see Bar-Noy et al. (2000a) for approximation algorithms. In the gossiping problem, several nodes possess different files and the goal is to transmit every file to every node. The usual underlying communication model for these problems is known as the telephone model: A node may send a file to at most one other node at a time, and it takes one round (i.e., one unit of time) to transfer a file. For complete graphs on n + 1 nodes, this process terminates in log 2 (n + 1) rounds. It is known that for arbitrary communication graphs, the problem of computing an optimal broadcast in the telephone model is NP-hard (cf. Garey and Johnson 1979), even for 3-regular planar graphs (cf. Middendorf 1993). Khuller and Kim (2007) studied the problem of broadcasting in heterogeneous networks [cf. Bar-Noy et al. (2000a) for the corresponding multicast problem]. They consider complete graphs, but extend the telephone model by allowing the transmission time of the file to depend on the sender. They prove that it is NP-hard to minimize the makespan and present an approximation scheme.
All the above models, however, do not take into account two important features of many real-world implementations of broadcasting systems, such as cloud computing or peerto-peer networks. First, each node typically sends the file to multiple nodes of the network in parallel. Second, the file is usually divided into packets (as the smallest indivisible unit), and a node may receive different packets from different nodes. These extensions result in structural changes of the model. In contrast to the telephone model [including the extension of Khuller and Kim (2007)], in our model the transfer time between any two nodes is no longer part of the instance but determined by the sending rates of a feasible solution. In fact, the model of Khuller and Kim (2007) for broadcasting in heterogeneous networks reduces to a special case of our model. If c d i ≥ max j∈N c u j for all i ∈ N , there always is an optimal solution in which no node will send the file to more than one other node at a time, thus, the time to transfer the file from one node to another only depends on the sender's upload capacity. In general, however, it may be beneficial to serve multiple nodes simultaneously as illustrated in the following example of a file distribution problem in a network with three nodes. Node 0 with capacity c u 0 = 2 initially owns the file consisting of one packet. There are two further nodes with capacities c u i = c d i = 1, i = 1, 2. In the optimal solution, both nodes receive the file in parallel at a rate of 1, yielding a makespan of M * = 1. Restricting nodes to upload to at most one other node at a time results in a makespan of 2. Mundinger et al. (2008) studied a peer-to-peer file distribution problem, where a file is subdivided in multiple parts and the goal is to disseminate the complete file to every peer as fast as possible. The crucial difference to our model is that they assume that the upload capacity of a node is equally shared among concurrent uploads. Under this fair sharing assumption, they prove that for homogeneous capacities (i.e., c u i = c d i = 1 for all nodes i) a simple greedy algorithm is optimal. (A similar result was also earlier reported by Kwon and Chwa (1995) and Bar-Noy et al. (2000b), assuming the telephone model.) We prove this result without the fair sharing assumption. Our proofs are quite involved, since dropping the fair sharing assumption considerably complicates matters. For heterogeneous capacities, to the best of our knowledge, neither approximation algorithms nor hardness results were known before.
When the number of parts of the file tends to infinity, one obtains the so-called fluid flow model, for which a relatively easy closed-form expression of the minimum completion time can be derived, see, e.g., Ezovski et al. (2009), Kumar et al. (2006), and Mehyar et al. (2007). Qiu and Srikant (2004) studied a related model with stochastic arrival of peers. Fan et al. (2009) considered a finite number of parts, but assumed that the number of parts is large enough such that a peer always has enough "new" parts to share with other peers.
The file distribution problem we consider has elements of a scheduling problem in which a job becomes a machine after its completion. A related problem exhibiting this property is the freeze-tag problem studied in the area of robotics. Here, a set of asleep robots is placed on a graph. There is one designated robot which is awake and that can travel to other robots in order to awake them. Once a robot is awake, it may travel to other robots to awake them. The task is to awake all robots as fast as possible. Arkin et al. (2003) showed the hardness of the problem in unweighted graphs and gave a constant factor approximation algorithm for the case that there is at most one robot at each node. For the general case, they obtained a √ log n -approximation, where n is the number of robots. Könemann et al. (2005) devised a O √ log n -approximation for the weighted case. Arkin et al. (2006) studied the problem for different graph topologies. Closest to our setting, they showed that the problem is NP-complete, even for star networks. For this case, they devised a 14-approximation.

Summary of the results and used techniques
Our results for a single packet. In Sect. 3, we study the basic situation in which a single packet is to be broadcasted. For the case of homogeneous symmetric (unit) capacities, that is, c u i = c d i = 1 for all nodes i, we show that a greedy algorithm computes an optimal solution with makespan log 2 (n + 1) . Although similar results for the same algorithm have been obtained before, e.g., by Mundinger et al. (2008), or in the broadcasting literature (Kwon and Chwa 1995;Bar-Noy et al. 2000b), our result holds for a more general model as we drop the fair sharing assumption used by Mundinger et al. in the telephone model. For the case of unit node capacities and an arbitrary integer server capacity, we propose a polynomial time algorithm (that possibly splits up server capacity) and prove its optimality. We also give a closed-form expression of the minimal makespan.
If node capacities are heterogeneous and symmetric (i.e., c u i = c d i for all nodes i), we show that the problem becomes strongly NP-hard. A key ingredient of the reduction (from 3-Partition) is the Capacity Expansion Lemma (Lemma 5) that provides an upper bound on the total amount of data downloaded at any point in time.
In light of the hardness, we then study approximation algorithms. We first devise a polynomial time 2 √ 2approximation algorithm for instances with heterogeneous, symmetric capacities in which the upload capacity of the server is larger than the download capacity of any other node. For smaller server capacities, a slight modification of our algorithm gives a (1 + 2 √ 2)-approximation. Our algorithm which we term Scale-Fit proceeds in two phases; in a first phase, we use a time-varying resource augmentation to construct a so-called √ 2-augmented solution, that violates the capacity constraints of the nodes at any point in time by a factor of at most √ 2. By exploiting again our Capacity Expansion Lemma, we prove that the makespan of the augmented solution thus constructed is at most a factor of 2 away from the optimal makespan of the original instance. We then rescale the relaxed solution to obtain a feasible solution with makespan less than a factor 2 √ 2 away from the optimal makespan.
Our results for multiple packets. In Sect. 4, we proceed by analyzing the more challenging problem of distributing a file that is divided into m > 1 packets to a set of nodes with heterogeneous symmetric capacities. First, we devise an algorithm, which we call Spread-Exchange, that works in two phases. In the first phase, we use a slight variation of our Scale-Fit-Algorithm for single packet distribution in order to send one packet to each node. At the end of the first phase, each node possesses one packet of the file, but the packets owned by different nodes may differ. In fact, we strive to maximize the variety of different packets available at the nodes. In the second phase, the nodes exchange the packets among each other, in each round increasing the number of packets available at each node by one. By carefully keeping track of the proportions of the different packets available at the nodes during both phases of the algorithm, we prove that for instances for which the server has the largest capacity, Spread-Exchange achieves an 4-approximation of the optimal makespan. For smaller server capacities, a slight variation of the algorithm gives a 5-approximation.
Motivated by real-world instances where the number of packets is large compared to the number of nodes, we also propose a different algorithm, termed Spread-Mirror-Cycle, that performs better than Spread-Exchange on these instances. The main idea is to invest more time in the first phase, in order to achieve a balanced proportion of the different packets available at the different nodes. This allows to perform a faster exchange procedure in the second phase. For a large number of packets, the second phase dominates the makespan of the solutions of both algorithms and, thus, Spread-Mirror-Cycle performs better than Spread-Exchange. We prove that Spread-Mirror-Cycle yields a (2 + 2 log 2 n/m /m)-approximation, establishing that Spread-Mirror-Cycle has a better worst-case guarantee for instances in which n m2 (3/2) m .

Preliminaries
An instance of the minimum time broadcasting problem is described by a tuple ≥0 is the vector of download capacities from the core network and ≥0 is the vector of upload capacities to the core network. Let [m] = {1, 2, . . . , m} be the set of packets. We will identify the server with node 0 and assume that only the server initially owns the file. See Fig. 1 for an illustration. The file is of unit size; the size of each packet is i, j (t) denotes the rate at which node i sends packet k to node j at time t. We require that each node i ∈ N receives each packet k from a unique node, denoted by p (k) In addition, only nodes that possess a packet k can send that packet with a positive rate: Finally, the sending rates have to obey download and upload capacity constraints: We denote by the proportion of the file owned by node i ∈ N \{0} at time t.
For notational convenience, we set x 0 (t) = 1 for all t ∈ R ≥0 . We let C i = inf{t ∈ R ≥0 : x i (t) = 1} denote the completion time of node i. The makespan of a solution S is then defined as we speak of an instance with homogeneous symmetric capacities. If an instance satisfies , we speak of heterogeneous symmetric capacities. In both cases, we only write I = (N , m, c) meaning that c = c u = c d . If m = 1, we only write I = (N , c).
As we will show, the minimum time broadcasting problem is in general NP-hard. A common approach in theoretical computer science to deal with such problems is to consider approximation algorithms. For a minimization problem P and ρ > 1, a ρ-approximation algorithm is an algorithm that, for any instance I ∈ P, computes a feasible solution S in time that is polynomial in the encoding length |I | of the input, such that the objective value c(S) is not greater than the optimal value Opt(I ) by more than a factor of ρ, i.e., c(S) ≤ ρ Opt(I ).
There are some particularities of the minimum time broadcasting problem regarding the polynomial running time of algorithms. In general, a solution may consist of arbitrarily complicated sending rate functions s (k) i, j . Without loss of generality, we can restrict ourselves to piecewise constant functions with discontinuities only at points in time where some node starts or finishes the download of a packet. Any solution that does not have this property can be modified to do so by flattening the sending rates in the intervals where the sending and receiving nodes for each packet are constant. Specifically, let [t 1 , t 2 ) be such an interval. It is easy to verify that the new sending ratess (k) i, j defined as s i, j (τ ) dτ for all i, j ∈ N obey the capacity constraints of the upload and download links; see also Miller and Wolisz (2011, Theorem 1) for a formal proof. A simple shifting argument further shows that it is without loss of generality to assume that a node starts receiving a packet only at time zero or when another node has finished receiving a packet. There are at most m · n of these breakpoints.
However, if the number of packets m is part of the input, encoded in binary, a polynomial time algorithm would usually only be allowed time that is polynomial in log m. Given that even a simplified (optimal) solution might need space linear in m, in the context of broadcasting a divisible file we call an algorithm polynomial if it is polynomial in the encoding length of the input and m. Another reason for assuming an input size proportional to m is that in real systems each packet contains a unique piece of information and, thus, the input size is in practice proportional to m.

Broadcasting a single packet
We begin by studying the base case m = 1, that is, the file consists of a single packet that is to be broadcasted. Parts of the results obtained in this chapter will be reused later to solve the more challenging general case m > 1. To increase the readability, throughout this section we drop the index k for the packet number from the notation.
This section is organized as follows. First, we propose efficient and optimal solutions for the case of homogeneous symmetric capacities, that is, upload and download capacities among the nodes are equal. Then, we show that for the more general case of heterogeneous symmetric capacities the computation of an optimal solution becomes strongly NPhard. Finally, we give an efficient O(n log n)-algorithm that approximates the optimal makespan by a factor of 1 + 2 √ 2.

Homogeneous symmetric capacities
In this section, we consider the homogeneous symmetric setting, i.e., The server has a capacity of c u 0 = c 0 . If the server has unit upload capacity c 0 = 1 as well, the following greedy procedure yields an optimal solution: At each point in time, any node that already owns the file uploads it to exactly one other node, which takes one unit of time. Thus in each step, the number of nodes owning the file is doubled, resulting in a makespan of log 2 (n + 1) . For a formal description of the procedure, see Algorithm 1.
Lemma 1 If c i = 1 for all i ∈ N , Algorithm 1 computes an optimal solution in time O(n). The optimal makespan is log 2 (n + 1) .
Proof Throughout the algorithm, the number of nodes that own the file (including node 0) at time t ∈ N is min{2 t , n} (proof by induction). All completion times are integral; hence, the makespan of the constructed solution is M = min{t ∈ N : 2 t ≥ n + 1} = min{t ∈ N : t ≥ log 2 (n + 1)} = log 2 (n + 1) .
To prove that this is best possible, consider an optimal solution S * = (s * i, j ) i, j∈N with the corresponding completion times C * 1 , . . . , C * n . We will modify this solution such that in the time interval [0, 1) only one node is served, completing the transfer at time 1, without increasing the makespan. Iterating this argument yields a solution with the same structure as the one constructed by Algorithm 1, establishing the claim. Let the nodes be indexed such that C * 1 = min i=1,...,n C * i . We set the rate vector s of the modified solution as follows: for all other i, j ∈ N and t ∈ R ≥0 . Without loss of generality, dτ for all t ∈ [0, C * 1 ) and all i, j ∈ N ; see Miller and Wolisz (2011, Theorem 1). It then holds that x * i (C * 1 ) = s * 0,i (0) · C * 1 for i ∈ N \ {1} with p(i) = 0. Using this, we can show that in the modified solution the upload capacity of node 0 is obeyed: The inequality above also yields s 0,i (t) ≤ 1 for all i ∈ N \{1} with p(i) = 0, so download capacities are obeyed as well since p(i) = 0 implies s * j,i (t) = 0 for all j = 0, t ∈ R ≥0 . Finally, at time C * 1 every node i ∈ N owns the same fraction of the file as in the original solution, namely x * i (C * 1 ). Since in S * no node completes its download before time C * 1 , and in the modified solution after time C * 1 the original rates are used, no completion of a download is delayed, and hence, the makespan is not increased.
We now consider the case where the server capacity c 0 is an arbitrary integer and start with a proof that in this case there always is an optimal solution that uses fair sharing, i.e., whenever node 0 serves several nodes simultaneously, all of them are served with equal rate. The proof is quite involved, and the integrality condition on c 0 is crucial. To see this, consider an example with c 0 = 3/2 and n = 4. In an optimal solution, the server serves node 1 in [0, 1) and node 2 in [1, 2) with a rate of 1 each and node 3 with a rate of 1/2 in [0, 2). Node 4 is served by node 1 in [1, 2), resulting in a makespan of M * = 2. The best solution that uses fair sharing, however, has a makespan of M = 7/3: The server serves nodes 1 and 2 in [0, 4/3) with a rate of 3/4 each, and node 3 and 4 are both served at a rate of 1 in [4/3, 7/3) by the server and node 1.
Lemma 2 For any instance I = (N , c) with c 0 ∈ N and c i = 1 for all i = 1, . . . , n, there always exists an optimal solution that uses fair sharing.
Proof For an arbitrary instance I with the demanded properties, consider an optimal solution S * with the corresponding completion times C * 1 , . . . , C * n . W.l.o.g. assume that the nodes are indexed such that and let 1 , 2 , . . . , ∈ {1, . . . , k} be such that . . , k, let m i be the makespan for serving all nodes that are directly or indirectly served by node i, i.e., where p r ( j) denotes the r -fold application of the function p on j. By Lemma 1, we can assume that these nodes are served according to Algorithm 1. (Otherwise, we modify the solution to get this structure without increasing the makespan.) In particular, we get that m i ∈ N for all i = 1, . . . , k. The makespan of the given optimal solution is Finally let M 1 = max i∈N 1 m i . In the following, we show how to modify the original solution s * to obtain a solution s that uses fair sharing and has not a larger makespan. All primed variables s i, j , C , x , 1 and N 1 refer to variables of the modified solution. Whenever s i, j (t) is not specified for some i, j, t, it is equal to the original value s * i, j (t). The modification of s * to s proceeds iteratively in steps. In each step, one of four modifications is made. Specifically, if the server capacity is not smaller than k, all nodes {1, . . . , k} are served by the server at equal rate (Case 1). If k > c 0 and M 1 ≤ m i 0 for some i 0 ∈ { 1 + 1, . . . , k}, a single node is added to N 1 and all nodes in N 1 are served with equal rate while maintaining the original rates for all nodes not in N 1 (Case 2). If 1 ≥ c 0 and M 1 > m i for all i ∈ { 1 + 1, . . . , k}, the server serves all nodes in N 1 at full capacity and with fair sharing; the serving of the other nodes is delayed (Case 3). Finally, if 1 < c 0 < k and M 1 > m i for all i ∈ { 1 + 1, . . . , k}, we increase N 1 to size c 0 and serve the nodes in N 1 at full capacity with fair sharing; the serving of all other nodes is delayed (Case 4).
Application of Case 1 immediately leaves us with a solution that uses fair sharing. Application of Case 3 and Case 4 leaves us with a solution s with completion times with fair sharing and nodes i ∈ { 1 + 1, . . . , k} are served by the server after C 1 . We then fix the part of the solution related to the nodes in N 1 (and the nodes served by these nodes) and apply the same modifications for the nodes in N 2 = { 1 + 1, . . . , 1 + 2 }. Finally, after application of Case 2, we have increased the size of N 1 by one. Since the number of nodes is finite, after a finite number of applications of Case 2, one of the other three cases is applied.
We proceed to show that the application of the four cases yields a feasible solution and does not increase the makespan. Case 1: k ≤ c 0 . In this case, we let node 0 serve the nodes 1, . . . , k at a rate of 1 in the time interval [0, 1). Obviously no node completes its download later than in the given solution, and fair sharing is used all the time.
In the following cases, we always assume that k > c 0 .
Then nodes 1, . . . , 1 +1 all complete their download at time C * 1 +1 since for all i = 1, . . . , 1 + 1. The download capacities of all nodes are satisfied since at any point t in time The same is true for the upload capacity of the server, since it uploads with the same overall rate as in the original solution at each point in time.
We proceed to argue that this modification does not increase the makespan. First, since M 1 ≤ m i 0 , for all i ∈ N 1 we have so delaying the completion of nodes in N 1 does not influence the makespan. Furthermore, in the modified solution s , all nodes i ∈ { 1 + 2, . . . , k} are served by the server in the same way as in solution s * so that their completion time C i as well as the completion times of the nodes served by them does not change.
We now turn to the cases where M 1 > m i for all i = 1 + 1, . . . , k. Note that by Lemma 1, we know that m i ∈ N for all i; hence, we can assume M 1 ≥ m i + 1 for all i > 1 in the subsequent cases. Case 3: 1 ≥ c 0 and M 1 ≥ m i + 1 for all i > 1 . In this case, we modify the solution such that node 0 first serves all nodes in N 1 at full capacity, delaying the serving of all other nodes until those in N 1 have completed their downloads. More formally, let t 1 = 1 /c 0 , and set It is obvious that in [0, t 1 ) all capacities are obeyed and C i = t 1 ≤ C * i for all i ∈ N 1 . To specify how the remaining nodes are served, let t 2 = max{C * 1 , t 1 + 1}. We serve nodes 1 + 1, . . . , k in such a way that the fraction of the file they own at time t 2 is the same as in the original solution, i.e., x i (t 2 ) = x * i (t 2 ): Since x * i (t 2 ) ≤ 1 and t 2 − t 1 ≥ 1, this solution obeys the download capacities of all nodes. Also the upload capacity of the server is obeyed, since in the time interval [0, t 2 ) it sends the same volume as in the original solution: and the overall rate the server sends at is c 0 at the beginning and constant afterward, hence it is at most c 0 at all times. From time t 2 on, in the modified solution s , all nodes are served as in the original solution s * . Nodes in N 1 and nodes with C * i ≥ t 2 complete their download no later than in the original solution. If there is a node i ∈ { 1 + 1, . . . , k} with C * i < t 2 , then t 2 > C * 1 and thus t 2 = t 1 + 1, and this node i completes its download exactly one time unit after the nodes in N 1 . Since M 1 ≥ m i + 1 we obtain that therefore the makespan is not increased. Case 4: 1 < c 0 and M 1 ≥ m i + 1 for all i > 1 . In this case, we add nodes 1 + 1, . . . , c 0 to N 1 and serve these nodes jointly at full capacity in the time interval [0, 1): For the serving of the remaining nodes, we set t 2 = max{C * c 0 , 2} and serve nodes c 0 +1, . . . , k such that Feasibility follows similarly to Case 3, as well as the fact that the makespan is not increased.
We continue by proving that the server always serves groups of c 0 nodes jointly, possibly except for some start interval [0, t 1 ), t 1 ∈ R ≥0 where a group of at least c 0 and most 2c 0 nodes is served.
Lemma 3 For any instance I = (N , c) with c 0 ∈ N and c i = 1 for all i = 1, . . . , n, there always exists an optimal solution that uses fair sharing where the server never serves more than c 0 nodes simultaneously except for some interval [0, t 1 ], t 1 ∈ R ≥0 in which at least c 0 and at most 2c 0 nodes are served simultaneously until they are completed.
Proof For an instance with the demanded properties, consider an optimal solution S * . Using Lemma 2, we can assume w.l.o.g. that the set {i ∈ N : p(i) = 0} of nodes served by the server is partitioned into sets N 1 , . . . , N k such that all nodes i ∈ N j are served simultaneously by the server at equal rates in the time interval We can further assume that |N j | ≥ c 0 for j = 1, . . . , k − 1 (otherwise we can add nodes from N j+1 to N j without increasing the makespan) and |N j | < 2c 0 for j = 1, . . . , k (Otherwise, we split N j into two sets and serve c 0 nodes For j = 1, . . . , k, we denote byÑ j the set of nodes that are directly or indirectly served by a node in N j , and by M j the makespan needed for this, i.e., where again p r ( j) denotes the r -fold application of the function p on j. As in the proof of Lemma 2, we can assume that M j ∈ N for all j = 1, . . . , k. We now prove by induction that the solution can be modified such that |N j | ≤ c 0 for j = 2, . . . , k, without increasing the makespan. For the base case, assume |N 2 | > c 0 . We decrease N 2 to contain only c 0 nodes. If M 1 ≤ M 2 + 1, we remove |N 2 | − c 0 nodes from |N 2 |, add them to N 1 and let them be served by the server jointly with the other nodes in N 1 . This delays the completion of nodes in N 1 to time but using M 1 ≤ M 2 + 1 it does not increase the makespan since the new makespan of any node inÑ 1 can be bounded by Here, the |N 2 | − c 0 removed nodes will be served by nodes inÑ 2 . For this, the makespan M 2 has to be increased by at most one. To see this note that Algorithm 2: Extended Greedy for integral server capacity In [t 1 + t, t 1 + t + 1), node 0 serves nodes in N t+2 , any completed node i ∈ N \ {0} serves one other node that is not yet served (if there still is one); 14 end nodes through nodes in N 2 , so we can serve all nodes iñ N 2 (including the nodes from N 2 ). The overall makespan is not increased by this, since the serving of N 2 is now completed at time t 2 = t 1 + 1, and hence, all nodes inÑ 2 are served at time For the inductive step, assume |N j | > c 0 for some j = 3, . . . , k. By the induction hypothesis, we know that |N | = c 0 for = 2, . . . , j − 1 and thus t j−1 = t + j − − 1 for all = 1, . . . , j − 1. With this and a distinction between the cases M ≤ M j + j − and M ≥ M j + j − + 1, the inductive step follows similarly to the base case.
Summing up, we have shown so far that there always is an optimal solution where the server at the beginning serves a set of nodes N 1 , c 0 ≤ |N 1 | < 2c 0 , in |N 1 |/c 0 time units, then some sets N 2 , . . . , N k−1 with |N j | = c 0 for all j ≥ 2, in one time unit each, and finally a set N k containing at most c 0 nodes, in another unit of time.
We are now ready to present an exact algorithm for this special case and prove its correctness. Intuitively speaking, the algorithm is an extended greedy procedure that attempts to balance the sub-makespans M j of the different sets N j of nodes served by the server. Set h = log 2 (n/c 0 + 1) . If Meanwhile, any node that finishes its download starts serving other nodes greedily. Details are listed in Algorithm 2.
Theorem 4 For any instance I = (N , c) with c 0 ∈ N and c i = 1 for all i = 1, . . . , n, Algorithm 2 yields an optimal solution. The optimal makespan is Proof W.l.o.g. we can assume that in the solution produced by Algorithm 2, (1)], i.e., all setsÑ j for j ≥ 2 are as big as possible. If this is not the case, we can move nodes from N 1 to these sets. The lemmas above state that there also is an optimal solution with this structure and c 0 ≤ |N 1 | < 2c 0 . In the argumentation below, we therefore restrict to solutions of this structure.
The maximum number of nodes that can be served like this is c 0 (2 h+1 − 1) > n, so indeed all nodes are served within a makespan of h + 1. Assume that in an optimal solution only k = h sets are served by the server. The maximum number of nodes served in this way is so not all nodes can be served, contradiction! Therefore in an optimal solution it must hold that k = h + 1 and |N 1 | ≥ c 0 , proving that the solution produced by Algorithm 2 is optimal.
If n < c 0 (2 h − 1 + 2 h−1 ), the size of N 1 in an optimal solution (with |Ñ j | = c 0 · 2 k− j for j ≥ 2) has to be chosen such that which is exactly how the algorithm chooses N 1 . Moreover, the algorithm sets k = h. It is obvious that choosing k ≤ h−1 does not lead to a solution where all nodes are served, and choosing k ≥ h + 1 leads to a solution with a makespan of at least h + 1. The solution produced by our algorithm has a makespan of t 1 + k − 1 ≤ h + 1, where we used t 1 ≤ 2 and k = h. This proves the correctness of Algorithm 2.

Heterogeneous symmetric capacities
In this section, we consider the case of heterogeneous and symmetric capacities. First, we show that the minimum time broadcasting problem for heterogeneous symmetric capacities is strongly NP-hard, even for an indivisible file. Then, we devise an algorithm that approximates the optimal makespan by a factor 1 + 2 √ 2. Our hardness and approximation results rely on a useful lemma that bounds the work that has to be done in any feasible solution. For a feasible solution, let u i (t 1 , t 2 ) and z i (t 1 , t 2 ) denote the total upload and the idleness of node i in time interval [t 1 , t 2 ], defined as For t ≥ 0, we define and We obtain the immediate equality X (t 2 ) − X (t 1 ) = i∈N u i (t 1 , t 2 ) for all 0 ≤ t 1 ≤ t 2 .
Lemma 5 (Capacity expansion lemma) Let I = (N , c) be an instance of the minimum time broadcasting problem with an indivisible file, and let c = max i∈N c i . Then, for all solutions S of I , the following two statements hold: 1. For all nodes i ∈ N and all times 0 ≤ t 1 < t 2 : Proof To see 1., note that for any node i with C i ≤ t 1 , the upload rate (integrand of the total upload) and the idle rate (integrand of the idleness) sum up to c i for all t ∈ [t 1 , t 2 ], c i time units to finish its download, thus only a time interval of length t 2 − t 1 − 1−x i (t 1 ) c i remains for the upload and the claimed inequality follows. We prove 2. by induction over k. The inequality is trivial for k = 0 since initially only the server holds the file. So, let us assume that for k ∈ N, we have X k−1 c + Z k−1 c ≤ 2 k−1 and that this inequality is strict if there is i ∈ N with c i < c and 0 < C i ≤ k−1 c . Using 1., we obtain where we use c i ≤ c. Rearranging terms and using the induction hypothesis, we obtain To finish the proof, let us assume that there is i ∈ N with c i < c and 0 < C i ≤ k c . If C i ≤ k−1 c , using the induction hypothesis, we obtain X k−1 c < 2 k−1 and, by (3), X k c < 2 k . If, on the other hand, C i ∈ k−1 c , k c , then the inequality (2) is satisfied strictly and we obtain X k c < 2 k by (3).

Hardness
We are now ready to prove strong NP-hardness of the minimum time broadcasting problem.

Theorem 6
The minimum time broadcasting problem for heterogeneous symmetric capacities is strongly NP-hard, even for m = 1.
Proof We reduce from 3-Partition. An instance of 3-Partition is given by a multiset P = {k 1 , . . . , k n } of n = 3μ, μ ∈ N, positive integers. The goal is to partition P into μ subsets P 0 , . . . , P μ−1 such that the sum of all integers within each subset is equal. The decision whether such partition exists remains NP-complete in the strong sense even if B/4 < k i < B/2 for all k i ∈ P, where B = n i=1 k i /μ is integer, see Garey and Johnson (1979). We first construct a modified 3-Partition instance in which μ is a power of two and larger or equal to 16. To this end, let = max{ log 2 μ , 4} and set μ = 2 . We define the new instance by The goal is to partition P into μ subsets P 0 , . . . , P μ −1 such that the sum of all integers within each subset is equal. Note that |P | might not be equal to 3μ , but this does not hurt our following arguments. Because the integer B/2 can only go with another integer B/2 in a "yes"-instance of the modified 3-Partition problem, the modified 3-Partition instance P admits a solution if and only if the original instance P admits a solution.
Given the modified instance P of 3-Partition, we construct an instance I of the minimum time broadcasting problem as follows: For every k i ∈ P , we introduce a master element node i 0 with capacity c i 0 = k i and 2 k i − 2 element nodes i 1 , . . . , i 2 k i −2 with capacity c i k = k i k i −1 for all k ∈ {1, . . . , 2 k i − 2}. For j ∈ {0, . . . , μ − 1}, we introduce a subset node s j with capacity c s j = B. Subset node s 0 initially owns the file. Note that 3-Partition is strongly NP-complete, i.e., is NP-complete even if the integers k i are represented unary. For unary encoded integers of the 3-Partition instance, we obtain a polynomial reduction.
We claim that the optimal makespan of I is less or equal B + if and only if P is a yes-instance. For the "if"-part, we construct a solution S where first all subset nodes are served, and then, each subset node serves those master element nodes that correspond to elements in one of the sets of the partition. Afterward all element nodes are served. More formally, in the first 1 B time units subset node s 0 sends the file to the first subset node s 1 with a rate of s s 0 ,s 1 (t) = B for all t ∈ [0, 1 B ). After 1/B time units, the first subset node has completed the download of the file. Starting at time 1/B subset nodes s 0 and s 1 send the file to the subset nodes s 2 and s 3 , respectively, each with a rate of s s 0 ,s 2 (t) = s s 1 ,s 3 (t) = B for all t ∈ 1 B , 2 B . Continuing in this fashion, at time /B all μ subset nodes own the file but none of the other nodes has received any data. Let P * 0 , . . . , P * μ −1 be a solution of P . In the remaining time units, subset node s j , j ∈ {0, . . . , μ − 1}, sends the file to every master element node i 0 with k i ∈ P * j , at a rate of s s j ,i 0 (t) = k i for all t ∈ B + 1 k i . This is feasible since P * 0 , . . . , P * μ −1 is a solution of P and thus i∈S * j k i = B. The download of each master element node is finished after 1/k i time units at time B + 1 k i . At this point in time, master element node i 0 starts to send data to k i − 1 of the corresponding element nodes i j , j ∈ {1, . . . , k i − 1}, at a rate of The download of the file by the element nodes starts at time B + 1 k i and needs additional k i −1 k i time units, resulting in a total makespan of B + . It remains to be shown that the optimal makespan of the broadcasting instance I is strictly larger than B + in the case that P is a no-instance. We first argue that no element node i k , k ∈ {1, . . . , 2 k i − 2}, will upload the file to any other node. Both the upload and the download of the complete file by element node i k requires at least k i −1 where we use ≥ 4. This value is larger than the assumed makespan. Hence, we can assume that only the subset nodes (including the server s 0 ) and the master element nodes upload the file to other nodes. In order to find a solution of I with M ≤ B + , it is necessary to find a partial solutionS of the partial instanceĪ that consists only of subset nodes and the master element nodes and has accumulated enough idleness until time B + , i.e., Otherwise the idleness of subset nodes and master element nodes does not suffice to serve all element nodes until time B + in the original instance S. We proceed to show that for the partial instance, no such partial solution exists. Let us first assume that x s j B = 1 for every subset node s j . Using Lemma 5, the inequality X B + Z B ≤ μ holds, thus Z B = 0 and x i 0 B = 0 for every master element node i 0 . We calculate For the completion time C i 0 of a master element node i 0 , we obtain the inequality C i 0 ≥ B + 1 k i . We claim that there is at least one master element node i 0 for which this inequality is strict. For a contradiction, suppose that C i 0 = B + 1 k i for all k i ∈ P . This implies that every master element node i 0 downloads with its full rate s p(i 0 ),i 0 = c i 0 . Let us define P j = {k i : p(i 0 ) = s j }. As subset node s j has capacity c s j = B and serves all master element nodes i 0 with k i ∈ S j with full rate, we derive that k i ∈S j k i ≤ B. Thus, S j is a solution to the 3-Partition instance P , a contradiction. Consequently, there is a master element node i 0 with We are left with the case that at least one of the subset nodes has not finished the download of the file at time B , that is, there is j ∈ {1, . . . , μ − 1} with x s j ( B ) < 1. We calculate where (4) stems from the fact that each node i ∈ N still needs to download a proportion of 1 − x i ( B ) of the file. For each subset node s j with x s j ( B ) < 1, we have , and for each master element node with . We distinguish two cases.
First case: At least one of the master element nodes has finished the download at time B . Then, inequality (5) is strict and we obtain Second case: All master element nodes and at least one of the subset nodes still have not finished the downloads at time /B. Then, the upload capacity of the other subset nodes is not sufficient to serve all master element nodes with their full download rate, thus, one of the inequalities is satisfied strictly. As a consequence, we obtain

Approximation
In this section, we devise an algorithm that runs in time O(n log n) and computes a solution with makespan no larger than (1 + 2 √ 2)M * , where M * is the optimal makespan. We first consider the case c 0 ≥ c i for all i = 1, . . . , n, for which we will show a 2 √ 2-approximation. Then, we will use this result to obtain a (1 + 2 √ 2)-approximation for arbitrary server capacities. The additional summand of M * in the approximation arises as possibly we first have to transfer the file to the node having the largest capacity which takes at most M * time units.
Before we present details of the algorithm, we give a high-level picture of our approach. The intrinsic difficulty in proving any approximation guarantee is to obtain lower bounds on the optimal makespan. Let us recall the inequality shown in the Capacity Expansion Lemma (Lemma 5). For any solution, node i's contribution to the upload in time is the total idleness of node i in the time interval [t 1 , t 2 ]. To exploit this capacity bound, our algorithm should fulfill two properties: it should send the file to nodes with large capacity as soon as possible, and it should avoid idle time as long as possible. To achieve this, we use the concept of time-varying resource augmentation. For λ ≥ 1, we call a possibly infeasible solutionS a λ-augmented solution, if at any point in time the original capacities are not exceeded by more than a factor of λ, i.e., j∈N s i, j (t) ≤ λc u i and s p(i),i (t) ≤ λc d i for all i ∈ N , t ∈ R ≥0 . We will show that there is an efficiently computable √ 2-augmented solution that satisfies the abovementioned properties. This allows us to apply the Capacity Expansion Lemma, and we get that the makespanM ofS is not larger than 2M * . Rescaling the augmented solutionS to obtain a feasible solution S, we get an additional factor of √ 2. We now explain the scaling of the capacities during the course of the algorithm, see also Algorithm 3 for a more formal description. The algorithm maintains a queue Q of capacity release events (t, i, c) ∈ R ≥0 × N × R ≥0 meaning that at time t a capacity of c of node i is available for uploads. At the start of the algorithm only the server is available for uploads so Q has only a single entry (0, 0, c 0 ).
Order the nodes non-increasingly by capacities such that c 1 ≥ c 2 ≥ · · · ≥ c n and consider a point in time t, where a node i becomes available with its full upload capacity c i and suppose that nodes 1, . . . , k − 1 have already received a fraction of the file. We now determine a number k ≥ k such that nodes k, . . . , k start receiving the file from node i. The number k is chosen such that either nodes k, . . . , k receive the file at their full capacity and the upload factor of node i is violated by a factor β ∈ [1, √ 2) or node i sends the file at full capacity and the download capacity of all nodes k, . . . , k is violated by a factor α ∈ [1, √ 2). The next lemma shows that such k always exists (provided that there are enough nodes left).
During the course of the algorithm, nodes are served in order of non-increasing capacity. Since the capacities of the uploaders are inflated by a factor of at most √ 2, the released capacity c satisfies c ≥ c k √ 2 , where k is the smallest index of a node not served yet. Hence, we can apply Lemma 7 for the nodes c k ≥ c k+1 ≥ · · · ≥ c n and derive the existence of k ≥ k such that The For the instance with such augmented capacities, the schedule is now constructed as follows. At time t, nodes j ∈ {k, . . . , k } start downloading from node i with their full (possibly augmented) capacity of αc j (line 20). Node j ∈ {k, . . . , k } thus finishes the download at timeC j = t + 1 αc j , see line 18. At that time, both the new upload capacity of node j as well as the fraction of the upload capacity of node i that was devoted to uploading the file to node j become available for further uploads. To avoid double augmentation of capacities during the course of the algorithm, we have to rescale both to their original level. This is done in line 21.
Here both the event that the (non-augmented) capacity c j of node j is available and that a fraction α c j β of the capacity of node i is available for further uploads is added to the event queue. Note that if c k > c k+1 at the timeC k only some fraction of the upload capacity of node i becomes available since nodes k + 1, . . . , k are still downloading from node i. The algorithm reassigns this fraction of the upload capacity at timeC k without waiting for nodes k + 1, . . . , k to avoid idle times.
The algorithm proceeds by taking the next capacity release event out of the event queue. The process stops as soon as the total capacity of the remaining nodes is less than the currently available upload capacity.
From this point on, all remaining nodes are served simultaneously at full download rate. For the formal details of the Scale-Fit procedure, see Algorithm 3.
The choice of the augmentation factors and the rescaling procedure ensure the invariant that the augmented capacities do not exceed the original capacities by more than a factor of √ 2.
Proof When new downloads from a node i are assigned, the download capacities are increased by the factor α = max 1, c k j=k c j , see line 13. By the choice of k in line 12, α ≤ √ 2 so that no download capacity is increased by a factor larger than √ 2. We prove that also the upload capacities are never exceeded by a factor larger than √ 2 by two inductive claims. First, we claim that after a node i started the download of the file at timeÃ i , we have that the capacities of all further capacity Algorithm 3: Scale-Fit Input: instance I = (N , c) with c 0 = max i∈N c i Output: 2 √ 2-approximate solution S of I 1 sort nodes non-increasingly with respect to their capacities, i.e., c 1 ≥ c 2 ≥ · · · ≥ c n ; // server has unused upload capacity c 0 at time 0 // add this capacity release to event queue 2 Q := (0, 0, c 0 ) ; // node with largest capacity not served yet 3 k := 1 ; // largest augmentation factor so far 4 b := 1 ; 5 while k ≤ n do // take next event from queue // add rescaled capacity release to queue for all t ∈ [A i , C i ) ; 28 end release events for i sum up to c i (as long as there are still unserved nodes), i.e., (t ,i ,c ) This is obviously true for all times t ∈ [Ã i ,C i ) when the only event in Q is (C i , i, c i ). Next suppose that the claim is correct for all times until a capacity release event (t, i, c) for i is taken from the queue Q. Then, the capacity of c is used to serve nodes k, . . . , k where the download capacity of the downloaders is increased by the factor α = max 1, c k j=k c j and the upload capacity of i is increased by the factor β = k j=k α c j c . Finally, the capacity release events k by the choice of β. This proves the claim. Next, we observe that after node i finished the download of the file at timeC i and as long as there are still unserved nodes, every capacity release event (t, i, α c j β ) for i corresponds to a an upload of node i to some other node j at rate αc j and vice versa.
To sum up, for each node i, at every time t ≥C j all active uploads at rates α j c j for some α ∈ [1, √ 2] correspond to a capacity release event (t, i, α j c j β j ) for some β j ∈ [1, √ 2] and the sum of the capacities of the release events is c i . We thus obtain so that the upload capacity of each node i is also never exceeded by a factor larger than √ 2.
Before we proceed to formally analyze the performance of Scale-Fit, let us illustrate the algorithm by an example: Example 9 Consider an instance with 6 nodes and capacities c 0 = 5, c 1 = 3, c 2 = 3, c 3 = 5/2, c 4 = 2, and c 5 = 2. We first describe how to construct the augmented solutioñ S. At time 0, the upload capacity of node 0 is augmented by a factor of 6/5 in order to serve nodes 1 and 2 at their full download capacities. These downloads are completed at time 1/3. At that time, the rescaled upload capacities of the parent of nodes 1 and 2 (i.e., node 0) can be used separately to serve further nodes. The 5/2 units of capacity (previously assigned to node 1) are now assigned to node 3, which downloads with full capacity without any augmentation. The remaining 5/2 units of capacity are assigned to node 4, whose download capacity is augmented by a factor of 5/4. At the same time, node 1 starts serving node 5 without any augmentation because node 5 is the only remaining node. The highest augmentation factor is 5/4. Thus, we rescale all rates by 4/5 and obtain the feasible solution S. See Fig. 2 for an illustration. We now turn to the approximation guarantee of our algorithm. We first need the following lemma that provides a lower bound on the optimal makespan. Lemma 10 Let I = (N , c) be an instance of the minimum time broadcasting problem with c 0 ≥ c 1 ≥ c 2 ≥ · · · ≥ c n for all i = 1, . . . , n, and letS be a possibly augmented solution with the following properties: Then, where M * is the optimal makespan for I .

Proof
Let us first consider the case t 0 <M, whereM is the makespan of the augmented solution. For a contradiction, suppose M * < t 0 and fix an optimal solution S * . We have X (t 0 ) < X * (t 0 ) = n. Let k 0 be the node with smallest index that has not finished the download in the augmented solutioñ S at time t 0 , that is, Such a node exists, since we assume t 0 <M.
If k 0 = 1, then we obtain the inequality t 0 < 1/c 1 , which is a lower bound on M * , and there is nothing left to show. So we assume k 0 > 1 and consider the point in time t 1 = t 0 − 1/c k 0 . For a contradiction, let us assume thatX (t 1 ) ≥ X * (t 1 ). Sincex k 0 (t 0 ) < 1 and inS, node k 0 receives the file in some time interval [Ã i ,C i ] at ratec i ≥ c i , we havex k 0 (t 1 ) = 0, and since the nodes start downloading in the order of their indices, we also havex i (t 1 ) = 0 for all i ≥ k 0 . Every node i ∈ N withx i (t 1 ) > 0 receives data with download ratẽ ≥ 0 for all other nodes. Referring to Lemma 5 (1.), we calculate where we use c i /c k 0 ≤ 1 for all i ≥ k 0 . We get a contradiction. We conclude X * (t 1 ) >X (t 1 ). Applying the same line of argumentation for t 1 instead of t 0 , we derive the existence of t 2 = t 1 − 1/c k 1 for some k 1 ∈ N with X * (t 2 ) >X (t 1 ). We can iterate this argument until we reach t , with the property that X * (t ) >X (t ) and k = min{i ∈ N :C i > t } = 1. This is a contradiction since in the time interval [0, t ] only the server can upload and its upload rate inS is not smaller than that in S * . We conclude that our initial assumption that t 0 > M * was wrong, finishing the proof for the case t 0 <M. If t 0 =M, we can use the same line of argumentation for t 0 − instead of t 0 , where > 0 is arbitrary. Thus we obtain t 0 ≤ M * also for that case.
We are now ready to prove the approximation guarantee of Scale-Fit.
Theorem 11 For the minimum time broadcasting problem with heterogeneous symmetric capacities and an indivisible file, the following holds: 2. If c 0 < max i∈N c i , then uploading the file to another node and applying Scale-Fit is a (1 + 2 √ 2)-approximation.
The running time of Scale-Fit is O(n log n).
Proof We first show 1. By construction, node n determines the makespan and starts its download not after t 0 . Hence, the makespan of the √ 2-augmented solutionS is not larger than t 0 + 1/c n ≤ 2M * , where we use Lemma 10 and the fact that 1/c n is a lower bound on the optimal makespan. For rational input, the largest factor, with which a capacity constraint is violated, is strictly smaller than √ 2. Dividing all sending rates by that factor, we obtain a feasible solution with makespan smaller than 2 √ 2M * . To see 2., note that the server needs 1/c 0 ≤ M * time units to transfer the file to node 1. We then treat the instance as an instance where node 1 is the server, i.e., we do not let node 0 upload the file to any other node except node 1. Using the same arguments as in the proof of Lemma 10, we derive that this takes at most 2 √ 2M * additional time units, implying the claimed approximation factor.
The complexity of the algorithm is as follows: In a first step, the nodes are sorted with respect to their capacities (line 1 of Algorithm 3), which takes time O(n log n). The most expensive operations within the loop (lines 5-23) are adding elements to Q (line 21) and retrieving the minimal element from Q (line 6). In total, there are O(n) of these operations, and if Q is a priority queue, all operations can be executed in time O(log n). Therefore the overall running time of the algorithm is O(n log n).

Broadcasting multiple packets
We now turn to the more general case that the file is divided into m ∈ N ≥1 packets. The file is still of unit size; therefore, the download of one packet at a rate of c takes 1 cm time units. We present two efficient algorithms. The first one, termed Spread-Exchange, uses a variant of the Scale-Fit algorithm, developed in the last section, as a subroutine and yields a 5-approximation. The second algorithm, termed Spread-Mirror-Cycle, has an approximation guarantee of 2 + 2 log 2 n/m m , which is super-constant in general, but better than 5 if the number of packets is large compared to the number of nodes.

The SPREAD-EXCHANGE algorithm
The Spread-Exchange algorithm works in two phases. In the first phase, called Spread, a modification of the Scale-Fit algorithm is used to provide each node with a single packet. For better reference, we denote the modified version of the algorithm by Scale-Fit * . In the second phase, called Exchange, the packets are exchanged between the nodes in a pairwise manner until all nodes own all packets. The second phase can only work efficiently, if the packets are distributed in a suitable pattern among the agents.
For ease of exposition, we will first make some simplifying assumptions on the instance and explain the Spread-Exchange algorithm for such simple instances. In the end of this section, we will relax these assumptions. First, we require that the server has the highest capacity and that nodes are ordered by their capacities. Second, we require that the capacities are powers of two. Third, we assume that i∈N c i c 0 = 2 for some integer . Intuitively, this condition ensures that the distribution tree is complete and has height . Finally, we assume that m ≤ , that is, there are not more packets than levels in the distribution tree. An instance that satisfies these properties will be called simple as summarized in the following definition.
Definition 12 An instance I = (N , c, m) is called simple, if it satisfies the following properties 1. c 0 ≥ c 1 ≥ c 2 ≥ · · · ≥ c n , 2. c i = 2 r i with r i ∈ N for all i ∈ N , 3. n i=0 c i c 0 = 2 for some ∈ N with ≥ m.

The SCALE-FIT * -algorithm
Our algorithm uses a variant of the Scale-Fit-Algorithm to send exactly one packet to each node. Compared to the original Scale-Fit-Algorithm, we introduce two modifications. The modified algorithm still maintains a queue Q of capacity release events but the events now are quadruples indicating that at time t node i has an upload capacity of c and will use this capacity to upload packet q. Second, we observe that for a simple instance, where all capacities are powers of two, the Scale-Fit * algorithm in line 10 can choose k such that k j=k c j = c, that is, no further scaling of the upload or download capacities is needed. This implies in particular that after removing the entry (t, i, c, q) from the capacity release event queue, the set of entries is added to the queue. The first event (t + 1 mc j , i, c j , q ) means that for the uploading node i the capacity of c j will be available for further uploads at time t + 1 mc j . The packet q to be send in these uploads will be specified in Sect. 4.1.2. The second event (t + 1 mc j , j, c j , q) means that node j will have finished the download of the file at time t + 1 mc j and thus its full capacity of c j will be available for further uploads. Since each node receives a single packet only, node j with j ∈ {k, . . . , k } can send only this packet in further uploads. Further note that the download times are shorter by a factor of 1/m since only a part of size 1/m is distributed by the algorithm.

The distribution tree
When introducing new capacity release events in the event queue Q, we have to decide which packet is scheduled for upload. This is trivial for non-server nodes who only receive a single packet during the course of the Scale-Fit * -Algorithm. To explain how the server decides which packet is uploaded, we introduce the notion of a distribution tree T which is build incrementally from the events introduced into Q. To this end, let Q denote the set of all capacity release events (t, i, c, q) added to Q during the course of the algorithm. We build a tree structure T with vertex set V (T ) = Q as follows. The root of T is the tree node (0, 0, c 0 , 1) corresponding to the event initially placed in Q. Whenever a capacity release event (t, i, c, q) is removed from Q, the algorithm afterward adds the set of events to Q. In T , we add an edge from the tree node (t, i, c, q) to each of the tree nodes (t + 1 mc j , i, c j , q ) with j = k, . . . , k and an edge from (t, i, c, q) to each of the tree nodes (t + 1 mc j , j, c j , q) with j = k, . . . , k . We call tree nodes of the form (t + 1 mc j , j, c j , q) proper tree nodes and denote the set of proper tree nodes by V * (T ). Note that there is a natural bijection between the set of non-server nodes i ∈ N \ {0} and the set of proper tree nodes v ∈ V * (T ). Specifically, for each non-server node i ∈ N \ {0}, there is a proper tree node (C i , i, c i , q i ), where q i is the packet send to node i. Further, there is also a corresponding non-proper tree node is the unique node that sends packet q i to node i during the course of the algorithm.
We proceed to provide useful properties of the distribution tree T . For a tree node v, let level(v) denote the number of edges from v to the root. Further, for a tree node v = (t, i, c, q), we introduce the notations t(v) = t, i(v) = i, c(v) = c and q(v) = q as a shorthand for the time, node, capacity and packet associated with the corresponding capacity release event. The following lemma establishes that nodes at higher levels have no larger capacities and higher completion times.

Lemma 13 Let v, w ∈ V (T ) with level(v) < level(w). Then, c(v) ≥ c(w) and t(v) < t(w).
Proof We show by induction over that for all tree nodes v with level(v) = and all tree nodes w with level(w) > level(v), the claimed properties hold. The only tree node with level(v) = 0 is node (0, 0, c 0 , 1). Since t(0, 0, c 0 , 1) = 0 and, by our preprocessing, c 0 ≥ c i for all i ∈ N , the result follows for all tree nodes with level 0.
Assume the statement is true for all tree nodes v ∈ V (T ) with some fixed level level(v) = and all nodes w ∈ V (T ) with level(w) > level(v). Consider a node v ∈ V (T ) with level(v) = + 1 and a node w ∈ V (T ) with level(w) > level(v). Let v and w be the parent nodes of v and w in T . By the induction hypothesis, we have t(v ) < t(w ), i.e., the capacity release event v happens before the event w . Since the algorithm considers the nodes in order of non-increasing capacity, this implies c(v) ≥ c(w). Since all nodes all served with full capacity, we also have t Lemma 13 implies that all capacity release events of a level happen after all capacity release events of a former level. This implies that the tree T is complete in the sense that the capacity of a tree node is equal to the sum of all capacities of its children. Since n i=0 c i c 0 = 2 with ∈ N also the last level is complete.
Next, we note that that each capacity release event (t, i, c i , q) indicates that node i finishes the download of packet q at time [m]. Each such capacity event is mirrored by another event of the form (t, p (q) i , c i , q ) indicating that the upload capacity of the node p (q) i from which node i received packet q is free again and ready for further uploads. Specifically, q = min{q + 1, m} if p (q) i is the server, and q = q otherwise. As a consequence, half of the capacity of the tree nodes in each level corresponds to available upload capacity of nodes.
We proceed to show that the joint capacity of all nodes that own a particular packet after running the Scale-Fit * -Algorithm is distributed very regularly.
be the set of proper tree nodes in level 1 and let be the set of non-proper tree nodes in level 1. Since the total capacity of all nodes equals the capacity of the server plus the total capacity of all proper tree nodes, we havē The nodes v ∈ V * (T (r )) with r ∈ V * 1 are exactly those that receive packet 1, thus, Since the trees are complete, we have We then obtainc = 2c 1 showing the claim for k = 1.
To show the result for 1 < k < m, we apply this argument recursively in the subtrees of level k. Let V * k denote the set of proper nodes of level k that are served by the server and let V k denote the set of non-proper tree nodes in level k. Then c k = r ∈V * k vV * (T (r )) c(v). By induction, With the same reasoning as before, we obtain the equality

The EXCHANGE phase
For the Exchange part of the algorithm, we treat the server as a node that owns only packet m. We carry out m −1 rounds of exchange. In round k, the total capacity of nodes that own packets j ∈ {k, . . . , m} is doubled. Lemma 14 then implies that after round k, all nodes own packet k, and this packet can be ignored in all further rounds. Moreover, after round m − 1, all nodes own all packets, and the file is completely distributed.
In round k, we assign the nodes that own packet k to nodes that own other packets k > k with a straightforward greedy algorithm, see Algorithm 6 for details. As long as the largest capacity c i of a node i that owns packet k is larger than the capacity of at least one of the other nodes, we match this node i to a subsetÑ of the other nodes, whereÑ is chosen in such a way that the capacities in this set sum up to c i . This is always possible since all capacities are powers of two. As soon as the maximum capacity of an unmatched node that owns packet k is smaller than the minimum capacity of the unmatched nodes without packet k, we proceed the other way round-a single node i that does not own packet k is matched to a set of nodes that do own packet k, where the capacities in this set sum up to c i . Using Lemma 14, it is straightforward to show that all nodes will get matched this way.
In round k, after all nodes are matched that way, every node has a unique packet j ∈ {k, . . . , m} and sends this packet j at a rate of c min to its matched node(s).

The SPREAD-EXCHANGE ALGORITHM
A detailed description of the whole procedure Spread-Exchange can be found in Algorithm 5. We first show that it yields a 2-approximation algorithm for simple instances.
Theorem 15 For the minimum time broadcasting problem with heterogeneous symmetric capacities and a file distributed in m packets, Spread-Exchange computes a 2-approximation for simple instances.
Proof Let I = (N , c, m) be a simple instance and M * (I ) be its optimal makespan. Let I 1/m = (N , c, 1) be the instance with the same set of nodes and capacities where a single file of size 1/m has to be send to all nodes. Since in I all m packets of size 1/m have to be send to all nodes, we have M * (I 1/m ) ≤ M * (I ). Consider the Spread phase when the Proof Let M * (I ) denote the optimal makespan of the original instance and let c max = max i∈N c i . If c 0 < c max , we spend 1/c 0 time units to send the whole file from the server node 0 to a node i * with maximal capacity, remove node 0 from the instance and treat i * as the new server. Using that 1/c 0 ≤ M * (I ), it suffices to show 1.
To this end, let the nodes be numbered such that c 0 ≥ c 1 ≥ c 2 ≥ · · · ≥ c n . Consider the instance I where all nodes' capacities are rounded down to the next power of two, i.e., I = (N , (c i ) i∈N , m) where c i = 2 log 2 c i . By appropriate scaling of the instance, it is without loss of generality to assume that c n = c n . Let ∈ N and n ∈ {0, . . . , n} be such that For the subset of nodes N = {0, . . . , n }, consider the instance with rounded capacities I = (N , (c i ) i∈N , m). Let p, r ∈ N be such that m = p + r with r < . The general structure of the algorithm is follows. We conduct p rounds of Spread-Exchange for I in each of which we distribute packets to the nodes in N . Then, we conduct a final round of Spread-Exchange in which we distribute r < packets, so that after the p + 1 rounds all m packets are distributed to the nodes in N . Finally, we send the whole file from nodes in N to nodes in N \ N . For the analysis of this algorithm, we distinguish the cases p = 0 and p > 0.
First case p = 0. Consider the run of Spread-Exchange on the instance I = (N , (c i ) i∈N , m) with a subset of nodes and rounded capacities. As in the proof of Theorem 15, consider the time t 0 during the single Spread phase defined in (7) when one of the nodes starts to become idle. We claim that t 0 ≤ 2M * (I ).
To see this, consider again the relaxation I 1/m of I where only a single file of size 1/m has to be distributed. We have M * (I 1/m ) ≤ M * (I ). We consider the solution for the Spread phase for I , double all upload and download rates and only send packet 1. By construction, this yields a 2augmented solution for I 1/m . By adding arbitrary (feasible) downloads for the nodes in N \ N , we may extend this solution into a solution for I 1/m . Note that by doubling all upload and download rates, all completion times are halved, but otherwise, no nodes become idle earlier than in the original solution.
By Lemma 10, t 0 ≤ 2M * (I 1/m ) and, thus, t 0 ≤ 2M * (I ). Since in the Spread phase no node starts sending a packet strictly after t 0 , the Spread phase ends not later than M * (I )+ 1 c n . In the Exchange phase, the algorithm performs (m − 1) rounds of exchange of length 1 mc n . Overall, we see that the time needed to run the Spread-Exchange algorithm is at most After the Spread-Exchange algorithm, we perform a greedy matching between the nodes N that received the file and the nodes N \ N that did not receive any portion of the file yet. Since i∈N c i ≥ i∈N \N c i and all capacities are powers of two, there is a greedy assignment in which all nodes i ∈ N \ N receive the file at their full (rounded down) capacity c i . The assignment can be computed with Algorithm 6. This additional step takes additional time units. We need at most 3M * (I ) time units for the Spread-Exchange algorithm and M * (I ) time units for sending the file to the nodes in N \ N , so that the we obtain a 4-approximation for the case p = 0. Second case p > 0. For the instance I with a subset of nodes and rounded capacities, the algorithm performs p > 0 rounds of Spread-Exchange distributing packets each followed by one round distributing r packets. Consider one of the such round during which we distribute s ∈ { , r } packets.
In the Spread part, the maximum number of subsequent uploads of the server is and each upload takes at most 1 mc n ≤ 1 mc n = 1 mc n time units. Further, no download starts strictly after the server has finished its last upload. Thus, the Spread phase of this round takes at most +1 mc n time units. In the Exchange phase, we perform s − 1 rounds of exchange requiring further s−1 mc n time units. In total, all p + 1 rounds of Spread-Exchange need As in the first case, we spend additional 1 c n ≤ M * (I ) time units to send the file from the nodes in N to the nodes in N \ N yielding a 4-approximation.
We now turn to the running time of the algorithm. For the Spread phase, we need to run Scale-Fit * which has a complexity of O(n log n). Note that even when Scale-Fit * is run multiple times for different sets of packets, it actually suffices to run the algorithm only one time and adapt the solutions by changing the packets that are disseminated. For the Exchange phase, we conduct m −1 rounds of exchanges for each of which we need to compute an assignment. The greedy algorithm has a complexity of O(n log n). Sending the file to the nodes in N \ N requires the solution of a single greedy assignment problem, so that we obtain the overall complexity of O(mn log n).
We note that in a situation where in the beginning the packets are spread all over the nodes in the network, we still obtain a 5-approximation. In the beginning, all packets are sent to a node with largest capacity, which then acts as a server. This sending does not take longer than M * (I ).
We conclude this section with an observation, relating our result to that of Mundinger et al. (2008).

Remark 17
If the number of nodes is a power of two and capacities are homogeneous, i.e., |N | = 2 for some ∈ N and c i = 1 for all i ∈ N , the solution produced by Spread-Exchange is exactly the same as the one produced by the algorithm presented in Section 3 of Mundinger et al. (2008). (Note that we do not have to scale capacities in this case and thus also do not scale the sending rates in the end.) This also implies that in this special case,Spread-Exchange yields an optimal solution.

An algorithm for many packets
In this section, we devise a simple alternative algorithm, which we call Spread-Mirror-Cycle, that has a better performance guarantee than Spread-Exchange when the number of packets is large compared to the number of nodes. The new algorithm proceeds in three phases. In the first phase (Spread), we choose a certain subset of nodes and send each packet to exactly one node from this subset. In the second phase (Mirror), we let these nodes mirror their packets to the remaining nodes, in such a way that the distribution of packets among the initial set of nodes is copied (possibly several times), and at the end of phase two every node owns at least one packet and each packet is owned by at least one node. In the final phase of the algorithm (Cycle), we perform a rather simple circular exchange of packets between nodes until all nodes possess the whole file. The main difference to the Spread-Exchange-algorithm, described in the previous section, is that Spread-Exchange uses Scale-Fit * as a subroutine to provide each node with one packet. We use a different method for this task, that aims for a large variety of the distributed packets. This comes at the cost of a worse performance guarantee for the first two phases, but allows for more flexibility and hence a better performance of the exchange part our algorithm (Cycle). When the number of packets is large compared to the number of nodes, the exchange phase dominates the running time of the algorithm, and Spread-Mirror-Cycle has a better worst-case performance than Spread-Exchange.
We proceed to describe Spread-Mirror-Cycle in detail. In contrast to Spread-Exchange, we do not round the capacities to powers of 2, but work on the original capacities. Let k = n/m . We partition the set of nodes into k mutually disjoint sets N 1 , . . . , N k . The partition is chosen in such a way that the cardinalities differ by at most one, and the sets are indexed such that the cardinalities are non-decreasing. Formally, for j ∈ {1, . . . , k}, let n j = |N j | denote the cardinality of the j-th set and let N j = {i j 1 , . . . , i j n j }. Then we have |n j − n j | ≤ 1 for all j, j ∈ {1, . . . , k}, and n j ≤ n j for all j, j ∈ {1 . . . , k} with j ≤ j . Note that by the choice of k, each partition contains more than m/2 nodes, but at most m, i.e., m/2 < n j ≤ m for all j.
In the Spread phase of our algorithm, node 0 sends one packet to each of the nodes in N 1 as follows: at time 0, node 0 starts sending packet 1 to node i 1 1 at maximum rate min{c 0 , c i 1 1 }. After this transmission is completed, node 0 sends packet 2 to node i 1 2 at maximum rate min{c 0 , c i 1 2 }, and so on. This process continues until node 0 has sent packet n 1 to node i 1 n 1 . Then, if m > n 1 , nodes i 1 1 , . . . , i 1 m−n 1 one after another receive a second packet from node 0 at full rate, until each node i ∈ N 1 owns at least one packet and each packet is owned by at least one node in N 1 . For each node j ∈ {1, . . . , n 1 }, the transmission of a packet needs at most 1 mc min time units.
In the Mirror phase, all nodes in N 1 mirror themselves to a node in N 2 . More formally, we form a matching between the nodes in N 1 and N 2 . Assume for the moment that the sets are of equal size. Each node i sends its packets to its matched node i at the full rate min{c i , c i }. As each node sends at most two packets, this process needs at most 2 mc min time units. We then continue iteratively mirroring the internal node structure of N 1 to all other subsets of nodes. That is, the nodes in N 1 send their packets to the nodes in N 3 . At the same time, the nodes in N 2 send their packets to the nodes in N 4 , and so on. After at most 2 log 2 k mc min time units, the internal structure of N 1 is mirrored to all other sets N 2 , . . . N k .
When the cardinalities of the two sets are different, i.e., nodes in set N j mirror themselves to the nodes in set N j with n j = n j + 1, we slightly correct the mirroring process to take care of that fact. As n j = n j − 1 ≤ m − 1, there is a node i * ∈ N j that owns two packets. We match this node to two different nodes in N j , and let it send one packet to each of them. In that fashion, we ensure that after the mirroring, all nodes in N j possess at least one packet.
In the Cycle phase, we perform a simple circular exchange in all sets N j , j ∈ {1, . . . , k}. Recall that within each set N j , each node owns at least one packet and each packet is present at exactly one node. The Cycle phase consists of m − 1 rounds. In each round, node i j k sends one of its packets to node i j k+1 , except for i j n j , which sends to i j 1 . Each node sends each packet only once, in order of their reception. After m −1 rounds of such exchange, all nodes in N j possess all packets. To see this, note that during the m − 1 exchange rounds the order of the packets sent along the cycle is preserved. Hence, each node receives all other packets before it gets the packet it sent first. Thus, each node has all packets after m − 1 rounds. Performing the exchange in all sets N 1 , . . . , N k in parallel, the final phase of our algorithm needs

Conclusion
We studied the problem of distributing a file, divided into m packets, to all nodes of a communication network. In contrast to the prevailing assumption in the broadcasting literature known as the telephone model (and variants thereof), our model allows for flexible data transfers, that is, at any point in time each node that possesses a certain packet may send it with an arbitrary rate to other nodes that have not yet received this packet. For this quite general model, we provided a detailed study of various settings. For the simplest setting with homogeneous capacities and a single packet, we presented an efficient exact algorithm. Already for a single packet and heterogeneous capacities, the problem becomes strongly NP-hard. We thus turned to approximation algorithms and devised constant factor approximation algorithms for heterogeneous capacities, both for single and multiple packets. Some questions remain open, however, such as the case of different upload and download capacities per node. It would also be interesting whether the presented approximation factors can be improved, or whether inapproximability bounds can be shown. Moreover, other objectives such as the weighted sum of completion times seem interesting and deserve further study.
Funding Open Access funding enabled and organized by Projekt DEAL.
Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the article's Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article's Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creativecomm ons.org/licenses/by/4.0/.