Cost-based analyses of random neighbor and derived sampling methods

Random neighbor sampling, or RN, is a method for sampling vertices with a mean degree greater than that of the graph. Instead of naïvely sampling a vertex from a graph and retaining it (‘random vertex’ or RV), a neighbor of the vertex is selected instead. While considerable research has analyzed various aspects of RN, the extra cost of sampling a second vertex is typically not addressed. This paper explores RN sampling from the perspective of cost. We break down the cost of sampling into two distinct costs, that of sampling a vertex and that of sampling a neighbor of an already sampled vertex, and we also include the cost of actually selecting a vertex/neighbor and retaining it for use rather than discarding it. With these three costs as our cost-model, we explore RN and compare it to RV in a more fair manner than comparisons that have been made in previous research. As we delve into costs, a number of variants to RN are introduced. These variants improve on the cost-effectiveness of RN in regard to particular costs and priorities. Our full cost-benefit analysis highlights strengths and weaknesses of the methods. We particularly focus on how our methods perform for sampling high-degree and low-degree vertices, which further enriches the understanding of the methods and how they can be practically applied. We also suggest ‘two-phase’ methods that specifically seek to cover both high-degree and low-degree vertices in separate sampling phases.

of a graph's collection of neighbors is higher than the mean degree of the set of the graph's vertices.
RN is, in fact, a superior sampling method to RV for finding high-degree vertices and has gained popularity in many contexts and areas of research (for example, see Han et al. 2013;Lü et al. 2016;Christakis and Fowler 2010). However, there is a cost for this gain. Specifically, every vertex that is ultimately selected requires two vertices be sampled, the original vertex that is discarded and the selected neighbor.
The concept is perhaps best illustrated with an example. Figure 1 demonstrates an experiment on a set of Barabási-Albert (BA) graphs. We fix some budget, b, that represents the number of vertices we will sample. We then sample with both RV and RN until the budget is exhausted. The x-axis represents increasing values of b. The points in the lowest curve represent the maximum degree vertex in the collection when the entire budget is spent on vertices, RV sampling. The points in the highest curve represent the maximum degree in a collection of b neighbors. This represents RN sampling, but only if we allow the entire budget to be spent on the selected neighbors. Doing so ignores any costs associated with sampling the original vertices that led to these neighbors. The points in the middle curve demonstrate what we consider a more realistic representation of RN's results. A budget b should only yield b/2 neighbors, because half of the budget had to be spent on the initial vertices that were used to acquire the neighbors. So these middle values represent the maximum degree of a collection comprised of only b/2 neighbors instead of b. This demonstrates the strength of RN as compared to RV from a new perspective, one that accounts for cost. It is worth noting that one could reasonably object and suggest the b/2 vertices that were sampled in order to acquire the neighbors should also be included in the final collection for a total size equal to the sampling budget. This alternative sampling method, which we call RVN , is something we analyze later in this paper. For this particular example we will demonstrate that it gives negligible benefit.
In order to analyze RN from a cost-based perspective, we will define costs related to the processes of sampling and selecting vertices. These costs will provide a model that can be used to analyze the true value of RN. In addition, the introduction of costs suggests alternative sampling methods that may maximize performance for particular cost considerations. We will present a number of these alternatives here and provide Fig. 1 Max-degree in a collection of selections in BA graphs for a budget b of how many vertices to sample an in-depth analysis of their advantages and disadvantages vis-á-vis the different costs. This paper is an extension of our previous work (Novick and Bar-Noy 2021) where we first introduced our cost model. We build on this work here by adding additional results for many of the new sampling methods introduced there. We also provide previously omitted analyses that explore the RkN sampling method and the two-phase methods we introduced in that paper.

Terminology and notation
When we refer to the set of vertices in a graph, the term 'vertex' retains its traditional meaning. However, when we refer to a single entity sampled from a graph as a 'vertex' , we specifically mean that it was sampled from the collection of vertices and not from the collection of neighbors of a specific vertex. We will use the term 'neighbor' to refer to a sample taken from one vertex's neighbors.
In this paper we use abbreviations to refer to sampling methods. So for example, we will use RV to refer to random vertex sampling, RN to refer to random neighbor sampling, etc. However, we will also use these abbreviations in mathematical expressions such as equations and inequalities. For example, the inequality RN ≥ RV would mean that RN is a superior or equivalent sampling method to RV in terms of finding high degree vertices. We rely on context to clarify the meaning of every abbreviation. Also, while we will employ multiple metrics of a sampling method's success, when the method is not specified the assumed metric should be the expected degree of a single vertex returned by the method. Therefore, unless a different metric is specified, the inequality RN ≥ RV means E[RN ] ≥ E[RV ] , or "The expected degree of a vertex sampled by RN is greater than or equal to the expected degree of a vertex sampled by RV".

