Average-Case Analysis of Greedy Matching for D2D Resource Sharing
Abstract
Given the proximity of many wireless users and their diversity in consuming local resources (e.g., data-plans, computation and even energy resources), device-to-device (D2D) resource sharing is a promising approach towards realizing a sharing economy. In the resulting networked economy, users segment themselves into sellers and buyers that need to be efficiently matched locally. This paper adopts an easy-to-implement greedy matching algorithm with distributed fashion and only sub-linear parallel complexity, which offers a great advantage compared to the optimal but computational-expensive centralized matching. But is it efficient compared to the optimal matching? Extensive simulations indicate that in a large number of practical cases the average loss is no more than , a far better result than the loss bound in the worst case. However, there is no rigorous average-case analysis in the literature to back up such encouraging findings, which is a fundamental step towards supporting the practical use of greedy matching in D2D sharing. This paper is the first to present the rigorous average analysis of certain representative classes of graphs with random parameters, by proposing a new asymptotic methodology. For typical 2D grids with random matching weights we rigorously prove that our greedy algorithm performs better than of the optimal, while for typical Erdős-Rényi random graphs we prove a lower bound of when the graph is neither dense nor sparse. Finally, we use realistic data to show that our random graph models approximate well D2D sharing networks encountered in practice.
I Introduction
Thanks to advances in wireless and smartphone technologies, mobile users in proximity can use local wireless links (e.g., short-range communications) to share local resources (e.g., data-plans, computation and energy resources). For instance, subscribed users who have leftover data plans can set up personal/portable hotspots and share data connections to travelers with high roaming fees or those who face data deficit [1, 2]. Besides sharing data-plans, mobile terminals with extra local memories can exchange the requested files with each other in the vicinity [3]. Furthermore, a user in need of bandwidth for video streaming can seek some neighboring users’ assistance to download and forward video segments via local links [4]. Given the large diversity for each user in the levels of her individual resource utilization, device-to-device (D2D) resource sharing is envisioned as a promising approach to pool resources and increase social welfare.
Some recent studies have been conducted for modelling and guiding D2D resource sharing in wireless networks (e.g., [1, 2, 4, 6, 3, 5]). As a node in the established D2D network graph, each mobile user can be a resource buyer or seller, depending on whether her local resource is sufficient or not. As in [6] and [3], according to their locations, each user can only connect to a subset of users in the neighborhood through wireless connections, and the available wireless links are modelled as edges in the network graph. Sharing between any two connected users brings in certain benefit to the pair, which is modeled as a non-negative weight to the corresponding edge.
All these works (e.g., [1, 2, 4, 6, 3, 5]) optimize resource allocation by matching buyers and sellers in a centralized manner that requires global information and strict coordination. Hence the developed approaches cannot scale well in a scenario involving a large number of users, due to a large communication and computation overhead caused by the centralized nature of the proposed solutions. Carrying this argument further, the existing optimal weighted matching algorithms from the literature cannot be effectively used in the case of large user-defined networks due to their centralized nature and super-linear time complexity [7]. This motivates the need for developing distributed algorithms that exploit parallelism, have low computation complexity and good average performance for practical parameter distributions.
In the broader literature of distributed algorithm design for matching many buyers and sellers in a large graph, a greedy matching algorithm of linear complexity is proposed in [8, 9] without requiring a central controller to gather all information. It simply selects each time the edges with local maximum weights and yields an approximation ratio of as compared to the optimum. A parallel algorithm is further proposed in [10] to reduce complexity at the cost of obtaining a smaller approximation ratio than . It should be noted that in the analysis of these algorithms, complexity and approximation ratio are always worst-case measures, but the worst-case approximation ratio rarely happens in most network cases in practice. Overall, there is a lack of average-case analysis of the greedy matching in the literature to compare its average performance with the optimal matching.
Since worst-case bounds no longer work for average-case analysis, we develop totally new techniques to analyze average performance. These techniques become more accurate when taking into account the structure of the network graph, and provide a very positive assessment of the greedy matching’s average performance that is far from the worst case. Since the greedy matching can be naturally implemented in parallel by each node in the network, we also prove that with high probability (w.h.p.), the algorithm has sub-linear parallel complexity in the number of users . Our main contributions and key novelty are summarized as follows.
-
•
New average-case analysis of greedy matching in 2D grid networks with random weights: To provide rigorous results we first study the average performance of the greedy matching in the representative case of 2D grid network with random weights. In this case, dynamic programming cannot be directly applied since matching users does not divide the grid into sub-grids. We introduce a new asymptotic analysis method to prove that our greedy matching’s average performance ratio as compared to the average of the optimal matching is at least . If the greedy algorithm is allowed to run in parallel (as expected in practice), we prove that it has only sub-linear complexity w.h.p. in 2D grids. Thus, our algorithm provides a great implementation advantage compared to the optimal but computational-expensive centralized matching.
-
•
New average-case analysis of greedy matching in random networks: We develop a new theoretic technique to analyze large Erdős-Rényi random graphs , where each of users connects to any other user with probability . For a dense random graph with constant , we prove that the greedy matching achieves an average performance ratio that tends to as increases. The analysis of sparse graphs is more challenging, yet we equivalently reduce to the asymptotic analysis of random trees. By exploiting the recursive nature of trees, we obtain rigorous average performance ratio bounds and parallel complexity (w.h.p.) when . We also prove that the average performance ratio reaches its minimum (still above ) when the graph is neither dense nor sparse.
-
•
Application to practical scenarios: We conduct experiments using real data for mobile user locations to simulate realistic D2D networks with given constraints on the maximum allowed communication distance between devices. We show that our analytical performance measure approximates well many practical cases of such D2D sharing networks. To decide the maximum D2D sharing range among users, we take into account the D2D communication failure due to path-loss and mutual interference among matched pairs. The optimal sharing range is achieved by tradeoff between transacting with more devices but with the higher risk that the chosen best neighbor might not be effectively usable due to a communication failure.
The paper is organized as follows. In Section II, we present our network model and the greedy matching algorithm for solving the D2D resource sharing problem in any network graph. In Section III, we analyze the average performance ratios of the algorithm in the 2D grids. Sections IV and V extend the average-case analysis to random graphs and practical scenarios. Section VI concludes the paper.
II System Model and Preliminaries
II-A System Model for D2D Resource Sharing
We first describe our D2D resource sharing model that involves a large number of potential users to share resources with each other via local wireless links (e.g., short-range communications). In this model sharing takes place in repeated time intervals (or ‘rounds’). In each interval, we first run an algorithm to determine the pairs of users that are willing to exchange resources during the given round, and then realize the actual sharing of the corresponding resources as determined by the algorithm. The set of participating users and the available D2D links may be different for different rounds.
In each round, we form the ‘network graph’ , where is the set of nodes corresponding to users that are participating in the given round, and is the set of D2D links between participating users that are feasible to establish with some minimum level of performance (e.g., signal strength, actual physical distance, etc., depending on the application). For each user , the subset denotes the set of her neighbors in , i.e., there is a feasible D2D link between and any . Note that different definitions of ‘feasibility’ for D2D links will imply a different set of edges between the users in . Also the set is changing over time since new users may join the sharing economy and existing users may drop out after satisfying their needs or moving out of range.
With each edge there is an associated weight that models the (net) sharing benefit between this pair of users, if these users eventually transact with each other (i.e., are ‘matched’ in our terminology), converted in some monetary basis (say ). Let be the weight vector over all edges of . Note that our model is very flexible and can fit to various applications of D2D resource sharing by allowing for different ways to define the values for . For example, in a secondary data-plan trading market [1, 2], user with data-plan surplus shares her personal hotspot connection with neighboring user with high roaming fee, and weight models the difference between user ’s saved roaming fee and the sharing cost (e.g., energy consumption in battery) of user . In another example of cooperative video streaming [4], user seeks user ’s assistance to download video segments for local sharing, and becomes the difference between the QoE improvement of user and the download cost of user .
In any given round, our sharing model corresponds to an instance of a random weighted graph . A simple interpretation of the model is that a typical user, when participating, corresponds to a random node in . In particular, we don’t care for the actual identity of the participating users (after all, we care for the total value generated in the economy, summed over all participants). To simplify the model, we assume certain i.i.d. properties for the resulting stochastic process, i.e., in each round the set and the corresponding , are i.i.d., with certain distributions. In particular, we assume that the weights take values from a finite discrete set according to the general probability distribution with .111We can similarly extend our average-case analysis to continuous weight distributions, though it is unlikely to have any practical interest. Without loss of generality, we assume . A small-scale illustrative instance of the D2D resource sharing model is shown spatially on the ground in Fig. 1, which can be abstracted to a weight graph .

