A study on the friendship paradox – quantitative analysis and relationship with assortative mixing

The friendship paradox is the observation that friends of individuals tend to have more friends or be more popular than the individuals themselves. In this work, we first study local metrics to capture the strength of the paradox and the direction of the paradox from the perspective of individual nodes, i.e., an indication of whether the individual is more or less popular than its friends. These local metrics are aggregated, and global metrics are proposed to express the phenomenon on a network-wide level. Theoretical results show that the defined metrics are well-behaved enough to capture the friendship paradox. We also theoretically analyze the behavior of the friendship paradox for popular network models in order to understand regimes where friendship paradox occurs. These theoretical findings are complemented by experimental results on both network models and real-world networks. By conducting a correlation study between the proposed metrics and degree assortativity, we experimentally demonstrate that the phenomenon of the friendship paradox is related to the well-known phenomenon of assortative mixing.


Introduction
Topologies of complex networks have been known to exhibit non-trivial heterogenous properties such as heavy-tailed degree distributions (Barabási and Albert 1999) and assortative mixing (Newman 2002), to name a few.A similar non-trivial network heterogeneity is captured by the phenomenon of the friendship paradox.The friendship paradox was first studied by Scott Feld in the context of social networks (Feld 1991).It states that the average number of friends of the collection of friends of individuals in a social network will be higher than the average number of friends of the collection of the individuals themselves.The phenomenon results from a sampling bias that causes nodes to be counted in proportion to their degree, and it extends beyond popularity to other individual traits such as amount of content in social networks (Hodas et al. 2013), number of coauthors, citations and publications in scientific collaboration networks (Eom and Jo 2014), etc.This is known as the generalized friendship paradox and has been attributed to a correlation between these desirable traits and degree (Eom and Jo 2014;Fotouhi et al. 2014) although it has been proven to exist in absence of a significant correlation as well (Momeni and Rabbat 2016).The phenomenon has a measurable impact on people's psyches because people tend to evaluate success in regard to a given trait through comparison to the social network around them (Bollen et al. 2017;Jackson 2016); an overshadowing effect of a collection of nodes on another is significant.The friendship paradox has been studied in the context of both online (Bagrow et al. 2017;Bollen et al. 2017;Hodas et al. 2013) and offline social networks (Feld 1991).The phenomenon is described as a global, network-wide characteristic.It is natural to ask if the friendship paradox holds at a more local level, e.g., at the level of individual nodes in a network (Hodas et al. 2013;Momeni and Rabbat 2016).In this work, we mathematically quantify the friendship paradox so as to understand its strength both locally and globally in the network.
Inspired by the friendship paradox, we first study a local network metric for a node, which we call the "friendship index" (FI).For a vertex v, it is defined as , which is the ratio of the average degree of the neighbors of the vertex to its own degree.FI captures two significant characteristics related to the friendship paradox.First, it captures the 'direction of influence' , i.e., it indicates whether, in accordance with the friendship paradox, the vertex is outperformed by its neighbors in popularity, or if it is one of the vertices for which the paradox does not hold because it is more popular than its neighbors.Second, it quantifies the 'discrepancy' compared to a scenario where the friendship paradox does not exist; FI values further from 1 indicate an extreme manifestation of the paradox whereas FI values closer to 1 would indicate the vertex experiences the paradox less severely.Notice that this measure is truly local.The node's FI value is determined entirely by its own degree and the degrees of its neighbors, the structure of network as a whole does not influence a node's FI.This distinguishes FI from local assortativity (Thedchanamoorthy et al. 2014;Piraveenan et al. 2010), a node metric that captures a relative value normalized by other such values in the network.Having defined the local metric, we propose aggregating the indices over all vertices in order to quantify the strength of the overall network-wide phenomenon of friendship paradox by taking an arithmetic mean, the log of the geometric mean, and the harmonic mean.We explore these measures theoretically and experimentally, noting their ability to capture network characteristics.We compare and contrast them and ultimately find value in the arithmetic mean and the log of the geometric mean, while discarding the harmonic mean because drastically different graphs have equivalent harmonic means.Consistent with the nature of the friendship paradox, we prove a significant lower bound on these means that indicates the average FI is always greater than or equal to 1, meaning nodes feel outperformed by their neighbors on average.Because of this bound, we can say the aggregates indicate a stronger occurrence of the friendship paradox as they increase.Unlike FI, where the distance from 1 can be in either the positive or negative direction, the aggregate measures only increase with the strength of the paradox.We explore real-world networks that are categorized by their type, and find some consistencies in our aggregate measures within the individual categories.
A number of existing works have analysed the friendship paradox from different perspectives.The comparison between a node's degree to both the mean and median of neighbors' degrees has been used in the literature, primarily as a binary measure of whether a node is more or less popular compared to its neighbors (Jo and Eom 2014;Momeni and Rabbat 2016;Momeni and Rabbat 2018;Lee et al. 2019), while some (Hodas et al. 2013;Jackson 2016) have also used its absolute value to indicate severity of the paradox.Hodas et al. (2013) uses the binary measure obtained through the mean of neighbor's degrees to investigate the friendship paradox in Twitter network.Jo and Eom (2014) characterized the paradox holding probability of individual nodes, and studied its behavior for network models with tunable degree-degree and degree-attribute correlations.A significant finding was that the paradox holding probability may depend on the assortativity of the network, which acts as a strong motivation for our work.Momeni and Rabbat (2016) used both the mean and median based binary measures to investigate the prevalence of friendship paradox in Twitter network.Lee et al. (2019) studied three perception models of the friendship paradox -mean-based, median-based and fractionbased binary measures for the friendship paradox aggregated across the entire network.These measures were analysed in configuration models with tunable assortativity, and the impact of the perception model was studied on opinion formation.Our contribution has been to investigate the measure based on the mean of neighbors' degrees as a network metric by studying its properties in popular network models, and illustrating its relationship with local and global measures of assortativity.
The phenomenon of assortativity, or assortative mixing captures the preference for a network's nodes to attach to others that are similar in some way.In this work, we focus on degree assortativity (Newman 2002) where the measure of similarity is in terms of the nodes' degrees.Although assortativity was proposed as a global measure, local versions have also been proposed more recently (Piraveenan et al. 2010;Thedchanamoorthy et al. 2014).It is worth mentioning that these local assortativity measures are examples of node measures that are not truly local, because they are influenced by the global assortativity of the graph.Jo and Eom (2014), Lee et al. (2019), and Momeni and Rabbat (2018) conduct studies on networks that vary in assortativity and explore its impact on the friendship paradox.In this work, we further investigate the relationship between the friendship paradox and assortative mixing, by analysing the relationship between the FIs of nodes and their local assortativity measures.We observe that FI values close to 1.0 indicate strong local assortativity, while FI values further from 1.0 indicate weak assortativity.We also explore the relationship between our network-wide aggregate measures and network assortativity.Similar to the results of the local measures, when the aggregate values are extreme they indicate disassortativity and when they are moderate they indicate assortativity.These consistencies between the measures are revealed through theoretical arguments and experimental results.We conclude that the friendship index captures some information about assortative mixing in the network.We consider canonical graphs and common graph models and find our aggregate measures produce well behaved functions that smoothly reflect small adjustments in the graphs where the function of network assortativity has a far less smooth curve.The present work is an extension of our previous work (Pal et al. 2018); here we present complete and detailed proofs of results partially proven in Pal et al. (2018) along with new theoretical findings on the proposed metrics in networks models, such as Erdos-Renyi and Barabasi-Albert graphs.Additionally, a more thorough simulation study on network models is presented here.
The paper is organized as follows.In "Preliminary" section we define the local and global notions of friendship index and assortativity.These metrics are then studied for various canonical graphs such as regular graphs, star graphs and complete bipartite graphs.In "Theoretical results on friendship index" section, we highlight some theoretical results of the friendship index, followed by experimental results on network models and real networks in "Experimental results" section.