Preliminary
There are a few characteristics of RN that bear mentioning as foundational to our research. First, it is worth recognizing that the friendship paradox does not actually prove that RN is superior to RV. This is demonstrated by Kumar et al in an earlier draft of Kumar et al. (2021) that can be found on Vineet Kumar's webpage in the Yale University website. Construct a graph comprised of two separate subgraphs, one of size i and one of size j with i > j ≥ 2 . The friendship paradox applies in this graph because there is a variance of degree so the mean degree of neighbors is strictly greater than the mean degree of the graph. Yet, by symmetry, we know that RN = RV in this graph. In reality, the true sampling method suggested by the friendship paradox would be random edge (see Leskovec and Faloutsos 2006) which we compared to RN in Novick and BarNoy (2020). However RN's superiority to RV has been demonstrated in Cohen et al. (2003) and Momeni and Rabbat (2018) among others. We have also constructed a simple proof that RN ≥ RV which we later found in both Kumar et al. (2021) as well as the aforementioned draft where it is further attributed to a comment on an online article in the New York Times's website. However, to our knowledge this proof has never appeared in a peer-reviewed publication so we will include it as an appendix to this paper.
Two other areas of interest are RN's performance in Erdős Rényi (ER) graphs (Erdos and Rényi 1960) versus Barabási Albert (BA) graphs (Barabási and Albert 1999), and RN's performance for finding high-degree vertices, which we will informally refer to as 'hubs' , versus finding low-degree vertices, which we will informally refer to as 'leaves' . We will explore both of these topics here.

RN in ER and BA graphs
In Novick and BarNoy (2020) we demonstrated experimentally that RN outperforms RV significantly in BA graphs while it is of minimal benefit in ER graphs. We suggest that there is a connection between the power-law distribution of degree (Faloutsos et al. 1999) that characterizes BA graphs and RN's performance in these graphs. We will informally explain this connection here.
The connection between degree-homophily and RN has been discussed in Novick and BarNoy (2020) and Kumar et al. (2021). In Novick and BarNoy (2020) we used the well known measure of assortativity (Newman 2002) (also Piraveenan et al. 2010;Thedchanamoorthy et al. 2014;Jackson 2019;Pal et al. 2019), whereas Kumar et al argue for their own measure, inversity. But here we will use the term assortativity to loosely refer to both measures as inversity correlates strongly with assortativity despite the significant differences the authors highlight in their paper. Intuitively, any difference between RN and RV clearly requires at least some amount of disassortativity in order for the neighbor to differ from the vertex, and less assortativity in fact increases this effect. Newman demonstrated that both ER and BA graphs tend towards zero assortativity (Newman 2002), neither positive or negative. However, research has shown that this value in BA graphs is an aggregate measure of two sharply contrasting types of edges (Bertotti and Modanese 2019). A number of leaves are highly assortative, connected to other leaves like themselves. However, the hubs connect to many leaves as well, and these connections are extremely disassortative. This suggests an intuition for RN's strong performance in BA graphs. The power-law distribution implies that a randomly sampled vertex is far more likely to be a leaf than a hub. However, exchanging it for one of its neighbors has a reasonable probability of increasing the resulting degree because of the significant likelihood that the leaf is disassortatively connected to a hub.
In truth though, the power-law distribution directly suggests the existence of the disassortative connections as well. The famous Erdős Gallai (1960) and Havel-Hakimi (1955;1962) theorems are both in part predicated on a simple premise. If a graphic degree sequence is partitioned into high-degree hubs and low-degree leaves, any edge endpoints of the hubs that cannot be satisfied by connecting to other hubs must be satisfied by connecting to leaves instead. This necessity definitionally translates into some amount of disassortativity. While a comparatively large amount of leaves does not necessarily imply that the hubs cannot be entirely interconnected among themselves, a typical power-law distribution will have the number of hubs being far fewer than their accumulated degrees and this explains why BA graphs in particular show a strong performance for RN over RV.