In typical practices of D2D sharing (e.g., energy transfer), a user is only matched to a single neighbor (if any) to finally transact with. Keeping this simple but practical case of single matching per user222Allowing more concurrent matchings might not greatly improve performance, since in practice most of the total benefit is usually obtained from one among the possible matchings (e.g., assume a Pareto distribution on the values of the possible matchings). Furthermore, obtaining the resources as a result of a single matching decreases the marginal benefit of the resources from more matchings., given a weighted graph , we would like to match the most valuable (with the highest value of ) pairs of users to maximize the total sharing benefit (i.e., the ‘social welfare’). Assuming full and globally available information on and , we formulate the social welfare maximization problem as a maximum weighted matching problem:
(1a) | |||||
s.t. | (1b) | ||||
(1c) |
where is the binary optimization variable denoting whether edge is included in the final matching () or not (). Constraint (1b) tells that any user can only be matched to at most one user in her set of neighbors .
II-B Preliminaries of Greedy Algorithm
According to [7], to optimally solve the maximum weighted matching problem , one needs to centrally gather the weight and graph connectivity information beforehand. Further, searching for all possible matchings results in super-linear computation complexity, which is formidably high for a network with a large number of users. Alternatively, the greedy matching addresses these two issues by keeping information local and allowing the algorithm to be performed in a distributed fashion. Algorithm 1 outlines the key steps of the greedy matching algorithm (please see intuition in the text that follows).
Algorithm 1: Greedy matching algorithm for solving problem for the graph ().
Initialization: ; ;
.
In each iteration, repeat the following two phases:
Proposal phase:
For each unmatched user :
-
•
User selects a user among her unmatched neighbors in with the maximum weight .
-
•
User sends to a matching proposal.
Matching phase:
For a user pair that both and receive proposals
from each other:
-
•
Match and by updating and .
-
•
Make and unavailable for matching with others, by updating for any , and similarly for .
Algorithm 1 is randomized333It randomizes in the selection of preferred neighbors in case there are multiple equally best choices in the proposal phase. A way to simplify this and make the algorithm deterministic is to assume that nodes are assigned unique IDs and that a node assigns priority in the case of ties to her neighbor with the highest ID value. This avoids loops and guarantees termination in steps. In the rest of the paper we can assume this deterministic version for Algorithm 1. and can be implemented distributedly: at each time, each user uses local information to choose the unmatched neighbor with the highest weight as her potential matching partner; she will stop once this preference becomes reciprocal, or there are no available unmatched neighbors. This algorithm calculates a matching with total weight at least of the optimum (see [9]). This worst-case approximation ratio of is achieved in a three-edge instance where the middle edge has slightly larger weight than its two adjacent edges, since the greedy matching chooses the middle edge while the optimal matching chooses the two side edges.
II-C Our Problem Statement for Average-Case Analysis
Though the approximation ratio of Algorithm 1 is with half efficiency loss in the worst case, this ratio is achieved in the three-edge instance only when the middle edge has slightly larger weight than its two adjacent edges. In a large network instance, given the i.i.d. assumption regarding the choice of the weights, it is improbable that the graph will consist of an infinite repetition of the above special weighted three-edge pattern which leads to the worst-case performance. Hence, we expect the average performance ratio of the greedy matching to be much above . We next provide the necessary definitions for our average performance analysis.
By taking expectation with respect to the weights in that are i.i.d. with a general discrete distribution , we define the average performance ratio of Algorithm 1 for a given graph as follows:
(2) |
where and denote the total weights (i.e., social welfare) under the optimal matching and the greedy matching, respectively, being the corresponding matchings. Since over time the algorithm is repeated for new instances, the numerator and denominator correspond to the time-average of the social welfare obtained by running the greedy and the optimal algorithms, respectively.
We next evaluate the performance ratio for several special forms of practical interest for that corroborate the excellent performance of the greedy matching, including 2D grids and the more general random graph networks. In the case of random graphs, we must take expectation in (2) over both and . Besides, we will also prove the sub-linear computation complexity to run Algorithm 1 for these networks.
III Average-Case Analysis for D2D Sharing in 2D Grid Networks
In wireless networks, 2D grids are widely used to model social mobility of users (e.g., [11, 12]). In this section, we analyze the average performance ratio and the parallel complexity of Algorithm 1 to validate its performance on planar user connectivity graphs. Note that the average-case analysis of 2D grids is an important benchmark for the more general random graphs analyzed in the following sections.
III-A Average Performance Analysis of Optimal Matching
It is impossible to obtain the exact value of the average total weight under the optimal matching due to the exponential number of the possible matchings. Instead, we propose a method to compute an upper bound for the denominator in (2) using a methodology that holds for general graphs. This upper bound will be used to derive a lower bound for the average performance ratio in (2) later.
In any graph , each matched edge adds value to the final matching. Equivalently, we can think of it as providing individual users and with equal benefit . For any user , this individual benefit does not exceed half of the maximum weight of its neighboring edges. Using this idea and summing over all users, the total weight of the optimal matching is upper bounded by
(3) |
By taking expectation over the weight distribution, we obtain the closed-form upper bound of the average total weight.
Proposition 1
For a general graph with the weight set and the weight distribution , the average total weight of the optimal matching is upper bounded by
(4) |
where is the cardinality of .
The proof is given in Appendix A.
III-B Average Performance Ratio of Algorithm 1

