# sample\_pa() arguments

**URL:** <https://igraph.discourse.group/t/sample-pa-arguments/1786>\
**Category:** Usage\
**Tags:** R\
**Created:** [21 March 2024 08:04 UTC](https://igraph.discourse.group/t/sample-pa-arguments/1786 "2024-03-21T08:04:26Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![zachhleung](https://avatars.discourse-cdn.com/v4/letter/z/ecae2f/32.png) [@zachhleung](https://igraph.discourse.group/u/zachhleung)\
**Post date:** [21 March 2024 08:04 UTC](https://igraph.discourse.group/t/sample-pa-arguments/1786/1 "2024-03-21T08:04:26Z")

</div>

Hi, can I ask for sample\_pa(), is my interpretation of the meaning of the following arguments sensible? the documentation is abit vague: [R: Generate random graphs using preferential attachment](https://search.r-project.org/CRAN/refmans/igraph/html/sample_pa.html)

power → refers to **the relationship** that the probability of existing nodes gaining new connections is dependent on the their current number of connections (degree).

m → refers to the number of edges added that connects newly acquired nodes to existing nodes, as the network is growing

thanks

---

<div class="post-metadata">

**Author:** ![szhorvat](https://yyz2.discourse-cdn.com/free1/user_avatar/igraph.discourse.group/szhorvat/32/3_2.png) [@szhorvat](https://igraph.discourse.group/u/szhorvat)\
**Post date:** [21 March 2024 11:55 UTC](https://igraph.discourse.group/t/sample-pa-arguments/1786/2 "2024-03-21T11:55:52Z")

</div>

> [@zachhleung](#):
>
> power → refers to **the relationship** that the probability of existing nodes gaining new connections is dependent on the their current number of connections (degree).

Quoting from the documentation:

> and \alpha and a are parameters given by the `power` and `zero.appeal` arguments.

This, with the previous formula giving connection probabilities in terms of \alpha, should make this very clear.

> [@zachhleung](#):
>
> m → refers to the number of edges added that connects newly acquired nodes to existing nodes, as the network is growing

The documentation says,

> `m` … the number of edges to add in each time step

Then later:

> We start with a single vertex and no edges in the first time step. Then we add one vertex in each time step and the new vertex initiates some edges to old vertices.

* * *

Can you please be a bit more specific about what you think is missing form the documentation, or _why_ the current text is not clear enough?

I’m happy to improve the docs, but I need to understand why you found them confusing in the first place.

---

<div class="post-metadata">

**Author:** ![zachhleung](https://avatars.discourse-cdn.com/v4/letter/z/ecae2f/32.png) [@zachhleung](https://igraph.discourse.group/u/zachhleung)\
**Post date:** [21 March 2024 13:03 UTC](https://igraph.discourse.group/t/sample-pa-arguments/1786/3 "2024-03-21T13:03:49Z")

</div>

![IMG_0197](https://global.discourse-cdn.com/free1/uploads/igraph/original/2X/6/6ca6e673aa158fbfbae1dac677670040ae88d99f.jpeg)

On the power argument, as per the screenshot of the documentation, it states that “power of the preferential attachment”. Hence, I thought that it was rather circular in the definition of power.

Thanks for being open though.

---

<div class="post-metadata">

**Author:** ![szhorvat](https://yyz2.discourse-cdn.com/free1/user_avatar/igraph.discourse.group/szhorvat/32/3_2.png) [@szhorvat](https://igraph.discourse.group/u/szhorvat)\
**Post date:** [21 March 2024 17:59 UTC](https://igraph.discourse.group/t/sample-pa-arguments/1786/4 "2024-03-21T17:59:38Z")

</div>

I agree that this phrasing is not great, and that there should be a reference to the Details section. I’ll improve on this.

Anything else that you think needs improvement?

---

<div class="post-metadata">

**Author:** ![zachhleung](https://avatars.discourse-cdn.com/v4/letter/z/ecae2f/32.png) [@zachhleung](https://igraph.discourse.group/u/zachhleung)\
**Post date:** [22 March 2024 01:16 UTC](https://igraph.discourse.group/t/sample-pa-arguments/1786/5 "2024-03-22T01:16:54Z")

</div>

Thank you! ‘m’ is understandable.

In the mean time, do you mind if I quickly check for the understanding that the ‘power’ argument describes the relationship of: probability in gaining new connections for existing nodes depends on existing degree of the node?

Cheers 🙂

---

<div class="post-metadata">

**Author:** ![szhorvat](https://yyz2.discourse-cdn.com/free1/user_avatar/igraph.discourse.group/szhorvat/32/3_2.png) [@szhorvat](https://igraph.discourse.group/u/szhorvat)\
**Post date:** [22 March 2024 16:25 UTC](https://igraph.discourse.group/t/sample-pa-arguments/1786/6 "2024-03-22T16:25:46Z")

</div>

Here’s the relevant part of the docs:

 ![image](https://global.discourse-cdn.com/free1/uploads/igraph/original/2X/a/abb0a6aa243c335dadeeb809059e3f3e11f3679d.png)

The probability of connected to a vertex depends on the degree k of that vertex, on \alpha (which is the same as `power`) and on a (which is the same as `zero.appeal`).

k is the in-degree in the directed case, and the total degree in the undirected case. If `out.pref` is set to `TRUE` then k is the total degree even in the undirected case.

I hope this answers your question.