RN's inefficiency in finding leaves
This understanding of the mechanics of RN's success in BA graphs explains another important characteristic of RN which is its inferiority as a sampling method for selecting leaves in a graph. While a single sampling of RV will find any given leaf with probability 1/n, in order for RN to select a given leaf, it would have to find it via one of its neighbors, a particularly poor strategy when the number of neighbors is small, even worse when it neighbors a hub that neighbors so many other vertices.

Hubs versus leaves in a star graph
As an example, consider the star graph of n vertices. The star graph can be used as an exaggerated illustration of a power-law distribution as it has very few hubs (1) of very high-degree ( n − 1 ), and very many leaves ( n − 1 ) of very low-degree (1). It is therefore often useful to analyze a star graph in order to explore a feature of BA and other powerlaw graphs.
When sampling from the star graph with RV, all vertices have an equal probability of being sampled, P(v i ) = 1 n . The expected number of samples required to find the center is E[C] = n , and the expected number of samples required to find all leaves is E[L] = n(H n − 1) = �(n log n) per the coupon collector's problem.
Contrast this with sampling using RN. The probability of selecting the center is P(C) = n−1 n and the probability of selecting a leaf vertex is P(L) = 1 n . The expected number of samples required to find the center approaches 1 at E[S c ] = n (n−1) , but the expected number of samples required to collect all leaves is

Hubs versus leaves in BA and ER graphs
We further demonstrate this phenomenon with a simple experiment. We repeatedly select vertices with both RV and RN and track how many iterations of each sampling method are required to select the top x% of the vertices ranked in descending order of degree. The aggregate results for repeated experiments on sets of BA and ER graphs is shown in Fig. 2. Because RV is naïve sampling, it finds the entire graph with �(n log n) samples per the coupon collector's problem. RN, on the hand, finds hubs very quickly, but struggles greatly to complete the collection and find the lowest-degree vertices in the graph. As RN ≥ RV , the phenomenon is still true in ER graphs. But it is comparatively muted for the reason we discussed. BA graphs have a strong element of disassortativity between hubs and some connected leaves, while ER graphs are more homogeneously unassortative.

Sampling costs-C v and C n
The main focus of our research is a thorough analysis of costs that are associated with RV, RN, and the other sampling methods that we will introduce. In our introduction we mentioned the most obvious cost, sampling a vertex. In many contexts this cost would be equivalent for sampling a vertex from the graph and for sampling a vertex from the neighbors of an already sampled vertex, and we will in fact make this assumption in some of our analyses. However, we suggest that this may not always be the case. Sampling a neighbor my be less expensive as the set from which the neighbor will be sampled is smaller. Or, perhaps there is a privacy concern related to learning connections that would apply only to sampling a neighbor which would make sampling a neighbor more expensive. We therefore generalize the sampling costs to two distinct costs, C v , the cost of sampling a vertex, and C n , the cost of sampling a neighbor.

Critical C n
Let us fix C v = 1 so that we are expressing both C n and total cost in terms of C v . We seek a 'critical C n ' value ( CC n ), that is a value for C n where RV and RN perform equally well in light of their associated costs. Knowledge of a such a value for a specific graph would allow a proper evaluation of whether or not RN should be used instead of RV. CC n is, ultimately, a measure of RN's superiority over RV as the higher the degree of a selected neighbor is compared to that of a sampled vertex, the more one would be willing to pay in order to sample the neighbor. Following the same logic, finding some scenario where CC n < 0 would indicate that (somehow) RV > RN.

CC n for expected degree
Obviously, in order to quantify CC n , we first need to define what metric of success we are using to quantify the respective performances of RV and RN. We will first focus on the expected degree of a vertex/neighbor selected by each. We have fixed C v = 1 , so a vertex selected by RV, with its corresponding expected degree, requires one cost unit. A neighbor selected by RN costs C v + C n = 1 + C n . Therefore, the CC n value that equates the two methods in terms of cost for their respective expected degrees can be calculated as follows: There is a strong intuition to this expression. The ratio RN RV should capture how much more someone would be willing to pay for a neighbor over a vertex. Also notice that, if RN RV < 2 , CC n < 1 . This means that if C v = C n , which would arguably be our natural Required iterations of RN and RV for finding the top x% of high-degree vertices assumption in most scenarios, sampling with RN would only be preferred to sampling with RV if RN is twice as strong as RV for the desired metric. Otherwise, a more robust cost model would be required in order to justify the intuitive appeal of RN sampling.