Friendship index
Consider a graph G = (V , E), with V and E ⊆ V × V being the set of nodes and edges respectively.For each node i ∈ V , let d i denote the degree of node i and S i denote the sum of i's neighbors' degrees.Therefore, we have where N i denotes the set of neighbors of node i.The friendship index (FI) of node i is defined as (1) The friendship index of a node is the average degree of its neighbors normalized by its own degree.Therefore, the FI of a node will be less than 1 if its own degree is larger in comparison to its neighbors' degrees, and greater than 1 otherwise.
Another way to understand the friendship index is through the uniform and neighborhood node sampler (Leskovec and Faloutsos 2006;Momeni and Rabbat 2018).For a graph G = (V , E), we define the following node sampling techniques: a) Uniform sampler ρ -A uniformly sampled node is chosen uniformly at random among the nodes in the graph.Therefore, ρ ∼ U (V ).
b) Edge sampler σ -An edge is sampled uniformly at random, then one of its endpoints are chosen uniformly at random.For an uniformly chosen edge c) Neighborhood sampler μ -First define μ(i) ∼ U (N i ) to be a node sampled uniformly at random among the neighbors of node i.If node i has no neighbors then set μ = i.Next, we define μ(ρ) to be a node that is sampled randomly from the neighbors of an uniformly sampled node ρ.Operationally, first sample ρ ∼ U (V ) and μ ∼ U (N ρ ); However if We can equivalently define the friendship index as follows, It is easy to see that the friendship index for regular graphs will always be 1 because all degrees are the same.This is a local network metric concerning a particular node.We could either aggregate the local measure to obtain a global measure or directly work with the local FIs {FI(i), i ∈ V }.
The local measures of the friendship paradox can be extended to the entire network in different ways.The following global notions of FI can be defined for a given graph G: 1 Arithmetic FI (AFI) -We define AFI as the average, or arithmetic mean, of all the local FIs Observe that with the caveat that Ed i d i is set to 1 if d i = 0. Therefore, AFI is the expected ratio between the degrees of a neighborhood sampled node μ(ρ) and that of the uniformly sampled node ρ. 2 Geometric FI (GFI) -This metric is defined as the logarithm of the geometric mean of all the local FIs While the linearity of expectation allows the alternative representation for AFI through the notion of sampling, we do not have an equivalent expression for GFI.This leads to greater mathematical tractability in analysing AFI of network models compared to GFI or other binary measures based on individual nodes involving Heaviside step functions.However, GFI has other benefits over AFI that will become apparent later.3 Harmonic FI (HFI) -This metric is defined as the harmonic mean of all the local FIs Again for HFI, we do not have an alternative representation like (4).
We will give theoretical results on AFI and experimental results on both AFI and GFI.In what follows we explain the relative advantages of considering AFI and GFI.Newman (2002) defines assortativity as a measure of the similarity of degree in adjacent vertices. 1Newman formally quantifies assortativity as a Pearson correlation coefficient of the degrees of the two vertices attached to every edge.This can be expressed as

