# Minimum degree in a sample\_smallworld() graph

**URL:** <https://igraph.discourse.group/t/minimum-degree-in-a-sample-smallworld-graph/1635>\
**Category:** Usage\
**Tags:** R\
**Created:** [17 August 2023 07:23 UTC](https://igraph.discourse.group/t/minimum-degree-in-a-sample-smallworld-graph/1635 "2023-08-17T07:23:30Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jskvor](https://yyz2.discourse-cdn.com/free1/user_avatar/igraph.discourse.group/jskvor/32/984_2.png) [@jskvor](https://igraph.discourse.group/u/jskvor)\
**Post date:** [17 August 2023 07:23 UTC](https://igraph.discourse.group/t/minimum-degree-in-a-sample-smallworld-graph/1635/1 "2023-08-17T07:23:30Z")

</div>

Recently, I have been exploring random graph models in igraph. In particular, I am interested in small-world networks. While working with the `sample_smallworld()` function in igraph, I noticed some behavior that seems inconsistent with my understanding of the Watts & Strogatz model.

Specifically, in their paper they mention _We choose a vertex and the edge that connects it to its nearest neighbour in a clockwise sense. With probability p, we reconnect this edge to a vertex chosen uniformly at random over the entire ring…_. Based on this, **I would expect the minimum degree after reconnecting to be half of the average degree**. However, when testing this using `sample_smallworld()` in igraph with a high rewiring probability p, the minimum degree does not match the expected value. For example:

```auto
table(degree(sample_smallworld(1, 100000, 2, 0.8)))

```

To further clarify the expected behavior, I also tested the Watts-Strogatz model using NetworkX, which does give the expected minimum degree.

I was hoping you could provide some insight into why there is this discrepancy between the Watts-Strogatz model description, the NetworkX implementation, and the implementation in `sample_smallworld()`. Is this difference intentional or could it be a bug? Any guidance would be greatly appreciated.

---

<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:** [17 August 2023 12:57 UTC](https://igraph.discourse.group/t/minimum-degree-in-a-sample-smallworld-graph/1635/2 "2023-08-17T12:57:15Z")

</div>

Let’s put the full description here form the original paper:

 ![image](https://global.discourse-cdn.com/free1/uploads/igraph/original/1X/77677f4f38168b0eaf89d7fcee54c5e89175ae13.png)

I believe you are right and there’s a difference from igraph’s implementation.

igraph will rewire both endpoints of each edge. The original formulation rewires only one endpoint, using the one-dimensional ring as a reference for the direction.

We’ll look into clarifying this in the documentation.

You can think of `sample_smallworld` as a convenience function that just uses `make_lattice` then applies `rewire`. When the rewiring probability is p=1 we get a G(n,m) random graph with the same number of vertices and edges as the original lattice. Thus with igraph’s function the minimum degree is zero.

---

<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:** [17 August 2023 22:17 UTC](https://igraph.discourse.group/t/minimum-degree-in-a-sample-smallworld-graph/1635/3 "2023-08-17T22:17:00Z")

</div>

I clarified the docs and opened a feature request to implement the accurate version of the model. [Wishlist: Watts-Strogatz model that follows the original publication strictly · Issue #2383 · igraph/igraph · GitHub](https://github.com/igraph/igraph/issues/2383)

Thanks for pointing out this issue.

---

<div class="post-metadata">

**Author:** ![MIland](https://avatars.discourse-cdn.com/v4/letter/m/3be4f8/32.png) [@MIland](https://igraph.discourse.group/u/MIland)\
**Post date:** [5 February 2025 12:22 UTC](https://igraph.discourse.group/t/minimum-degree-in-a-sample-smallworld-graph/1635/4 "2025-02-05T12:22:25Z")

</div>

Hello, I am also researching small worlds graphs, specifically the Watts-Strogatz model and was wondering if this function was ever adapted. Any update on this would be greatly appreciated.

---

<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:** [5 February 2025 13:33 UTC](https://igraph.discourse.group/t/minimum-degree-in-a-sample-smallworld-graph/1635/5 "2025-02-05T13:33:06Z")

</div>

The existing function will probably not be adapted, but there is an issue to add a new function that follows the publication closely. [Wishlist: Watts-Strogatz model that follows the original publication strictly · Issue #2383 · igraph/igraph · GitHub](https://github.com/igraph/igraph/issues/2383)

We do not have the capacity to implement this at the moment, but if you are willing and able to program this in C, we do welcome a contribution.
