Comment 1 for bug 1012434

Revision history for this message
Tamás Nepusz (ntamas) wrote :

Related bug: https://bugs.launchpad.net/igraph/+bug/918138 -- this is from the Python side. Basically, we have to extend the attribute handler interface s.t. the attribute handlers can provider serializer/unserializer hooks for data types that are not numbers or strings.

I think we roughly need the following changes in the attribute handler:

- Remove IGRAPH_ATTRIBUTE_R_OBJECT and IGRAPH_ATTRIBUTE_PY_OBJECT from igraph_attribute_type_t and replace them with a single IGRAPH_ATTRIBUTE_OBJECT type.
- Add functions like get_object_{graph,vertex,edge}_attr to the attribute handler interface. These functions should take the name of a graph/vertex/edge attribute and optionally a vertex/edge selector and return an igraph_vector_ptr_t, each element of which should point to a buffer holding the serialized values of the attributes.

The attribute handler of both the Python and the R interface should then be adapted to implement the new attribute handler functions, and also to handle IGRAPH_ATTRIBUTE_OBJECT attribute types properly in the getinfo, add_vertices, add_edges methods.

Finally, we should figure out how to write attributes of object types into GraphML or GML. The biggest obstacle here is that neither of these formats have an "object" data type, they only have "strings". One option would be to use a hidden graph attribute that lists the names of vertex/edge attributes that "look like" strings but that in fact contain serialized data. We must also make sure that serialized data is escaped properly when saved and unescaped when read.