Global and local assortativity
where (σ 1 , σ 2 ) is an uniformly sampled edge and σ is a node sampled according to the random edge sampling.This difference in sampling nodes introduces inherent differences between the friendship index and assortativity.
The assortativity can also be defined in terms of the network degree distribution p, excess or remaining degree distribution q and the link distribution e j,k .Note that the distribution p is the degree distribution of an uniformly sampled node ρ.The distribution q is related to the excess degree of a node arrived through the random edge sampling procedure, given by We also define the joint probability distribution of the remaining degrees of the two nodes on either end of a randomly chosen link as e j,k .We can equivalently define assortativity as where σ q is the standard deviation of the distribution q.
While this definition of assortativity is at the global level, several efforts have been made to quantify the assortativity of the network at a local level (Piraveenan et al. 2010;Thedchanamoorthy et al. 2014).Specifically, we first consider the definition of local assortativity presented by Piraveenan et al. (2010).This definition of local assortativity, which we call the p-local assortativity is defined as where, k is the average remaining degree of the node's neighbors, μ q and σ q are the mean and standard deviation of the distribution q.It also follows that the p-local assortativities of all the nodes sum up to the network assortativity r.Note that r p (i) is positive and large if (d i − 1) k >> μ 2 q .This happens when a high degree node is connected to other nodes which have relatively high degree or if a node with degree in a medium range has neighbors with large degrees.And, r p (i) is large in magnitude and negative if (d i − 1) k << μ 2 q , which can happen when a node with low degree is connected to low degree nodes.While in such cases the local assortativity should be positive, the p-local assortativity will have a negative value.
We define another notion of local assortativity due to Thedchanamoorthy et al. (2014), which has been argued to be closer to the fundamental notion of assortativity compared to that proposed by Piraveenan et al. (2010).This concurs with our analysis in the previous paragraph that the p-local assortativity does not always capture what a local measure of assortativity should.For these reasons, we only show results for the local assortativity due to Thedchanamoorthy et al.
The local assortativity measure calculates the 'average neighbor difference' , a direct indicator of a node's dissortativity, given by which is then scaled by the sum of the neighbor differences across all the nodes, to obtain the normalized neighbor differences δi .We therefore have, The final assortativity of a node, which we call the T-local assortativity (TLA) is obtained by where λ = r+1 |V | , such that the sum of all the local assortativities yield the global assortativity r.
Observe that if δ i is small, then the degrees of node i and its neighbors are very close.Therefore, the local measure FI(i) should be close to 1.However, if δ i is large then at least one neighbor of i has degree very different from i. Therefore, it is expected that the FI(i) would be far from 1.If it is much less than 1, then the degree of i is more than its neighbors' on average; while if it its greater than 1, then the degree of i is less than its neighbors' on average.Therefore FI captures 'direction of influence' in scenarios of local disassortativity.If the TLA at node i is close to 1, i.e., degree of node i is similar to its neighbors, then FI(i) would be close to 1; and if TLA is small and close to 0, i.e., the degree of node i is significantly different from its neighbors, then FI(i) is expected to be away from 1. Therefore, |FI(i) − 1| is expected to be anticorrelated with TLA, i.e., as |FI(i) − 1| increases, TLA is expected to reduce.

