Waiting Room Sampling for Accurate Triangle Counting in Real Graph Streams ( Supplementary Document )

In this supplementary document, we provide a pictorial description, proofs, time and space complexity analyses, descriptions of datasets, and additional experimental results, all of which supplement the main paper [1]. APPENDIX A PICTORIAL DESCRIPTION OF THE SAMPLING PROCESS Figure 5 gives a pictorial representation of the sampling process in WRS. APPENDIX B PROOFS In this section, we present the proofs of Lemma 1, Theorem 1, and Lemma 2 of the main paper. A. Proof of Lemma 1 Proof. Without loss of generality, we assume t uvw = tvw, t (2) uvw = twu, and t (3) uvw = tuv . That is, (v, w) arrives earlier than (w, u), and (w, u) arrives earlier than (u, v). If typeuvw = 1, (u, v) arrives at time k+1 or earlier. When (u, v) arrives, (v, w) and (w, u) are always stored in S . Thus, WRS discovers (u, v, w) with probability 1. If typeuvw = 2, we have tuv − twu < tuv − tvw ≤ kα. When (u, v) arrives, (v, w) and (w, u) are always stored in W . Thus, WRS discovers (u, v, w) with probability 1. If typeuvw = 3, then tuv − twu ≤ kα but tuv − tvw > kα. When (u, v) arrives, (w, u) is always stored inW , while (v, w) cannot be inW but can be in R with probability p(tuv−1) (see Eq. (1)). For WRS to discover (u, v, w), (v, w) should be inR, thus the probability is p(tuv−1) = k(1−α) (tuv−1−kα) = k(1−α) (t (3) uvw−1−kα) . If typeuvw = 4, we have tuv − tvw > tuv − twu > kα. Thus, when (u, v) arrives, (v, w) and (w, u) cannot be in W . For WRS to discover (u, v, w), both (v, w) and (w, u) should be in R when (u, v) arrives. The probability of the event is P[(v, w) ∈ R and (w, u) ∈ R] = P[(v, w) ∈ R]× P[(w, u) ∈ R|(v, w) ∈ R] = k(1− α) tuv − 1− kα × k(1− α)− 1 tuv − 2− kα , which is equal to the last case of Eq. (2). B. Proof of Theorem 1 Proof. From Eq. (2), if k(1 − α) ≥ 2, we have E[xuvw] = 1/puvw × puvw + 0 × (1 − puvw) = 1. Combining this and c = ∑ (u,v,w)∈T (t) xuvw gives E[c] = E  ∑ (u,v,w)∈T (t) xuvw  = ∑ (u,v,w)∈T (t) E[xuvw] = |T |, which proves Eq. (3) for every t ∈ {1, 2, . }. Likewise, E[xuvw] = 1 and c u = ∑ (u,v,w)∈T (t) u xuvw imply E[c u ] = E  ∑ (u,v,w)∈T (t) u xuvw  = ∑ (u,v,w)∈T (t) u E[xuvw] = |T (t) u |, which proves Eq. (4) for every u ∈ V and t ∈ {1, 2, . }. C. Proof of Lemma 2 Proof. By the definition of typeuvw, typeuvw ≥ 2 implies t uvw > k + 1. (9) First, we show the case when typeuvw = 2. Eq. (7) and Eq. (9) give t (3) uvw − 1 k × t (3) uvw − 2 k − 1 − 1 > 0 = Var[xuvw]. Second, we show the case when typeuvw = 3 and t uvw > 1 + α 1−αk. From t (3) uvw > 1 + α 1−αk, ( 1 + k t (3) uvw−1 ) α < 1 holds. This and Eq. (9) imply ( 1 + k t (3) uvw−1 )( 1− k−1 t (3) uvw−2 ) α < 1 − k−1 t (3) uvw−2 . Again, this and Eq. (9) give ( 1− k(k−1) (t (3) uvw−1)(t uvw−2) ) α < ( 1 + k t (3) uvw−1 − k−1 t (3) uvw−2 − k(k−1) (t (3) uvw−1)(t uvw−2) ) α < 1− k−1 t (3) uvw−2 . This is equivalent to (k − 1)(t uvw − 1 − kα) < (t (3) uvw − 1)(t uvw − 2)(1 − α), which is again equivalent to t (3) uvw−1−kα k(1−α) − 1 < t uvw−1 k × t uvw−2 k−1 − 1. Combining this and Eq. (7) gives Var[xuvw] = t (3) uvw − 1− kα k(1− α) − 1 < t (3) uvw − 1 k × t (3) uvw − 2 k − 1 − 1. Lastly, the same conclusion holds when typeuvw = 3 and α < 0.5. Eq. (9) and α < 0.5 imply t uvw > 1 + α 1−αk. This and typeuvw = 3 give the second case, which is proven above. Hence, Eq. (8) holds under any of the given conditions. APPENDIX C TIME AND SPACE COMPLEXITY ANALYSES In this section, we prove the time and space complexities of WRS. Especially, we show that WRS has the same time and space complexities as the state-of-the-art algorithms [2], [3]. We assume that sampled edges are stored in the adjacency list format in memory, as in our implementation used for our experiments. However, storing them sequentially, as in Figure 5, does not change the results below.