We next turn in the calculation of the average total weight of the greedy matching, i.e., the numerator in (2). In the case of 2D grid networks we cannot directly use dynamic programming since matching users does not divide the grid into sub-grids. Instead, we start by considering the simplest grid where each user locally connects with two adjacent users and (except for starting and ending users and ). In such linear networks, for notational simplicity we use instead of to denote the connection between users and , and similarly use weight instead of . Without loss of generality, we assume that each user facing the same weights of the two adjacent edges assigns higher priority to match with the left-hand-side neighbor. This implies that Algorithm 1 becomes deterministic and returns a unique solution.
We prove that given the weight set size , an edge that has the local maximum weight (i.e., ) and will certainly match in Algorithm 1 can be found within the first edges of the linear network graph. Further, by considering all the weight combinations of the first edges and the existence of edge that will certainly match, we derive the recursive formula for where denotes the average total weight of the greedy matching in the linear graph with users. An illustrative example for is shown in Fig. 2 and the recursive formula averaged with respect to the probabilities is given by
(5) |
Based on that, we derive when is large by using asymptotic analysis. Similarly, for an arbitrary , we can also obtain the general formula for the sequence as a function of and .

Note that a simple extension of the previous result to grid by dividing it into sub-grids of size provides a bad lower bound because all the vertical edges become unavailable to match. Instead, we split the grid network into sub-grids in a way that keeps half of the vertical edges, and then estimate a lower bound of the average total weight. For illustration purpose, we treat the case of weight set size , . Our procedure involves the following three steps (as illustrated in Fig. 3), and it is easy for the reader to generalize for .
Step 1: Split the grid into sub-grids of size by eliminating the corresponding edges.
Step 2: For each sub-grid from step 1, greedily add the vertical edges of (largest) weight value to the matching and remove the corresponding users. This results in further disconnecting the given sub-grid into smaller sub-grids of size , for appropriate values of . Note that each such sub-grid only has vertical edges of (smaller) weight .
Step 3: For each sub-grid of size from step 2, if , simply add this single-edge to the matching. If , greedily match the horizontal edges in the corresponding upper and lower linear networks first and remove the corresponding users; then match the remaining vertical edges of smaller weight .
The above procedure allows us to find a lower bound on the matching obtained by Algorithm 1. This is obtained by i) eliminating from the set of edges that may be matched the vertical edges in step 1 (see Fig. 3), ii) analyzing the greedy matching of the two horizontal linear networks in the resulting sub-grids (using similar analysis as in (5)), and leaving out the possible matching of the rest vertical edges in step 3. By combining this lower bound for the performance of Algorithm 1 with the upper bound for the optimal matching in (9) we obtain the following bound for the average performance ratio.
Proposition 2
In grids with the weight set and uniform weight distribution , the average performance ratio of Algorithm 1 satisfies when .
The proof is given in Appendix B. Observe that here we consider the case of weight set (‘low’ and ‘high’) and uniform weight distribution for illustration purpose. The analysis can be extended for any possible and .
III-C Parallel Complexity Analysis of Algorithm 1
In this subsection, we focus on analyzing the parallel running time of Algorithm 1, where a unit of time corresponds to one iteration of the steps of Algorithm 1. Similarly, we start with the simplest grid. Let denote the length of the longest chain (sequence of edges) that has non-decreasing weights and starts from towards the left or right side. Suppose that is such a longest chain. We claim that will terminate running Algorithm 1 (i.e., by being matched or knowing that there is no unmatched neighbors) within time. This is easy to see since starting from time 0, the edge will be included in the total matching in iteration 1, in iteration 2, etc. Hence, in less than steps, all neighbors of will have resolved their possible preferences towards users different than , and subsequently will either be matched with one of her neighbors or be left with an empty unmatched neighbor set. As Algorithm 1 terminates when all users make their final decision, if the probability of any user in having a chain longer than (i.e., ) for some constant is very small, then the parallel execution of Algorithm 1 will terminate within time with very high probability.
Then, we extend our analysis to the grid. Note that the number of possible chains that start from any given node and have non-decreasing weights is no longer two (toward left or right) as in grid networks, but exponential in the size of the chain (since from each node there are ‘out’ ways for the chain to continue), and such chains now form with non-negligible probability. This problem is not an issue for Algorithm 1 since every node will need to use priorities over ties among neighbors whose edge has the same weight. This significantly reduces the number of possible chains that are relevant to a user’s decisions and we can prove the following proposition.
Proposition 3
In grids, Algorithm 1 runs in time w.h.p..
The proof is given in Appendix C. In conclusion, our distributed matching algorithm has low complexity and provides a great implementation advantage compared to the optimal but computational-expensive centralized matching.
IV Average-Case Analysis for D2D Sharing in Networks
In practice, a mobile user may encounter a random number of neighbors. In this section, we extend our analysis to random networks , where users connect with each other with probability and hence each user has in the average (an order of magnitude) neighbors. Although the actual spatial distribution of users is not necessarily planar, such random graphs can still represent their connectivity on the ground and the analysis also holds.
We study the average performance ratio of Algorithm 1 in the cases of dense random graphs with a constant (i.e., dense since increases linearly in ) [13], and sparse random graphs with a constant average neighbor number (i.e., ) [14]. Unlike the 2D grid networks, the structure of the random network is no longer fixed due to the random connectivity. Though it is more technically difficult to analyze the average performance of Algorithm 1 for random graph structure, we are able to derive the ratio using statistical analysis in the two important cases below. For intermediate values of where our techniques cannot be applied, we have used exhaustive sets of simulations.
IV-A Average-Case Analysis of Dense Random Graphs
Given remains a constant, as increases, each user will have an increasing number of neighbors with the largest possible weight value . Since such edges are preferred by greedy matching, as goes to infinity, the greedy matching will almost surely provide the highest possible total matching value of ( pairs of users with weight value ).
Proposition 4
For a random graph with a constant , the average performance ratio of Algorithm 1 satisfies w.h.p..
The proof is given in Appendix D. In this result, in the definition of the average performance ration we have taken expectation over both and . Note that the computation complexity is not anymore in this case due to the increasing graph density. An obvious bound is proved in [9]..
IV-B Average-Case Analysis of Sparse Random Graphs
In this subsection, we consider that the connection probability is and hence each user has a constant average number of neighbors as becomes large. We first prove low parallel complexity for Algorithm 1 as long as each user has a small enough number of neighbors to pair with that depends on the distribution of the edge weights.
Proposition 5
For type of networks, Algorithm 1 runs in time w.h.p. if .
The proof is given in Appendix E. Note that this condition is always satisfied when as the weight probability for any .
Next, we focus on studying the average performance ratio for sparse random graphs . The average total weight of the optimal matching can be upper bounded by (9), which works for any graph. Then, we only need to study the average total weight of the greedy matching. Note that when matching any graph , we can equivalently view that the weight of any matched edge is equally split and allocated to its two end-nodes. Then we can rewrite the above expression as follows:
(6) |
where is half of the weight of the matched edge corresponding to each user under the greedy matching.
We cannot use dynamic programming directly to compute the average weight per user in (6) since may have loops and it cannot be divided into independent sub-graphs. Given that is large and assuming , then graph , with very high probability, is composed by a large number of random trees without forming loops. In this case the matching weight of user only depends on the connectivity with other users in the same tree. To analyze , we want to mathematically characterize such trees which turn out to be ‘small’ because . Note that, in , each user has independent potential neighbors, and its random neighbor number follows a binomial distribution with mean , as becomes large. This binomial distribution can be well approximated by the Poisson distribution (with mean ). We define as a random tree where each node in the tree gives birth to children randomly according to the Poisson distribution .
Proposition 6
Given a sparse random network with and sufficiently large , the average matching weight of any node is well approximated by the average matching weight of the root node of a random tree , i.e.,
(7) |
The proof is given in Appendix F. We will show numerically later that the approximation in (7) yields trivial performance gap and remains accurate as long as . By substituting (7) into (6), we obtain approximately the average total weight . Hence, it remains to derive the form of . Given the recursive nature of trees, we are able to use dynamic programming techniques.
The root node may receive multiple proposals from its children corresponding to different possible edge weights in the set , and will match to the one (of them) with the maximum weight. We define , , to denote the probability that the root node receive a proposal from a child who connects to it with an edge of weight . Then, by considering all the possible weight combinations of the root’s children, we can compute the probability to match a child with any given weight, using the proposal probabilities . In a random tree , given the root node is matched with one of its children, the remaining graph can be divided into several sub-trees which are generated from the grand-child or child nodes of the root node. In any case, a sub-tree starting with any given node has the similar graph structure and statistical property as the original tree . Thus, we are able to analytically derive the recursive equations for finding the proposal probabilities for the root node.
Proposition 7
In the random tree , for any , the proposal probability from a child of edge weight to the root node is the unique solution to the following equation:
(8) |
The proof is given in Appendix G. Though not in closed-form, we can easily solve (8) using bisection, and then compute the probability that the root node matches to a child with any given weight. Based on that we derive the average matching weight of the root for (7) and thus in (6). Finally, by comparing with (9) under the optimal matching, we can obtain the average performance ratio of Algorithm 1.
IV-C Numerical Results for Random Graphs

