MCPcopy Create free account
hub / github.com/easy-graph/Easy-Graph / find_gexf_attributes

Method find_gexf_attributes

easygraph/readwrite/gexf.py:949–967  ·  view source on GitHub ↗
(self, attributes_element)

Source from the content-addressed store, hash-verified

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
970def relabel_gexf_graph(G):

Callers 1

make_graphMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected