# Probability that there is an edge between two nodes in a random geometric graph

I am new to Random geometric graphs. I have a graph with vertices being generated uniformly over $[0,1]^2$. There is an edge between two vertices if the Euclidean distance between the two vertices is $\le r$. I am trying to find the probability of this. For that I am starting as below: $$P(\mbox{two random nodes have an edge between them})=P((x_i-x_j)^2+(y_i-y_j)^2\le r^2)$$ I am taking the nodes to be uniformly and independently generated over $[0,1]^2$, hence $p(x_i)=p(x_j)=p(y_i)=p(y_j)=1$ and they are all independent. Using these and after some calculations I found that the probability is $r^4$. But I could not get any reference where I can verify this result and I have a feeling that I am wrong. So, can anyone kindly comment on this result and please help correct it if it is wrong? Thanks in advance.

EDIT: The following is my calculations that led to the result $r^4$. Please suggest corrections if something is wrong.

$$P((x_i-x_j)^2+(y_i-y_j)^2\le r^2)\\ =\int\int\int P((x_i-x_j)^2+(y_i-y_j)^2\le r^2|x_i,y_i,x_j)p_{x_i,y_i,x_j}(x_i,y_i,x_j)dx_idy_idx_j\\ =\int_{|x_i-x_j|\le r}\int_{|y_i-y_j|\le \sqrt{r^2-(x_i-x_j)^2}}dx_i dx_j dy_i dy_j$$ Now using the transformations $X=x_i-x_j,\ Y=y_i-y_j$, I rewrote the integral as $$\frac{}{}\int_{-r}^{r}\int_{\sqrt{r^2-X^2}}^{\sqrt{r^2-X^2}}XY dY dX=r^4$$

Note: I do not want the probability that a particular node has an edge with some other node which is easily seen to be $\pi r^2$.

• "Using these and after some calculations I found that the probability is $r^4$." Very curious to see these calculations I am, hmmm? To begin with, the result depends on the number of points. – Did Mar 23 '14 at 17:23
• Some (major) problems with the computation in your Edit: it does not take into account the boundaries of the square; it considers two points, not whatever number of points are thrown into the square; dimension arguments show that $r^4$ is absurd, for two points the thing should scale as $r^2$ when $r\to0$. – Did Mar 23 '14 at 18:16
• Okay, so should I better say that I am calculating the probability that there is an edge between two randomly selected nodes? – Samrat Mukhopadhyay Mar 23 '14 at 18:25
• Depends on what you want to do. The post does not suggest that you are asking for what the Edit tries to do. (By the way, the "Note" at the very end is wrong as well.) – Did Mar 23 '14 at 18:26
• I edited my question. – Samrat Mukhopadhyay Mar 23 '14 at 18:31

After some hesitations, it seems that one is actually throwing two points uniformly and independently in $[0,1]^2$ and that one asks for the probability $p(r)$ that their distance is at most $r$. Thus, $$p(r)=\iint_{[0,1]^2}A(x,r)\,\mathrm dx,$$ where $A(x,r)$ is the area of the set $$[0,1]^2\cap D(x,r),$$ where $D(x,r)$ is the full disk $$D(x,r)=\{y\in\mathbb R^2\mid\|y-x\|\leqslant r\}.$$ The computation of the exact value of $p(r)$ is tedious (except when $r\geqslant\sqrt2$ since then $p(r)=1$) but one can note that, for every $r\leqslant1$, the set $[0,1]^2\cap D(x,r)$ is at most $D(x,r)$, whose area is $\pi r^2$, and at least a quarter of $D(x,r)$. Thus, $$\tfrac14\pi r^2\leqslant p(r)\leqslant\pi r^2.$$ Recall that this holds only for $$0\lt r\leqslant1.$$
{"ft_lang_label":"__label__en","ft_lang_prob":0.8974175,"math_prob":0.9996829,"size":1449,"snap":"2021-31-2021-39","text_gpt3_token_len":460,"char_repetition_ratio":0.09965398,"word_repetition_ratio":0.0,"special_character_ratio":0.32781228,"punctuation_ratio":0.083850935,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":1.0000039,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2021-08-05T21:00:06Z\",\"WARC-Record-ID\":\"<urn:uuid:4cb27781-7196-45c7-8966-6cde722f89e5>\",\"Content-Length\":\"168963\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:f8711a56-c537-44cc-b7c1-7c88a393a5d3>\",\"WARC-Concurrent-To\":\"<urn:uuid:7b6ccf97-1c55-47c8-bbe4-95219eb27c0d>\",\"WARC-IP-Address\":\"151.101.129.69\",\"WARC-Target-URI\":\"https://math.stackexchange.com/questions/723538/probability-that-there-is-an-edge-between-two-nodes-in-a-random-geometric-graph\",\"WARC-Payload-Digest\":\"sha1:WIBMQZIZUL3CTOQNYQKG6LOXCXJCFRX7\",\"WARC-Block-Digest\":\"sha1:GAQ4X4ARP3LZBVBHFQ2PC3IRZQ453XTL\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2021/CC-MAIN-2021-31/CC-MAIN-2021-31_segments_1627046157039.99_warc_CC-MAIN-20210805193327-20210805223327-00474.warc.gz\"}"}