CC n in canonical graphs
We will apply Eq. 2 to a few famous graph types. d-regular Graph In any perfectly assortative graph RN reduces to RV and CC n = 0 . The intuition is obvious. In a graph where RN offers no advantage, any positive cost would be wasted.
Star Graph RV in a star graph is equal to 2(n − 1)/n and RN is equal to ((n − 1) 2 + 1)/n , so As n increases, CC n − → n . This is of course the same bound as the degree of the hub. The expression's similarity to the degree of the hub reflects the high C n price worth paying for taking the leaf vertex one would initially sample with high probability and exchanging it for the hub.
Complete bipartite graph Assume we have a complete bipartite graph with sides L and R. All vertices in L are of degree R, and all vertices in R are of degree L. RV = (LR + RL)/(L + R) , and RN = (L 2 + R 2 )/(L + R) . Therefore, in a complete bipartite graph, CC n = (L 2 + R 2 )/2LR − 1.

CC n for different sampling amounts and results
Our second exploration of CC n will define it as a function of either how many samples are taken or a function of some desired result. Importantly, this means that these versions of CC n will not be fixed for a graph. This is an important use of CC n because it demonstrates how RN's value can fluctuate even for the same graph depending on how long it is used or what the desired outcome is. For these analyses we will define three metrics to quantify the success of a sampling method: 1 Total Degrees-We repeatedly sample vertices from a graph with replacement and track the sum of the degrees of all selected vertices. CC n for this metric should converge on the CC n value based on expected degree defined in Eq. 2. 2 Total Unique Degrees-We repeatedly sample vertices from a graph with replacement and track the sum of the degrees of any new vertices selected. Here we will present resulting values as a percentage of the sum of all degrees in the graph. 3 Max Degree-We repeatedly sample vertices from a graph with replacement and track the maximum degree vertex selected. Here we will present resulting degree values as a percentage of the max-degree vertex in the graph.
The second metric corrects for the inclusion of duplicates in the first metric. If our goal is to immunize a network, for example, we probably can't take credit for inoculating the same vertex twice. We include the first metric mostly for comparison, but we still suggest it might be useful in some scenarios. For example, in a situation where the goal of (3) sampling is information dissemination, our goal would be to reach as many high-degree vertices as possible in order to spread the information to their neighbors. But we might still appreciate selecting the same vertex multiple times as each selection reiterates the importance of the information and therefore increases the likelihood of it being shared. In order to calculate CC n as a function of sampling iterations, let RV(i) and RN(i) be the resulting values, according to one of the success metrics, of selecting i vertices with RV and with RN respectively. The cost of i vertices selected with RV is i and the cost of i neighbors selected with RN is i(1 + C n ) . Therefore, for any i, we can calculate CC n (i) as follows: To calculate CC n as a function of resulting values, assume some resulting value V requires i sampling iterations of RV and j sampling iterations of RN, or V = RV (i) = RN (j) . For this value V, we can calculate CC n (V ) as We experimented with ER and BA graphs with varying parameters as well as the graphs of multiple real world networks taken from the Koblenz online collection (Kunegis 2013). Figure 3 shows results from some of the experiments on BA graphs. These results were fairly typical for ER and real world graphs as well.
The results for total degrees correlated with RN /RV − 1 as predicted. For the other two measures, the results are somewhat more interesting. The bottom two charts measure success by max degree. The first chart shows calculated values of CC n for samples taken. CC n starts off high, because RN gives a higher maximum degree than RV. However, as we continue to take samples, RV will eventually find the max-degree vertex in the graph, and any further sampling for either method accomplishes nothing. This explains the (roughly) monotonically decreasing values of CC n , ultimately converging on 0. The second chart plots CC n as a function of the percent of the maximum degree vertex being sought. This plot is noisier because sampling for a max degree vertex will not normalize as easily with repeated experiments, but the generally increasing nature of the function shows that RN has more relative value compared to RV as the degree of the maximum degree vertex being sought increases.
The middle charts are measuring the sum of all unique degrees accumulated. The chart on the left sees CC n steadily decrease as the hubs have already been selected and RN's value is diminishing. Interestingly, CC n is actually negative for a range of values. This corresponds to the point where RN is continuing to sample hubs that have already been selected and therefore has no value, but RV is still finding new leaves. In this range RV > RN which explains the negative CC n value. Then RV also finds all of the vertices it will find and CC n levels out at 0, neither method offers any advantage. The chart on the (4) right shows a roughly monotonically decreasing CC n . As we seek a higher and higher percentage of the total degrees in the graph, RN's value over RV decreases because of its failure to find leaves. Eventually, when enough of the degrees are being sought, CC n becomes negative because of the difficulty it has finding leaves while RV is continuing to sample all vertices with uniform probability.

Selection costs ( C s ) and RVN sampling
In our introductory example in Fig. 1 we mentioned that, given a budget b which we would use for sampling, and assuming C v = C n = 1 , we could collect at most b/2 neighbors, but we could also retain the b/2 vertices we used as a means of collecting the neighbors and our final collection would be of size b. We refer to the sampling method where we select both the originally sampled vertex as well as its sampled neighbor as RVN. The obvious explanation for why one would opt for RN over RVN is a cost that would be associated with selecting a vertex, which we will call C s . Even having spent C v + C n to sample the vertex and its neighbor, we select only the neighbor in order to capitalize on the C s we spend to do so.
The inclusion of C s in our model gives us a mathematical language for explaining priorities in a particular sampling endeavor. For example, one could ask why the initial paper of Cohen et al. (2003) ignores cost in the context of network immunization. By defining C v and C n , we can offer a formal explanation by saying that perhaps C n ≪ C v , and the extra cost of sampling the neighbor can be ignored. However, the far more likely explanation is that C s ≫ C v ≈ C n . If the immunizations are in very short supply, it is wasteful to administer one to the low-degree vertex instead of paying an additional C v + C n to find another high-degree neighbor. Even without generalizing sampling costs to two separate values, the evaluation of the respective costs of sampling versus selecting in a given scenario will provide an indication of which sampling method to choose.

RVN versus RN
We will now present a few comparisons between RVN and RN. Like the CC n value we sought for RV and RN, we will discuss a similar value that equates sampling costs with selection costs. We will also discuss why the two sampling methods are roughly the same for the metric of max-degree, and explore how RVN compares to RN for collecting leaves.

Sampling costs versus selection costs and critical α
Let us ignore the direct comparison between C v and C n and simply define α = C v + C n so that α is the collective cost of sampling the vertex and neighbor from which we will select either both or just the neighbor by itself. We obviously assume a preference for spending the lower expense in order to capitalize on the higher expense. Therefore, if α < C s we are more likely to sample again in order to spend C s on the higher-degree neighbor, and if α > C s we are more likely to spend C s on selecting the vertex in order to capitalize more on the α we have already spent. But of course the direct comparison of RV and RN's respective performances influences this decision as well.
We will define a 'critical α ' ( Cα ) as the α value for which RVN and RN are equal and use it to relate α to C s and the RN/RV ratio.

Cα for expected degrees
We will calculate Cα using the expected values of RVN and RN. We will compare a single selection of RVN to a single selection of RN. Every odd selection of RVN is the selection of a vertex and every even selection of RVN is a neighbor, so we will express the expected degree of an average selection of RVN as RVN = (RV + RN )/2 . Therefore This is the same expression as the one we found for CC n in Eq. 2. We see that a stronger RN as compared to RV leads to a higher Cα , that is α must be significantly larger than C s for the selection of the first vertex to be worthwhile. As RN weakens vis-á-vis RV, Cα decreases and the importance of capitalizing on α increases relative to the importance of capitalizing on C s .

Max degree for RN and RVN
It is worth explaining why RVN and RN give comparable results when seeking to maximize the maximum-degree selected. The first chart in Fig. 4 is a direct comparison of RN and RVN . It shows that selecting the vertex gives negligible benefit over selecting the neighbor by itself. The second chart reproduces the chart from our introduction in Fig. 1 and the third chart shows the same experiment using RVN instead of RN as the fair-cost method. Again, the gain in maximum degree is negligible. The obvious explanation for this is that the maximum degree vertex is so likely to be found in the collection of selected neighbors that selecting the vertex fails to raise the maximum degree in a significant way. To corroborate this, we conducted experiments that test this exact hypothesis. We repeatedly sampled with RVN in sets of ER and BA graphs with various parameters and tracked the percent of times the maximum degree vertex in the collection was a neighbor. The results are summarized in Table 1. Clearly even in ER graphs, but especially in BA graphs, there is a very high probability of finding the maximum degree entity among the neighbors. Some more extreme values for n and/ or µ may markedly change the characteristics of the graphs from those that typify the model, but the moderate values give a strong indication of why RVN is not significantly better than RN for the metric of maximum degree.

