# Basic question to compare R code and Python code

**URL:** <https://igraph.discourse.group/t/basic-question-to-compare-r-code-and-python-code/165>\
**Category:** Usage\
**Tags:** Python, R\
**Created:** [30 March 2020 09:55 UTC](https://igraph.discourse.group/t/basic-question-to-compare-r-code-and-python-code/165 "2020-03-30T09:55:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Marco\_Onnis](https://yyz2.discourse-cdn.com/free1/user_avatar/igraph.discourse.group/marco_onnis/32/162_2.png) [@Marco\_Onnis](https://igraph.discourse.group/u/Marco_Onnis)\
**Post date:** [30 March 2020 09:55 UTC](https://igraph.discourse.group/t/basic-question-to-compare-r-code-and-python-code/165/1 "2020-03-30T09:55:33Z")

</div>

Hello guts, today I’ve a new newbie question, but I think it will be useful to clarify the general structure of iGraph on different program languages.

I’ve seen that formula:

```
fig <-graph.formula(1-2:3:4:6, 3-4:6, 2-4:5, 4-5:6:7, 5-7:8, 6-7:9, 7-8:9, 8-9)
plot(fig)

```

on R. I was searching the same command on Python, but apparently there is no ‘formula’ for igraph.

So, what shoul I do to recreate exactly that graph? (in Python i imagine that is impossible too to use the same syntax that is into the parenthesis, with : )

any help or explanation will be appreciated! thanks a lot 😁

---

<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:** [30 March 2020 13:23 UTC](https://igraph.discourse.group/t/basic-question-to-compare-r-code-and-python-code/165/2 "2020-03-30T13:23:13Z")

</div>

In Python, you can use [`Formula()`](https://igraph.org/python/doc/igraph.Graph-class.html#Formula).

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

In Mathematica, you can use [`IGShorthand`](http://szhorvat.net/mathematica/IGDocumentation/#igshorthand).

 ![image](https://global.discourse-cdn.com/free1/uploads/igraph/original/1X/56f227102da206af198268f84e2961c9b77deb02.jpeg)

---

<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:** [30 March 2020 13:56 UTC](https://igraph.discourse.group/t/basic-question-to-compare-r-code-and-python-code/165/3 "2020-03-30T13:56:08Z")

</div>

I am not entirely sure of this, but the implementations might not be fully identical, since they are implemented not in the C core, but in the higher-level language. Most cases should probably be the same, but I am not 100% sure about this.