Next, we conduct numerical analysis for sparse random graphs with and random graphs with finite . To do that by using analytic formulas, we need to approximate the random graph by random trees, and one may wonder if the approximation error is significant (when ). To answer this question, we consider large network size of , with edge weights uniformly chosen from the weight set (‘low’ and ‘high’). Our extensive numerical results show that the difference between the simulated average matching weight and the analytically derived average matching weight in the approximated tree is always less than when and is still less than even for large . This is consistent with Proposition 6.
Fig. 4 shows the average performance ratio of Algorithm 1, which is greater than for any value. It approaches as is small in the sparse random graph regime. Intuitively, when the average neighbor number is small and users are sparsely connected, both Algorithm 1 and the optimal algorithm try to match as many existing pairs as possible, resulting in trivial performance gap. When is large, each user has many neighbors and choosing the second or third best matching in the greedy matching is also close to the optimum. This is consistent with Proposition 4 for dense random graphs.
V Practical Application Aspects
In practice, the network graphs that one may obtain by restricting the D2D sharing range may have different distributions than the 2D grids and the graphs used in our analysis. In addition to that, the actual performance of the algorithm might be degraded because of communication failures of nodes that are far or mutual interference among pairs. In this section, we provide an initial investigation of the above issues. We construct instances of a network graph based on realistic user location data and check how well our analytical performance measure captures the actual performance of the greedy algorithm on the above graph instances by tuning to match the average number of neighbors in the realistic graph. Next, we analyze the impact of D2D communication failures on the optimum selection of D2D maximum sharing range.
V-A Approximating Realistic Networks