RVN versus RN for selecting hubs and leaves
One area worth exploring in RVN sampling is how it addresses the specific weakness of RN for finding leaves. Presumably, selecting vertices alongside the neighbors should provide additional coverage of the graph, and specifically cover leaves. Figure 5 repeats our earlier experiment (Fig. 2) for assessing performances for hubs and leaves, but it includes RVN and it breaks down the results by costs. The top row demonstrates results that are fairly obvious. Results for C v are on the left. Clearly, when C n = 0 , RVN adds to the performance of both methods for no cost. Similarly, if C v = 0 and we only focus on C n as we do in the chart on the right, RV gives unrealistic results. The third chart is more meaningful. As before we ignore a direct comparison between C v  and C n by assuming they are equal and track the total costs of the two combined. Here we see that RVN overemphasizes hubs enough to be superior to RV for hubs but inferior for leaves, but it still collects leaves far more quickly than RN which always selects neighbors and ignores vertices. The fourth chart shows results in terms of C s . Ignoring sampling costs makes this chart mostly irrelevant for an actual analysis, but it does allow us to focus on how quickly vertices are sampled as that is when C s will be paid in order to select them. A higher C s cost for hubs indicates that more leaves have been selected along with the selected hubs. The chart demonstrates that the more a method focuses on hubs, the more leaves are ignored while selecting the hubs, whereas methods that focus on leaves more find them and pay C s for them sooner. The heatmaps in Figs. 6 and 7 give a perspective on how the significance of the costs manifest when hubs or leaves are sought. Figure 6 shows the total cost of selecting the top .1 and top .9 of the graph for RV, RN, and RVN . The x axes represent C v costs in the range of 0 ≤ C v ≤ 1 and the y axes represent C n costs in the range of 0 ≤ C n ≤ 1 . For RV, C n is irrelevant and regardless of the percent the total cost increases with C v alone. Because C s is not a factor, RN and RVN appear the same. Total cost appears to be slightly more influenced by C n , but generally influenced by both. In Fig. 7, the x axes represent C s costs and the y axes represent α costs, the collective cost of sampling a vertex and neighbor pair and ignoring how this cost is distributed between the two. RV is a function of both sampling and selection costs regardless of whether it is hubs or leaves being sought. In both RN and RVN , finding hubs is mostly a function of selection costs, whereas finding leaves is more greatly influenced by sampling costs.

RkN sampling
The sampling costs C v and C n suggest another alternative sampling method. As noted, RN is predicated on the understanding that exchanging the initially sampled vertex for its neighbor raises the expected degree. If we completely ignore C v , it is perhaps not illogical to take our second vertex by repeating the process again, sampling a new vertex and then selecting one of its neighbors. But if C v is significant, it makes sense to sample multiple neighbors of the same vertex in order to capitalize on the C v that was already spent instead of selecting only the one neighbor and then immediately paying C v again.
We call this alternative method RkN sampling. We select k random neighbors of every randomly sampled vertex. RkN is a generalization of RN with RN being the specific case of k = 1 . We can quantify the cost of each neighbor selected with RkN as C v /k + C n rather than the C v + C n cost of RN.
We conducted many repeated experiments with BA graphs and found that the average degree of all kth selected neighbors typically decreases as k increases. This is corroborated by the cost analysis shown in Fig. 8. The first chart shows the significant decrease in C v for accumulating various percentages of the total unique degrees in the graph as k increases. However, the second plot shows that C n decreases far less rapidly, because selecting additional neighbors of the sampled vertex will not have a positive effect on the expected degree. In fact, the third plot shows that C s actually increases slightly as more neighbors of lower degree are being selected. Ultimately, if the general cost of sampling is significant, RkN appears to a be a useful sampling method. But theoretically, if C v = 0 , it is probably worth sampling a new vertex and selecting its first neighbor instead of selecting additional neighbors of the first sampled vertex. This probably also reflects somewhat on the lopsided distribution of degree in BA graphs. The initially sampled vertex is likely a leaf, but the leaf is not necessarily connected to any hubs, and if it is it is likely connected to a very small number of them. While increasing k for a leaf that is connected to a hub does increase the likelihood of selecting the hub, it only adds additional leaves when the initially sampled vertex is an assortative leaf. And very large values of k will have even less of an effect because they will only be relevant when the initially sampled vertex is a hub and it will likely result only in the collection of additional leaves. Because of the disparity in degree between leaves and hubs, even a modest increase in the probability of selecting a hub can raise Fig. 6 Heat maps representing the effects of C v and C n (sampling) costs for the top 10% and 90% of high-degree vertices the average degree significantly. But when the focus is C n or C s and not C v , the oversampling of neighbors does not have a strong positive net effect.

