/** \ingroup python_interface_edge * \brief Returns a dict with attribute names and values */ PyObject* igraphmodule_Edge_attributes(igraphmodule_EdgeObject* self) { igraphmodule_GraphObject *o = self->gref; PyObject *names, *dict; long int i, n; dict=PyDict_New(); if (!dict) return NULL; names=igraphmodule_Graph_edge_attributes(o); if (!names) { Py_DECREF(dict); return NULL; } n = PyList_Size(names); for (i=0; i<n; i++) { PyObject *name = PyList_GetItem(names, i); if (name) { PyObject *dictit; dictit = PyDict_GetItem(((PyObject**)o->g.attr)[ATTRHASH_IDX_EDGE], name); if (dictit) { PyObject *value = PyList_GetItem(dictit, self->idx); if (value) { /* no need to Py_INCREF, PyDict_SetItem will do that */ PyDict_SetItem(dict, name, value); } } } } return dict; }
/** \ingroup python_interface_edgeseq * \brief Returns the list of attribute names */ PyObject* igraphmodule_EdgeSeq_attribute_names(igraphmodule_EdgeSeqObject* self) { return igraphmodule_Graph_edge_attributes(self->gref); }
/** \ingroup python_interface_edge * \brief Returns the list of attribute names */ PyObject* igraphmodule_Edge_attribute_names(igraphmodule_EdgeObject* self) { if (!self->gref) return NULL; return igraphmodule_Graph_edge_attributes(self->gref); }