Results for special graphs
1 d-regular graphs -Since all nodes have the same degree d, FI = 1 for all nodes.
Therefore AFI = 1, GFI = 0 and HFI = 1.A clique of n nodes is a n − 1-regular graph.Thus, the result also holds for cliques.Therefore, for d -regular graphs where the friendship paradox does not occur, we get the minimum values for AFI and GFI (see Theorems 1 and 2).Also, the assortativity r = 1 for regular graphs, and all local assortativity values will be positive and equal r T = 2 n . 2 Star graphs -Consider a star graph with n nodes.The FI for the center of the star will be 1 n−1 , and n − 1 for all leaves.One can show that the FI values for the center and the leaves of a star are the maximum and minimum possible values for a graph with the given number of nodes.Thus the friendship paradox is rather severe for a star graph.We calculate, AFI = n − 2 + 1 n−1 , GFI = n−2 n log n and HFI = 1.An advantage of considering GFI is that the maximum and minimum possible values of FIs have the same absolute value in the logarithmic scale.Surprisingly, HFI for a star is the same as that of a d -regular graph.The assortativity r = −1, while all the local assortativities r T will be the minimum value of −1.
3 Complete bipartite graphs -Consider a bipartite graph with x nodes on one side and y nodes on the other.This is a generalization of the star graph Let us denote this as Bipartite(x, y), with the set of x nodes on one side being denoted as X, and the set of y nodes on the other side denoted as Y.For vertex v ∈ X, FI(v) = x y and for v ∈ Y , FI(v) = y x .Therefore, if x > y then nodes in X will have FI > 1 and nodes in Y will have FI < 1.
xy which is always greater than 1 as long as x = y.Furthermore, ∂AFI ∂y = (y 2 −x 2 ) implying that ∂AFI ∂y > 0 for y > x and ∂AFI ∂y < 0 for y < x.Therefore, with x kept constant, the AFI increases when y is varied away from x.We also have GFI = 1 x+y log x x y y x y y x > 1 for x = y.We calculate, ∂GFI ∂y = , which again implies that the GFI will increase as y is varied away from x.Therefore, both AFI and GFI are well-behaved for the class of complete bipartite graphs in that both of the measures increase as y is varied away from x indicating more prominence of the friendship paradox.Interestingly, for x = y, assortativity r = −1, while for x = y assortativity r = 1 by definition, indicating that the variation in assortativity is rather sharp.We also compute HFI = 1 for all positive values of x and y.We find HFI to be equal to 1 for widely different classes of graphs ranging from d -regular graphs to star graphs.Therefore in later sections, we will only continue investigation into AFI and GFI owing to their more well-behaved nature.Also from the star graph, we observed that in the logarithmic scale, the maximum and minimum values of the FI are equidistant from 0, the log FI value where friendship paradox is not observed.Therefore in the "Experimental results" section, we study the correlation between | log FI| and TLA, because | log FI| better captures the deviation from the scenario where friendship paradox does not occur.

A lower bound on global measures of fI
We first state a simple result that will be used in this section.
Lemma 1 For any positive number x, y and monotonically increasing functions f , g : Proof For x, y ≥ 1, we have With f (x) = x, and g(x) = x 2 , the above lemma leads to the following corollary.
Corollary 1 For any edge e(i, j), we have Theorem 1 For all graphs G, AFI(G) ≥ 1. AFI(G) = 1 only for the class of graphs where each connected component is a regular graph.
Proof For a graph G, we have Observe that for each edge (i, j), the term appears when summing over i and d i d 2 j appears when summing over j.Therefore, rather than the double sum in (13), we can have where the last step follows by noticing that for each node i, the term 1 d i appears for exactly d i edges.Also, equality in ( 14) occurs if and only if all the nodes on either side of an edge have the same degree, i.e., all nodes in a connected component have the same degree.
With f (x) = log x, and g(x) = x, Lemma 1 leads to the following corollary.
Corollary 2 For any edge e(i, j), we have Theorem 2 For all graphs G, GFI(G) ≥ 0. GFI(G) = 0 only for the class of graphs where each connected component is a regular graph.
Proof Using the expression for GFI, we obtain for a graph G Applying Jensen's inequality in ( 16), we obtain where the last step is obtained by noticing that for each node i, the term 1 d i log d i appears for exactly d i edges.Again, equality occurs if and only if both nodes on either side of an edge have the same degree.
Theorem 1 has been proven by Jackson (2016)(Lemma 1), while Theorem 2 is a new result.Theorems 1 & 2 show that both the AFI and GFI will be at their minimum values for the class of regular graphs, where the friendship paradox does not occur.For any other graph, the AFI and GFI will be strictly greater than their minimum values, thereby suggesting the occurrence of the friendship paradox due to an imbalance between neighbor degrees.This is in agreement with the observation due to Feld (1991), where he noted that the mean number of friends of friends is always greater than the mean number of friends, i.e., with equality taking place in (18) only for regular graphs where the empirical degree distribution has zero variance.This demonstrates a well-behaved property for both of the proposed global metrics.