RVkN sampling
In the same way we tweaked RN with RVN , we are able tweak RkN by selecting the initial vertex along with the k neighbors, RVkN sampling. In scenarios where C s is negligible and sampling costs are the sole consideration, the initial vertex should clearly not be discarded. Also, as k increases and the average neighbor degree decreases, the initial Fig. 7 Heat maps representing effects of sampling ( C v and C n ) and selection ( C s ) costs for the top 10% and 90% of high-degree vertices Novick and Bar-Noy Applied Network Science (2022) 7:34 vertex may be of similar degree to many of the neighbors and may as well be selected. We will include RVkN in our later analyses.

Full fair-cost analysis
We are now ready to perform a full analysis of our sampling methods and costs. We will start with a theoretical analysis on a star graph to accentuate the strengths and weaknesses of our methods in regard to selecting hubs and leaves, then do an experimental analysis on BA graphs. Below is a summary of the methods discussed so far: • RV -Random Vertex Sampling. The naïve method of sampling and selecting a vertex at random from the set of vertices in the graph. Every selected vertex costs C v + C s .  (2003). We sample a vertex, then sample one of its neighbors and select the neighbor. The cost of every neighbor is C v + C n + C s . • RVN -We sample a vertex, sample one of its neighbors, then select both. The average cost of a selection is (C v + C n )/2 + C s . • RkN-We sample a vertex, then sample and select k of its neighbors. The cost of every neighbor is C v /k + C n + C s . • RVkN-We sample a vertex and k of its neighbors, selecting all samples. The cost of a vertex is C v + C s , the cost of a neighbor is C n + C s , and the cost of an average selection is (C v + kC n )/(k + 1) + C s .

Fair-cost analysis in the star graph
As noted above, analyzing a star graph theoretically can highlight important strengths and weaknesses of a sampling method because of its exaggerated distinction between the lone hub and the n − 1 leaves. It should be noted though, that the analysis of a star graph is not a thorough examination because many concepts do not apply due to the graph's simplicity. For example, we will not include C s in this analysis as this value will always be 1 or n − 1 for the two distinct collections of a hub and all leaves. Furthermore, RkN is of no interest as k only matters when we sample the hub as our initial vertex, and when we do the only logical value of k is n − 1 . With these excluded concepts noted, we present the expected C v and C n costs for selecting the hub and all leaves in Table 2.
For RV, the expected number of samplings required to obtain the center is n, and getting all leaves is n log n . These are all C v costs, there are no C n costs. RN finds the center with just over 1 sampling that incurs identical costs for C v and C n . As we noted, though, it is very weak for finding leaves, requiring n 2 log n units of both C v and C n . In the star graph, RVN is guaranteed to acquire the center after one iteration at a cost of C v + C n . But it pays C n costs in order to acquire leaves whereas RV does not.

Experimental cost analysis on BA graphs
Our second analysis involved generating a set of BA graphs and recording the average costs for acquiring some percent of the graph. Here we have to note another oversimplification of the star graph, the clear delineation between hubs and leaves. In a BA graph this will of course not be as well defined. Our examination will consider the top 5% of high-degree vertices to be hubs. For this experiment we used BA graphs with n = 4000 , m = 3 . The results are presented in Table 3. Table 2 An analysis of costs C v and C n in a star graph of n vertices

Method
Selecting center Selecting all leaves RV n 0 n log n 0 RN n/(n − 1) n/(n − 1) n 2 log n n 2 log n RVN 1 1 n log n n log n Novick and Bar-Noy Applied Network Science (2022) 7:34 The top section demonstrates the characteristics of RV, RN, and RVN that we have discussed. RN does far better than RV for hubs, far worse for leaves. And RVN does better than both methods in most categories, but spends more units of C s on hubs because of the additional leaves it selects as a result of retaining the initially sampled vertex. The fact that RVN has lower sampling costs for hubs implies that the initially sampled vertices contain some hubs that are retained. But C s is still higher because of the leaves that are selected.
We also include results for RkN and RVkN . As discussed, increases in k have a strong impact on C v , but mixed results on the other costs. Again, the initially sampled vertices include some hubs, so RVkN reduces C v and C n over RN for lower values of k.

