7.4.9. Type Classes: NodeType and EdgeTypeΒΆ
The two type classes for node and edge types have the same interface:
The constructor takes a graph and the name of a type. The name has to denote an existing type of the respective kind in the graph. Case matters in the name of a node type and an edge type.
Note
Please read Language Schema for a complete reference of all valid node and edge type names. Case matters for node and edge types.
Adding new types as well as removing and querying existing ones has to be performed by using the instance methods of class Graph.
The two instance methods __eq__ and __ne__ check for equality and inequality of node/edge types.
The instance method is_of_type takes a type descriptor as argument and checks whether the element is of the given type (and not of a subtype). Instance method is_of_subtype includes subtypes (children) of the given type in the check.
graph()
Instance method graph returns the graph the type belongs to.
name()
Instance method name returns the name of the type.
parent()
Instance method parent returns the parent type of the type or None if the type has no parent type.
__str__()
Instance method __str__ returns a textual representation of the type (only for debugging purposes).