Erdos-Renyi graphs
We study the behavior of the friendship index for the class of Erdos-Renyi (ER) graphs (Erdos and Rényi 1960), a basic graph model for capturing random connections in networks.Consider a sequence of ER graphs V n being the vertex set {1, 2, . . ., n}, and E n being the random edge set with every edge occuring with probability p.We define the following notation: For nodes i and j, let {i ∼ j} denote the event of i being connected to j.Let D n,i and N n,i denote the degree and the set of neighbors of node i in G n .In a random graph setting, the expected friendship index of node i in G n can be expressed as Although we will primarily focus on the expected behavior of the FI of a node, it is worth noting that the AFI will exhibit similar behavior, because with, AFI n being the AFI of graph G n .

Case 1: np constant
Considering the first term in (19), we have under the regime np → c, with c > 0. We set the limit as Simple bounds on Friendship Index: Using ( 22), we first try bounding the FI, since the expression cannot be exactly computed.
Lemma 2 For sequence of Erdos-Renyi graphs under the regime np → c.
Proof Using the limiting expression of FI, we obtain for c > 0 For obtaining the lower bound we only use the first term from the infinite sum and also note that Theorem 3 For a sequence of Erdos-Renyi graphs {G n , n = 1, 2, . ..} under the regime np → c, and node i, we have (a) Proof Part (a) of Theorem 3 can be proved using the upper bound of Lemma 2 and also by using the lower bound Lemma 2 does not help in determining the behavior of β for c large, because the upper and lower bounds diverge as c increases.Therefore, we study the behavior of β : R → R over the range of c analytically.For c ∈ (0, C), with C > 0, the infinite sum β(c) converges uniformly on the specified range.Thus, differentiating β(c) w.r.t.c yields For c large and β(c) > 1, we have β (c) < 0. Furthermore for c large, β (c) ≈ −β(c) + 1 implying that lim c→∞ β(c) = 1.This to Theorem 3(b).Part(c) follows from the lower bound in Lemma 2 and observing that the lower bound is greater than 1 for c ∈ (0, δ) (for some δ > 0).Therefore, the result indicates that for c small, the effect of the friendship paradox is weak when measured in terms of AFI.This is probably because the graph is so sparse that there are a lot of isolated nodes and edges, and the paradox does not occur for the two entities.This is true for c large as well because the graph becomes very dense.Also, from Theorem 3(c), we prove that the AFI is strictly greater than 1 for a certain range of parameter c suggesting that the friendship paradox is observed even in large Erdos-Renyi graphs.
Note that the average degree of the ER graph in this regime is (n − 1)p which converges to c. Theorem 3 can also be thought to imply that in random ER graphs, as the average degree of the graph becomes small or gets large, the friendship paradox becomes weaker.For c large, the growth in every node's degree and their neighbors' degrees are such that the friendship paradox is not observed at any chosen node.This is rather intuitive, by recalling that FI is defined as the ratio between the degree of a node's random neighbor and its own degree.If the degrees get large in an ER graph where the degree rvs are uncorrelated, then the sampling bias is expected to be small, which is exactly what we observe.

Case 2: p constant
We also address the question whether the friendship paradox is observed when the probability of connection p is kept constant as n goes to infinity.We return to the expression of the friendship index As n gets large, the second term in (28) behaves as We define the edge rvs as χ i,j , where χ i,j = 1 if the edge exists between nodes i and j, 0 otherwise.We write the first expression in (28) as follows where we have defined, as the excess degree of node j with respect to the edge (i, j).

Lemma 3
j∈N n,i i,j Proof We use the Borel-Cantelli lemma to show the a.s.convergence result.For ease of exposition the detailed proof is shown in Appendix "Proof of lemma 3".Furthermore, we have The convergence results ( 31)-( 33) when applied to (30) yields which together with (29) leads to Theorem 4.

