R: better support for complex attributes
Bug #1012434 reported by
Gábor Csárdi
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
igraph |
Confirmed
|
High
|
Gábor Csárdi |
Bug Description
It should be possible to use complex attributes in GraphML and GML readers and writers. We would need to serialize and unserialize attributes for this.
To post a comment you must log in.
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. {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.
- Add functions like get_object_
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.