graphi.graph_io.graphml.elements module

Representations of the elements in a GraphML document

class graphi.graph_io.graphml.elements.DataKey(identifier, attr_name, attr_type, default=None)

Bases: object

A GraphML Key specification on how to convert attributes of nodes

Note:Unlike the GraphML key element, no domain is stored. See KeyDomain for its equivalent.
classmethod from_element(element)

Create a DataKey instance from a graphml key element

types = {'boolean': <type 'bool'>, 'double': <type 'float'>, 'float': <type 'float'>, 'int': <type 'int'>, 'long': <type 'int'>, 'string': <type 'str'>}
class graphi.graph_io.graphml.elements.GraphMLEdge(identifier, source, target, directed, attributes)

Bases: object

A GraphML edge element

classmethod from_element(element, key_domain, default_directed)

Create a DataKey instance from a graphml edge element

class graphi.graph_io.graphml.elements.GraphMLNode(identifier, attributes)

Bases: object

A GraphML node element

classmethod from_element(element, key_domain)

Create a DataKey instance from a graphml node element

class graphi.graph_io.graphml.elements.KeyDomain(domain, keys)

Bases: object

The GraphML domain to which keys apply

A KeyDomain represents all keys of a given domain. A GraphML key element with a domain is represented by a DataKey stored in the corresponding KeyDomain.

GRAPHML_DOMAINS = ('graph', 'node', 'edge', 'all')
compile_attributes(element)

Compile a dictionary of attributes from a graphml element for this domain

Note:The validity of the domain is currently not checked. In the future, an error may be thrown if element is of the wrong domain.
classmethod from_graphml(domain, graphml)

Create a KeyDomain instance for a given domain from a graphml root element

class graphi.graph_io.graphml.elements.QualifiedTag(namespace, localname)

Bases: object

An XML tag consisting of (optional) namespace and local name

classmethod from_tag(tag)

Parse an {namespace}localname tag to a QualifiedTag