| 947 | return attr |
| 948 | |
| 949 | def find_gexf_attributes(self, attributes_element): |
| 950 | # Extract all the attributes and defaults |
| 951 | attrs = {} |
| 952 | defaults = {} |
| 953 | mode = attributes_element.get("mode") |
| 954 | for k in attributes_element.findall(f"{{{self.NS_GEXF}}}attribute"): |
| 955 | attr_id = k.get("id") |
| 956 | title = k.get("title") |
| 957 | atype = k.get("type") |
| 958 | attrs[attr_id] = {"title": title, "type": atype, "mode": mode} |
| 959 | # check for the 'default' subelement of key element and add |
| 960 | default = k.find(f"{{{self.NS_GEXF}}}default") |
| 961 | if default is not None: |
| 962 | if atype == "boolean": |
| 963 | value = self.convert_bool[default.text] |
| 964 | else: |
| 965 | value = self.python_type[atype](default.text) |
| 966 | defaults[title] = value |
| 967 | return attrs, defaults |
| 968 | |
| 969 | |
| 970 | def relabel_gexf_graph(G): |