# How to get which motifs each value corresponds to？

**URL:** <https://igraph.discourse.group/t/how-to-get-which-motifs-each-value-corresponds-to/96>\
**Category:** Usage\
**Tags:** Python\
**Created:** [16 February 2020 07:18 UTC](https://igraph.discourse.group/t/how-to-get-which-motifs-each-value-corresponds-to/96 "2020-02-16T07:18:06Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![ningfneng](https://avatars.discourse-cdn.com/v4/letter/n/8e8cbc/32.png) [@ningfneng](https://igraph.discourse.group/u/ningfneng)\
**Post date:** [16 February 2020 07:18 UTC](https://igraph.discourse.group/t/how-to-get-which-motifs-each-value-corresponds-to/96/1 "2020-02-16T07:18:07Z")

</div>

I’m using python-igraph to find the motifs in a graph with the method `motifs_randesu`.  
And it returns a list of the number of each motif. However, I don’t know what kind of motif each number corresponds to.  
For example:

```auto
g = IGraph.TupleList(edges, directed=True, vertex_name_attr='name', edge_attrs=None, weights=True)
print(g.motifs_randesu(size=4))

```

And I get a list:

```auto
[nan, nan, 2, nan, 4, 10, 9, 1, 0, 33, 26, 0, 4, 0, 17, 16]

```

What kind of motif does the number 16 represent？  
Thank you.

---

<div class="post-metadata">

**Author:** ![vtraag](https://yyz2.discourse-cdn.com/free1/user_avatar/igraph.discourse.group/vtraag/32/38_2.png) [@vtraag](https://igraph.discourse.group/u/vtraag)\
**Post date:** [16 February 2020 08:18 UTC](https://igraph.discourse.group/t/how-to-get-which-motifs-each-value-corresponds-to/96/2 "2020-02-16T08:18:53Z")

</div>

If you have `motif_count = g.motifs_randesu(size=4)` then each element of `motif_count` gives the counts of the motif. That is, if `motif_count[i] = n` then isoclass `i` appears `n` times in the graph. You can construct the graph which motif `i` corresponds to with `Graph.Isoclass(n=4, class=i)`. See also [igraph.GraphBase](https://python.igraph.org/en/stable/api/igraph.GraphBase.html#Isoclass)

---

<div class="post-metadata">

**Author:** ![ningfneng](https://avatars.discourse-cdn.com/v4/letter/n/8e8cbc/32.png) [@ningfneng](https://igraph.discourse.group/u/ningfneng)\
**Post date:** [16 February 2020 08:30 UTC](https://igraph.discourse.group/t/how-to-get-which-motifs-each-value-corresponds-to/96/3 "2020-02-16T08:30:40Z")

</div>

It works！Thank you for you help！

---

<div class="post-metadata">

**Author:** ![vtraag](https://yyz2.discourse-cdn.com/free1/user_avatar/igraph.discourse.group/vtraag/32/38_2.png) [@vtraag](https://igraph.discourse.group/u/vtraag)\
**Post date:** [16 February 2020 08:32 UTC](https://igraph.discourse.group/t/how-to-get-which-motifs-each-value-corresponds-to/96/4 "2020-02-16T08:32:21Z")

</div>

No problem, you are welcome! You can indicate that the post solves your question, so that others can find solutions more easily.

---

<div class="post-metadata">

**Author:** ![hugo](https://avatars.discourse-cdn.com/v4/letter/h/b38774/32.png) [@hugo](https://igraph.discourse.group/u/hugo)\
**Post date:** [12 May 2025 03:39 UTC](https://igraph.discourse.group/t/how-to-get-which-motifs-each-value-corresponds-to/96/5 "2025-05-12T03:39:18Z")

</div>

[quote=“vtraag, post:2, topic:96”]  
[https://igraph.org/python/doc/igraph.GraphBase-class.html](https://igraph.org/python/doc/igraph.GraphBase-class.html#Isoclass)  
[/quote] is not a vaild webseit, could you tell me the new one?

---

<div class="post-metadata">

**Author:** ![vtraag](https://yyz2.discourse-cdn.com/free1/user_avatar/igraph.discourse.group/vtraag/32/38_2.png) [@vtraag](https://igraph.discourse.group/u/vtraag)\
**Post date:** [12 May 2025 05:37 UTC](https://igraph.discourse.group/t/how-to-get-which-motifs-each-value-corresponds-to/96/6 "2025-05-12T05:37:14Z")

</div>

The new link is [igraph.GraphBase](https://python.igraph.org/en/stable/api/igraph.GraphBase.html#Isoclass). I will also edit the post.

---

<div class="post-metadata">

**Author:** ![hugo](https://avatars.discourse-cdn.com/v4/letter/h/b38774/32.png) [@hugo](https://igraph.discourse.group/u/hugo)\
**Post date:** [12 May 2025 07:40 UTC](https://igraph.discourse.group/t/how-to-get-which-motifs-each-value-corresponds-to/96/7 "2025-05-12T07:40:16Z")

</div>

Thanks！Could you please clarify why “None” appeared in the list? Additionally, I would appreciate it if you could explain what “None” means in this context. Thank you for your assistance!

---

<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:** [13 May 2025 08:47 UTC](https://igraph.discourse.group/t/how-to-get-which-motifs-each-value-corresponds-to/96/8 "2025-05-13T08:47:31Z")

</div>

Only connected (to be precise: weakly connected) motifs are counted.

For example, numbers 1, 2 and 4 in the following list are excluded as they are not connected:

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

These are the ones that you get `None` for.