Theorem 4 For sequence of Erdos-Renyi graphs {G
under the regime p constant.
Also, using the dominated convergence theorem we can also prove convergence in expectation.Details provided in Appendix "Proof of theorem 5".

Theorem 5 For sequence of Erdos-Renyi graphs {G
under the regime p constant.Therefore, Theorems 4 & 5 together imply that the friendship paradox is not observed for large ER graphs when p is kept constant.This suggests that the degree imbalances in every node's neighborhood vanish for large graphs under the mentioned regime.One can show that with p held constant, degree of individual nodes diverge in the large graph limit.The intuition for this result is similar to that for the np constant regime with c large, although the two regimes are very different mathematically.

Barabasi-Albert graphs
We analyze the behavior of the AFI in Barabasi-Albert graphs (1999), a well known model for understanding power-law behavior in networks.The sequence of BA graphs {G 0 , G 1 , . ..} are such that G 0 is the initial graph, and the graph grows from G t to G t+1 by adding a node labelled t + 1 and an edge preferentially between t + 1 and a node Q t chosen from the graph G t preferentially on the basis of degree.
The joint degree distribution p T (k, ) is defined as the joint probability of having an edge between two nodes with degrees k and in graph G T .This can be written as where D T,t and D T,Q t are the degrees of nodes t and Q t in graph G T respectively.The limiting joint degree distribution exists and is defined as (Fotouhi and Rabbat 2013), Let AFI for the graph G T be defined as AFI T .We actually prove that AFI T diverges with respect to T.
Proof The following proof uses the fact that the sum of FIs for all the nodes is greater than the sum of the FIs of nodes with degree 1.Using this insight we have We continue by exchanging the order of the finite double sum and only summing for degrees d ≤ M for some fixed positive integer M Using ( 38) with k = d and = 1, we obtain on letting T go to infinity Observe that the sum in ( 41) diverges as M is taken to infinity, and therefore the result follows.
The above result suggests that the friendship paradox keeps growing as the size of the graph grows.This is potentially due to the increasing influence of hubs as the size of the network grows.This is in stark contrast to the behavior of assortativity, which is known to converge to 0 as the size of the BA graph grows (Newman 2002).

Network models
We study three network models -Erdos-Renyi (ER) graphs for modeling random connections; Barabasi-Albert (BA) graphs for modeling power-law behavior; and Watts-Strogatz (WS) graphs known for capturing small-world networks.We study how the global metrics like AFI, GFI, and assortativity behave as the parameters of the models are varied; and connect the experimental results with our theoretical findings on ER and BA graphs obtained in the previous section.We also study the correlation between the local FI metrics and local assortativity (TLA).Specifically, we compute the Pearson, Spearman, and Kendall-Tau correlation coefficients between | log FI| and TLA because the intuition developed in "Theoretical results on friendship index" section suggests that | log FI| and TLA must be negatively correlated -Any deviation from the scenario where the friendship paradox does not occur is best captured by | log FI|, and this measure is expected to increase as the local assortativity (TLA) reduces.

Erdos-Renyi graphs (1960).
In Fig. 1, we show the AFI, GFI and assortativity plots for n = 100, 200, 300, 400, 500 and varying 0 ≤ p ≤ 1.We observe that the phenomenon of the friendship paradox is minimal for both small and large values of p, with the global FI indices reaching a maximum somewhere in between.The intuition behind this finding is that as the probability of connection, p, is varied keeping n fixed, three regimes occur -(a) for small values of p, the graph mostly consists of isolated nodes and edges, which leads to a low value of AFI and GFI; (b) for large values of p, the graph is very close to a as the size of the graph grows.This corresponds to the np constant regime, where the friendship paradox is known to occur.Furthermore, we observe that for any fixed value of sufficiently large p such that the realized graphs are dense enough (p > 0.04 in Fig. 1), increasing the size of the graph n, reduces the AFI.This validates the theoretical result Theorem 4, which states that the AFI should converge to 1 as n grows large keeping p fixed.
On the other hand, assortativity is observed to be very close to 0 for almost all values of n and p.Thus even for the class of ER graphs, the global FIs exhibit behavior somewhat different from assortativity.We also observe from the heatplot that the local FI distribution peaks at 1 for all values of p, with the peak being very prominent for low values of p, less prominent as p increases, and again becomes prominent as p increases even further.This agrees with the plots on the global metrics of AFI and GFI.In Fig. 4, we show the correlation coefficient between the | log FI| values and the T-local assortativities of individual nodes.We observe that as p increases, the correlation coefficients start from high negative values close to −1, then reduce in magnitude, and then again approach −1 as p is further increased.This implies that for sparse and dense ER graphs (p < 0.8), the | log FI| is strongly anticorrelated to TLA.This can be explained by our previous plots which show that the friendship paradox is strong only for a range of values of p, while it is weak for small and large values of p.Our interpretation is that for this particular range of p values where the friendship paradox exists, the anticorrelation between | log FI| and TLA reaches a minima.However, when p is further increased beyond 0.8, the correlation coefficients become unstable because both the | log FI| and the TLA values approach 0.
Barabasi-Albert graphs (Barabási and Albert 1999).In Fig. 2, we observe that the AFI and GFI increase with number of nodes n, keeping number of edges m fixed, which agrees with the theoretical result Theorem 6, and decrease with increasing m for fixed values of n.The intuition behind this is that with fixed m, higher values of n lead to greater occurrence of the friendship paradox, because the disparity in the degrees of the hubs and leaves or low degree nodes become greater.This is evident by looking at star graphs and how the global FIs increase with graph size.Increasing m and keeping n fixed leads to lower global FIs, because the low degree nodes now have larger degrees to begin with.The assortativity approaches 0 with increasing m for reasons similar to that of the FIs.However, assortativity approaches 0 with increasing n, because of the limiting behavior of BA graphs.The heatplot of the local FI distribution indicate a peak at 1, thereby agreeing with the plots of AFI and GFI.
We also show the correlation coefficient plot in Fig. 4 between | log FI| and TLA for BA graphs with n = 1000 and varying m.We observe the two measures to be anticorrelated, with small and larger values of m leading to stronger anticorrelation.Watts-Strogatz graphs (1998).In Fig. 3 we show the behavior of AFI and assortativity as the parameters of the network models such as the size of the graph n, probability of rewiring p or average degree k are changed.We observe that with graph size fixed at n = 200 nodes, increasing p increases the AFI; and, increasing k for fixed p reduces the AFI.The reason for this behavior is that with increasing p, the graphs become more heterogeneous and hence the friendship paradox strengthens.Also, fixing p and increasing k reduces the AFI because larger average degree weakens the effect of the friendship  paradox.We also observe that increasing n keeping p and k fixed increases the AFI which saturates beyond a certain point.
From Fig. 3, we also observe that increasing p reduces the assortativity; While for a fixed p, increasing k gets the assortativity to be closer to 0. The reason for this observation is similar to that stated in the previous paragraph, in that increasing p makes the graph more heterogeneous and leads to the formation of hubs, while fixing p and increasing k reduces the influence of hubs.We also observe that for a larger value of n, the graphs become dissassortative for smaller values of p, the reason being that hubs form for smaller values of p in larger graphs.Also Fig. 4 show strong anti-correlation between | log FI| and TLA for the different parametric settings being considered.While we study the behavior of local and global metrics on network models, we also observe that the FI is related to assortativity in that | log FI| is anti-correlated to TLA for most regimes in the three network models being studied.This strengthens the argument that the phenomenon of friendship paradox and assortative mixing are related.Study on the local metrics.In Figs. 5 and 6, we show the scatter plot between the local FI values and the T-local assortativities for the Hamsterster and the EuroRoad networks respectively.We observe that when T-local assortativity is positive the log FI is close to 0, while for negative local assortativity the log FI could be either more negative or positive.This gives rise to a bell-shaped curve between local assortativity and log FI, and negative correlation between local assortativity and | log FI| as observed in the scatter plots.Therefore, if the local assortativity is positive then the friendship paradox would be low, leading to log FI being close to 0. However, if the local assortativity is negative, then there would be a significant occurrence of the friendship paradox, thereby leading to either more negative or positive values of log FI, and hence higher | log FI|.This justifies the significant negative correlation between TLA and | log FI| as observed in Table 1.Study on the global metrics.We consider 13 real networks of different types.We report basic network parameters such as number of nodes and edges, global metrics such as assortativity r and the proposed metrics AFI and GFI.We also report the Pearson correlation coefficient ρ P and Spearman's rank correlation coefficeint ρ s between the local FI measure in absolute value, | log FI|, and local assortativity r T .

Description
We observe that while most of the social networks have negative assortativity, all of them exhibit the friendship paradox very strongly.On the other hand, the human social and contact networks exhibit the friendship paradox very weakly partly due to the small size of the network.Computer networks like the Route views and Internet topology show negative assortativity and a strong friendship paradox while infrastructure networks show positive assortativity and a weak friendship paradox.Experimental results from Momeni  and Rabbat (2018) also show that networks with high assortativity (Collaboration in Figure 2 of the paper) have many nodes that do not exhibit friendship paradox while most nodes exhibit the paradox for networks with negative asssortativity (Friendster).Lee et al. ( 2019) also observed that the median-based and the fraction-based perception models correlate negatively with assortativity, which does not quite hold for the mean-based model.Note that the aggregate measures used by Lee et al. ( 2019) are based on binary measures corresponding to each node, which is substantially different from our setting.As argued previously, we also observe that local assortativity is negatively correlated to | log FI| very strongly for most considered networks.

Concluding remarks
We first propose a metric called the friendship index that captures the phenomenon of the friendship paradox, locally, from the perspective of an individual node.We then aggregate these metrics to globally capture the network-level friendship paradox.The arithmetic mean of the FI values, AFI, is found to have operational significance in sampling, and is also found to be mathematically suited for analysis of network models.On the other hand, the geometric mean, GFI, is found to better adjust the range of FI values about the FI value for which the friendship paradox does not occur.We lower bound the global metrics, AFI and GFI, and show that the lower bound is achieved only for the class of regular graphs where the friendship paradox does not occur, thereby showing that the proposed aggregate measures are well-behaved.We theoretically demonstrate that large random (ER) graphs with average degree kept constant exhibit the friendship paradox.However, if the connection probability is kept constant, then large ER graphs do not exhibit the paradox anymore.The results indicate that the sampling bias disappears for large random graphs as the average degree of nodes gets large or very small.We also theoretically show that the paradox exists for the BA graph and gets stronger as the size of the graph grows.This behavior is very different from global assortativity which is known to converge to 0 for both the ER and BA graphs.This is because the friendship index measures the sampling bias by choosing a random neighbor instead of a random node, and the assortativity only compares the degrees of the two endpoints of a random edge.Nevertheless, the two phenomena are not unrelated.
In fact, the local FI measure can shed light on the local assortativity of the network.Experimental results on network models and real world networks suggest that the local FI measures and local assortativity (TLA) are closely related.High values of TLA would mean that the node is connected to similar nodes and the | log FI| measure would be close to 0, while small values of TLA would mean that the node is connected to dissimilar nodes and | log FI| would be greater.More broadly, the FI measure captures the imbalance between a node and its neighbors' degrees along with the direction of imbalance, while assortativity only serves as a measure for indicating imbalance between two nodes connected by a random edge.In conclusion, although the friendship paradox and assortativity measures have very different functional forms due to their widely different motivations, they are nonetheless related to each other.Future work could focus on finding theoretical relationships between the two concepts in general graphs, or in certain classes of graphs where the analysis is tractable.

Proof of lemma 3
To prove Lemma 3, we use the Borel-Cantelli lemma (Billingsley 2008) which we state below.
Lemma 4 Let E 1 , E 2 , . . .be a sequece of events in some probability space.If the sum of the probabilities of {E n } is finite, then the probability that infinitely many of them occur is 0, i.e.,

P lim sup
For a fixed > 0 and n = 1, 2, . .., we define the following event, We will use bounding argument on these events and apply the Borel-Cantelli lemma to prove a.s.convergence.Using Markov's inequality, we have the upper bound The second term in (42) goes to 0 exponentially fast.The first term can be written as We work with the term in the inner expectation, For a given choice of q, r, s, t, we define i,z = =i,q,r,s,t χ z, , for z = q, r, s, t The first term in the product can be written as i,q − (n − 5)p + χ q,r − p + χ q,s − p + χ q,t − p .
Observe that, the terms χ q,z − p , z = r, s, t is mutually independent with respect to terms i,z − (n − 5)p , z = r, s, t.Therefore, such terms will not contribute.The product between terms of the form χ q,z − p , z = q, r, s, t will be finite and bounded by a constant say c 0 .Therefore, we can only consider the product of the terms i,z − (n − 5)p , z = q, r, s, t.There are several types of products that have to be considered separately -(a) For q = r = s = t, the contribution is 0 because all the terms are mutually independent; (b) For q = r, r = s = t, the terms i,z − (n − 5)p for z = s, t are mutually independent with respect to z = q.Hence, such terms also do not have any contribution; (c) For q = r = s = t, the two terms i,z − (n − 5)p 2 , z = q, s will have a contribution, which will be discussed later; (d) For q = r = s = t, term i,t − (n − 5)p 2 is independent of the other three terms.The expectation of this term is 0, therefore leading to no contribution.(e) For q = r = s = t, the contribution of such terms need to be considered.
Using the above insights and continuing from (44), we have holds and therefore the result follows using Borel-Cantelli Lemma.

Proof of theorem 5
We will use bounded convergence theorem (Billingsley 2008) to prove convergence in expectation of the FIs.Recall that The first term in ( 52) is upper bounded as where the upper bound follows by noting that the sum of the degree of neighbors of i is bounded by n 2 .Furthermore, we also have the upper bound

Fig. 2
Fig. 2 Results on friendship indices and assortativity of Barabasi-Albert graphs for varying values of n and m.Results on AFI, GFI and assortativity of Barabasi-Albert graphs shown for varying values of 0 < n < 10000 and m = 1, 2, 3, 4, 5. Local FI distribution shown through a heatplot for varying 0 < n < 10000 along the y-axis

Fig. 4
Fig. 4 Correlation coefficients between | log FI| and T-local assortativity for Erdos-Renyi graphs with varying probability of connection 0 < p < 1; Barabasi-Albert graphs with varying edge density 2 ≤ m ≤ 50; and Watts-Strogatz with varying rewiring probability 0 ≤ p ≤ 1 and average degree k = 2, 4, 6, 8, 10 of networks.We consider Social(S) networks like the Hamsterster, Brightkite, Douban, Gowalla and Hyves datasets; Human Social(HS) networks of Jazz musicians and the Zachary karate club; Human contact(HC) network at the ACM Hypertext conference held in Turin and the INFECTIOUS:STAY AWAY exhibit at Dublin, both in 2009; Computer(C) networks formed by Route views and the Internet topology; and, Infrastructure(I) networks like the Power grid and the Euroroad datasets.All of the network datasets were taken from the Koblenz network collection (Kunegis 2013).

Fig. 5
Fig. 5 Scatter plot between T-local assortativity and local FI for the Hamsterster network