The network studied in Section IV assumes users connect with each other with the same probability , and hence the average performance of Algorithm 1 in is characterized by the average neighbor number . However, in practice, the connectivity distribution of users can follow different laws due to the structure of the environment and the D2D communication limitations. To validate our analysis on real scenarios, we run our algorithm on graphs corresponding to realistic mobile user data and compare the numerical results with our analytically derived results for using Propositions 6 and 7.
We use the real dataset in [15] that records users’ position information in a three-story university building. We choose three instances in the peak (in terms of density) time from the dataset and each instance contains hundreds of users. For these users, we assume that any two of them can share resources with each other when they are in the same story and the distance between them is less than the D2D sharing range . By setting different values for the structure of the graph changes and the average number of neighbors per node increases. In Fig. 5, we show the average matching weight (per user) of the greedy matching versus the average neighbor number (instead of versus ) for the three practical instances of the realistic user network and its approximation. We observe that the average matching weight increases in since increasing (by increasing ) provides more sharing choices for each user and our performance measure obtained for approximates well the performance for the realistic network, especially for large .
V-B D2D Sharing Range under Communication Failures
Our numerical results from the previous section suggest that, as expected, the average matching weight of the greedy matching increases with the D2D sharing range . We wonder whether a large always benefits resource sharing. In fact, for two users who are connected and share resources via a D2D wireless link, a communication failure may occur due to the long-distance transmission or the mutual interference among different matched pairs. In our experiment, we consider that the resource sharing transmission between any two users fails with a probability that increases in the distance between them based on a practical path-loss model and the number of interfered pairs in proximity [16]. In our simulation experiment, we consider a large number of users uniformly distributed in a circular ground cell with radius of meters and we can adjust the maximum sharing range inside which two users can apply D2D resource sharing.