Two-phase sampling methods
The weakness of RN for finding leaves suggests an entirely new category of sampling methods. We could use a method like RN in a first phase, trying to collect hubs, but then switch to RV in a second phase in order to collect the leaves that RN typically struggles to sample. We will call this method RN-RV. Significantly though, any of the RN variants we introduced here can be used for the first phase for the sake of the advantages discussed. We can therefore add the following new, 'Two-Phase' sampling methods: • RN-RV -A two-phase method that starts with RN to find hubs, then switches to RV to find leaves. • RVN -RV -A two-phase method that seeks to find leaves sooner by selecting vertices along with neighbors in the first phase. • RkN-RV -A two phase method that tries to find hubs faster by sampling and selecting more neighbors per vertex in the first phase. • RVkN-RV -A combination of the previous two methods that selects the sampled vertex along with the k neighbors in the first phase before switching to RV. Table 4 shows the results for RN-RV and RVN-RV in the star graph (as noted, RkN and RVkN are uninteresting in the star). The expected iterations for RN-RV to find the hub approaches 1 and RVN-RV will always find it in its first two selections. After that, the second phase finds the leaves for n log n units of C v as expected, but saves the C n costs of a one-phase method because it stops sampling neighbors in the second phase.

Two-phase methods in BA graphs
We will now explore the two-phase methods experimentally in BA graphs. Here we will once again have to note a few details of this analysis that do not apply to the star graph. The most obvious question that arises for a two-phase method would be the point at which the method would switch phases. And of course this will largely depend on how we delineate between hubs and leaves. Notice again how both of these issues are trivial in the star graph as discussed above. There is only one hub, and both phase-one methods find it after one iteration with at least high probability, so we can choose a number of phase-one iterations that provides a satisfactory probability of selecting the hub and then switch to RV.
Another issue that arises is the desired coverage for each set of vertices. If the intention is to select every hub in the first phase and then every remaining leaf in the second, two phase methods offer negligible benefit over RV by itself. As effective as RN or any variant is, it will almost certainly miss some hubs and then RV will have to find them. And if RV has to find all leaves, it will probably find most of the hubs already selected in the first phase while it is sampling. We therefore define a parameter ρ with 0 < ρ < 1 where ρ h would be the percent of hubs that need to be selected in the first phase, and ρ l the percent of the leaves before terminating.
Our approach to simplify this problem and give meaningful results is as follows. First, we will generalize ρ = ρ h = ρ l , assume that we desire the same coverage for both hubs and leaves. We will also work with the same delineation between hubs and leaves that we employed previously in BA graphs, a .05/.95 split. Rather than specifying a switching point and testing whether or not we have acquired the requisite ρ percent, we will run each phase until we have selected ρ of the desired vertices and report the costs incurred in each phase. Table 4 An analysis of costs C v and C n in a star graph of n vertices for two-phase methods

Method
Selecting center Selecting all leaves RN-RV n/(n − 1) n/(n − 1) n log n 0 RVN-RV 1 1 n log n 0 Also, because the connections are more complex than in a star graph, RkN sampling is again of interest, so we will include RkN-RV and RVkN-RV in this study. Table 5 summarizes costs for ρ ∈ {.7, .8, .9}.
As expected, RN outperforms RV for hubs and RV is better for leaves, while RVN is a strong compromise for sampling costs but not for C s . As before we see that increases in k give diminishing returns in C v for both RkN-RV and RVkN-RV, and do not meaningfully impact C n or C s . And we see that RVkN-RV reduces sampling costs over RkN-RV. The results also corroborate our explanation that, while RkN does find hubs faster than RN, many of its selections would have been found as vertices rather than neighbors. This is why RVN-RV pays a higher C s price than RVkN-RV in phase 1 and lower in phase 2, because so many of the neighbors that would have been selected along with the first vertex by increasing k, are selected as vertices anyway by RVN , to the point where it makes more selections. Table 5 Experimentally calculated C v , C n , and C s costs of two-phase sampling methods in BA graphs Phase 1 Method Phase 1 Phase 2 (RV) Total costs