Before #768.
Currently, an igraph object is a list of length 9 or so in R land. For the future, it would be better to store an external pointer to the C object.
We can use external pointers, but these are not serializable. Proposing the following solution:
- A serialized representation with contiguous vectors of vectices and edges in igraph's native format is stored as a
raw() vector
- In addition, this vector stores an external pointer with the C object
The external pointer will be gone in serialization, but this doesn't matter -- the graph can always be reconstructed from the data in the raw() vector.
In addition, to avoid doubling the memory consumption, we can make the raw() vector "lazy" with ALTREP. This works only for R >= 4.0, but because it is only an optimization, we retain compatibility with R versions that don't have it yet.
Before #768.
Currently, an igraph object is a list of length 9 or so in R land. For the future, it would be better to store an external pointer to the C object.
We can use external pointers, but these are not serializable. Proposing the following solution:
raw()vectorThe external pointer will be gone in serialization, but this doesn't matter -- the graph can always be reconstructed from the data in the
raw()vector.In addition, to avoid doubling the memory consumption, we can make the
raw()vector "lazy" with ALTREP. This works only for R >= 4.0, but because it is only an optimization, we retain compatibility with R versions that don't have it yet.