CptNemo
CptNemo

Reputation: 6755

Access igraph R objects from Python

I have a graph object created with the igraph R package. If I understand the architecture of the igraph software package correctly the igraph R package is an interface to use igraph from R. Then since there is also a igraph Python interface I wonder if it is possible to access my igraph object created with R via Python directly. Or if the only way to access and igraph R object from Python is to export the igraph R object with write.graph() in R and then import it with the igraph R package.

Upvotes: 1

Views: 383

Answers (1)

Tamás
Tamás

Reputation: 48101

The two interfaces use different data models to store the graph attributes, so I think there is no safe and sane way to access an igraph object in R from Python or vice versa, apart from saving it and then loading it back. Using the GraphML format is probably your safest bet as it preserves all the attributes that are basic data types (numbers and strings).

Upvotes: 2

Related Questions