Basic question to compare R code and Python code

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 :grin:

In Python, you can use Formula().

In Mathematica, you can use IGShorthand.

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.

1 Like