In Fig. 6, we depict the average matching weight (per user) of the greedy matching versus the maximum D2D sharing range for two cases depending on whether or not we consider communication failures. Under communication failures, this weight first increases and then decreases. Intuitively, when the sharing range is small, each user has few potential users to share resources or interfere and failures occur rarely to be an issue. But when is large, since most of the neighbors are located remotely and the channels between matched pairs may cross each other, there is a high chance for the algorithm to choose such a remote neighbor to incur large path loss or interference. Then, if communication fails, this results in adding zero value to the total matching. This is in contrast to the case without failures, where the performance of the system is always increasing in .
VI Conclusions
In this paper, we adopt a greedy matching algorithm to maximize the total sharing benefit in large D2D resource sharing networks. This algorithm is fully distributed and has sub-linear complexity in the number of users . Though the approximation ratio of this algorithm is (a worst-case result), we conduct average-case analysis to rigorously prove that this algorithm provides a much better average performance ratio compared to the optimal in 2D grids and random networks when these are sparse or very dense. We also use realistic data to show that our analytical performance measure approximates well D2D networks encountered in practice. Finally, we consider the communication failures due to the practical implementation issues and study the best maximum D2D sharing range.
Appendix A Proof of Proposition 1
For any user with degree , the probability that the maximum weight of all the neighboring edges is equal to or less than is given by where is the probability that one edge has weight equal to or less than . Thus, the average maximum weight of all edges incident to user is given by . Further, the expectation of (3) can be given by:
(9) |
The proof is completed.
Appendix B Proof of Proposition 2
Based on Proposition 1, we are able to compute the upper bound of the average total weight under the optimal matching for any given graph. We now consider a grid and that the weight set and the weight probability distribution are given. Note that, in this gird, there are nodes with degree , nodes with degree , and nodes with degree in the grid. Moreover, the average maximum weight of a node with degree is . Thus, we finally obtain the average total weight under the optimal matching in the grid is upper bounded by: .
Regarding the average total weight of greedy matching, we first note that for each sub-grid, the greedy algorithm must add the vertical edges with weight between the two rows and the average number of such edges is given by . Therefore, the average weight caused by adding the vertical edges with weight is equal to .
After adding these edges, the remaining graph becomes a lot of segments as shown in Fig. 3. We first compute the average number of segments with length by using probability analysis, and it is given by . Moreover, note that, for a segment with length , the algorithm will add the only vertical edge with weight . Therefore, the average weight caused by adding the vertical edges in segments of length is equal to .
As for for a segment with size and , its greedy matching consists of three parts: the individual greedy matching in the first row, the individual greedy matching in the second row, and all possible matching of the vertical edges between the remaining unmatched nodes of the two rows. Thus, the average total weight under the greedy matching in this segment should be at least equal to , where denotes the average total weight for a linear network with nodes. Therefore, the average weight caused by matched edges in segments of length is larger than or equal to . To compute that, we need the value of for any . Note that , , and we have according to (5). Thus, we can compute the value of for finite number of , for example, from to . Then, we can further derive a lower bound for , which is given by . Note that the value of is almost zero since increases exponentially while increases linearly when is large.
In sum, we can prove that the average total weight under the greedy matching in the grid is lower bounded by:
where denotes the average total weight under the greedy matching in the grid and denotes the average total weight under the greedy matching in a linear network with edges.
Now, we know that the lower bound for the average total weight under the greedy matching is given by and the upper bound of the average total weight under the optimal matching is given by . Therefore, the average performance guarantee is when .
Appendix C Proof of Proposition 3
We first consider the special case of grid. For any user in such grid, let be the indicator variable that the length of the longest chain (sequence of edges) that has non-decreasing weights and starts from towards the left or right side is greater than (c is a constant). Let be the indicator variable that the linear graph has at least one such chain with length greater than . Then we have:
(10) |
where denotes the probability that consecutive edges has non-decreasing weights.
The weight of each edge is assumed to independently take value from kinds of weight values according to the probability distribution . Then, for any edges, there are totally:
kinds of non-decreasing weight combinations, and for each of the combinations, the probability to happen is upper bounded by . Therefore, the upper bound of the probability that any consecutive edges have non-decreasing weights is given by:
Then, we have:
Note that when , converges to when .
Therefore we can conclude that, in grid, the algorithm run in time w.h.p. according to the first moment method.
Next, we extend our analysis to the grid. Note that, in such grid, the number of possible chains that start from any given node and have non-decreasing weights is no longer two (toward left or right) as in grid networks, but still limited to be less than (the weight set size is a given constant). This is because we assume in Algorithm 1, every node will need to use priorities over ties among neighbors whose edge has the same weight and thus the number of possible chains that are relevant to a user’s decisions is significantly reduced. Then we have:
(11) |
By using the similar arguments in the grid, we can prove that in grid, the algorithm run in time w.h.p..
Appendix D Proof of Proposition 4
In the random graph with a large user number and a constant connection probability , the probability that there exist edges that have less edges than among them is upper bounded by:
Therefore, for any nodes in , there are more than edges among them with probability 1.
Let denote the number of edges in the random graph after the greedy matching algorithm adding edges. The probability that the heaviest edge among edges has weight is . Thus, the probability that the first heaviest edge to add in the greedy algorithm has weight is given by . After adding the first edge in the greedy algorithm, the probability that the heaviest edge to add among the remaining edges has weight is given by . Similarly, we have that when , the probability that the -th edge to add have weight satisfies:
(12) |
where the second inequality is because the number of edges among the remaining unmatched users is large than with probability 1 when as we have proved earlier,
Therefore, we have that all the first edges added to the greedy matching have the largest weight with probability 1. Moreover, an obvious upper bound of the total weight under the optimal matching is given by since any two users can be matched with a edge with weight at most. Therefore, the average performance guarantee of the greedy algorithm is given by:
The proof is completed.
Appendix E Proof of Proposition 5
Similarly, let be the indicator variable that the length of the longest chain (sequence of edges) that has non-decreasing weights and starts from towards the left or right side is greater than (c is a constant). Let be the indicator variable that the linear graph has at least one such chain with length greater than . Then we have
where denotes the probability that consecutive edges has non-decreasing weights.
By using the similar arguments in the proof of Proposition 3, we have . Then we obtain:
Note that when , there always exists a constant that makes converge to when . Therefore we can conclude that the algorithm will terminate within iterations w.h.p. according to the first moment method.
Appendix F Proof of Proposition 6
In with , to prove (7), we first show the connected component of any user has no loops w.h.p., and thus we can analyze the conditional expectation of assuming the number of loops in ’s component is zero, instead of directly analyzing (step 1 below). Then, it remains to show can be well approximated by in the approximated random tree , as both of them are considered in graphs without loops (step 2 below).
Step 1: In , there are totally a random number of loops each of which includes at least three users, and for any users, they have totally kinds of permutations to form a loop. Thus, the average total number of loops is:
(13) |
which implies that regardless of the graph size , there are at most a constant number of loops. Moreover, since [14] proves that almost surely has no connected components of size larger than for some constant , the average size of the largest connected component in is only . By combining this with (13), the average total number of users in the components with loops should be less than . Therefore, the probability that user is one of these users who are in components with loops is:
(14) |
where denotes the number of loops in the connected component of user . Based on (14), we now have:
(15) |
Step 2: In this step, our problem becomes to prove that the conditional expectation can be well approximated by . Given the connected component of user is a tree (i.e., with loop), we start by first showing that the users in the component connect with each other in a similar way as in the random tree .
We do a breadth-first search (BFS) starting from to explore all its connected users by searching all its direct neighbors prior to moving on to the two-hop neighbors. Note that the number of neighbors we explore from user follows the binomial distribution . In fact, for any user in the BFS tree of , the number of new neighbors we directly explore from this user follows the binomial distribution where is the number of users that have already been explored currently and cannot be explored again (otherwise a loop would occur). Meanwhile, in , each node gives birth to children according to the same Poisson distribution no matter how large the tree currently is.
Next, we prove that the difference between the branching under and is trivial. Actually, for any , the ratio of the probability of getting from distribution and the probability of getting from distribution is bounded by:
(16) |
when is sufficiently large.
We define as the set of all possible graph structures that the random tree can have, and as the corresponding probability for any structure . As the set includes all possible structures that the BFS tree of can have, we also define similarly for the BFS tree. Then, based on (16), for any with user size , we have:
(17) |
which is because both the probabilities and are given by the product of all users’ individual probability to give birth to a given number of children as in structure .
We now note that the difference between and is determined by the difference between and :
(18) | |||
(19) |
(19) uses instead of because the matching weight of node should be equal to the matching weight of the root node when the BFS tree of has the same structure as the rooted tree.
By substituting (17) into (18) and (19), we have:
(20) |
where we split the analysis in two cases depending on whether the graph structure has size larger than or not. As we mentioned earlier, [14] proves that almost surely has no connected components of size larger than for the constant , thus we have the probability to derive equality (a). Inequality (b) is due to that the average size of the random tree is given by where is the average size of the -th generation as each node gives birth to children on average. Moreover, according to the first moment method, we also have for (a).
Appendix G Proof of Proposition 7
To compute the proposal probability , we further define to denote the probability that the root node receive a proposal from a child who connects to it with an edge of weight given this child gives birth to grandchild nodes (happens with probability as ). If the edge between the root node and the child has the maximum weight (i.e., ), the child will send a proposal to the root node only when all grandchildren that have the maximum weight among the grandchild nodes (happens with probability ) either want great-grandchildren (happens with probability ) or have lower priority to be added. Thus, the recursive equation for the proposal probability is given as follows:
Moreover, by considering all possible number of grandchildren that the child can give birth to, we can derive the aggregate recursive equation for the matching possibility :
(21) |
after a summation by parts. Note that the term on the right-hand-side of the equation is decreasing in when . Moreover, when , the RHS of the equation is equal to 1. When , the RHS of the equation is equal to for any and . Therefore, there exist a unique solution satisfying the above equation in the interval .
Then, after the proposal probability of the maximum weight has been decided, the proposal probability now have the highest priority to compute as becomes the maximum weight among the remaining weights. Similarly, for the proposal probability , we can derive the following recursive equation:
(22) |
Using the similar argument for , we prove that there exist a unique solution satisfying the above equation in the interval after substituting the solution to (21) into (22).
Eventually, for any , we can derive the following recursive equation:
and prove that there exists a unique solution to the equation.
References
- [1] X. Wang, L. Duan, and R. Zhang, “User-Initiated Data Plan Trading via a Personal Hotspot Market,” in IEEE Transactions on Wireless Communications, vol. 15, no. 11, pp. 7885-7898, Nov. 2016.
- [2] L. Zheng, C. Joe-Wong, C. W. Tan, S. Ha, and M. Chiang, “Secondary markets for mobile data: Feasibility and benefits of traded data plans,” 2015 IEEE Conference on Computer Communications (INFOCOM), Kowloon, 2015, pp. 1580-1588.
- [3] Y. Guo, L. Duan, and R. Zhang, “Cooperative Local Caching Under Heterogeneous File Preferences,” in IEEE Transactions on Communications, vol. 65, no. 1, pp. 444-457, Jan 2017.
- [4] L. Keller, A. Le, B. Cici, H. Seferoglu, C. Fragouli, and A. Markopoulou, “Microcast: Cooperative video streaming on smartphones,” In Proceedings of the 10th International Conference on Mobile Systems, Applications, and Services (MobiSys ’12), New York, 2012, pp. 57–70.
- [5] L. Jiang, H. Tian, Z. Xing, K. Wang, K. Zhang, S. Maharjan, S. Gjessing, and Y. Zhang, “Social-aware energy harvesting device-to-device communications in 5G networks,” in IEEE Wireless Communications, vol. 23, no. 4, pp. 20-27, August 2016.
- [6] X. Chen, L. Pu, L. Gao, W. Wu, and D. Wu, “Exploiting Massive D2D Collaboration for Energy-Efficient Mobile Edge Computing,” in IEEE Wireless Communications, vol. 24, no. 4, pp. 64-71, Aug. 2017.
- [7] A. Schrijver, “Combinatorial Optimization: Polyhedra and Efficiency,” Springer Science Business Media, Vol. 24, 2003.
- [8] R. Preis, “Linear time 1/2-approximation algorithm for maximum weighted matching in general graphs,” in Annual Symposium on Theoretical Aspects of Computer Science, Springer, 1999, pp. 259-269.
- [9] JH. Hoepman, “Simple distributed weighted matchings,” 2004, [Online]. Available: https://arxiv.org/abs/cs/0410047
- [10] Z. Lotker, B. Patt-Shamir, and S. Pettie, “Improved distributed approximate matching,” Journal of the ACM (JACM), vol. 62, no. 5, pp. 129-136, Nov 2015.
- [11] HB. Lim, YM. Teo, P. Mukherjee, VT. Lam, WF. Wong, and S. See, “Sensor grid: integration of wireless sensor networks and the grid,” The IEEE Conference on Local Computer Networks 30th Anniversary (LCN’05), Sydney, NSW, 2005, pp. 91-99.
- [12] W. Sun, H. Yamaguchi, K. Yukimasa, and S. Kusumoto, “GVGrid: A QoS Routing Protocol for Vehicular Ad Hoc Networks,” 200614th IEEE International Workshop on Quality of Service, New Haven, CT, 2006, pp. 130-139.
- [13] S. Janson, T. Luczak, and A. Rucinski, “Random graphs,” John Wiley Sons, Sep 2011.
- [14] P. Erdős, and A. Rényi, “On the evolution of random graphs,” Publ. Math. Inst. Hung. Acad. Sci, 1960, pp. 17-61.
- [15] Z. Tóth, and J. Tamás, “Miskolc IIS hybrid IPS: Dataset for hybrid indoor positioning,” In 2016 26th International Conference Radioelektronika (RADIOELEKTRONIKA), pp. 408-412. IEEE, 2016.
- [16] T.S. Rappaport, “ Wireless communications: principles and practice,” Vol. 2. New Jersey: prentice hall PTR, 1996.