Source Code Reference#
- class gnfd.DependencySet(iterable=(), /)#
-
- classmethod from_string_list(lst)#
Creates a
DependencySetfrom a list of dependencies encoded as strings.
- get_normal_form(session)#
- is_in_global_normal_form()#
- property lp_suitable: bool#
- Returns:
Truewhen LP normalization (cf. <https://doi.org/10.1007/s00778-025-00902-2>) could be performed on this graph as its dependencies only target nodes and there are no inter graph dependencies.
- class gnfd.Edge(symbol='', labels=None, properties=None, src_pattern=None, tgt_pattern=None)#
Bases:
GraphObject,Pattern,ABCRepresents an abstract LPG edge without a direction.
- Parameters:
- contains_property(symbol, key)#
Checks whether the pattern contains a graph object whose variable symbol is
symboland which has a propertykey.
- contains_var(symbol)#
Checks whether the pattern contains a graph object whose variable symbol is
symbol.- Parameters:
symbol¶ (str) – The symbol which should be looked for in the pattern.
- Returns:
Whether there is a
GraphObjecthavingsymbolas its symbol.- Return type:
- get_graph_object_with_symbol(symbol)#
- Returns:
a graph object with the given symbol
- Return type:
GraphObject | None
- get_graph_objects()#
- Returns:
- Return type:
- minimal_pattern_intersections(other)#
Computes the minimal pattern intersection between this and the
otherpattern.
- to_clingo_tableau(lhs, constants=True)#
- Returns:
The pattern represented as clingo facts containing constants or variables.
- Return type:
- class gnfd.GNFD(pattern, left, right)#
Bases:
objectDenotes a GN-FD that consists of a
Patternand sets ofReferencethat denote the right and left side of the descriptor of the GN-FD.
- class gnfd.GraphObject(symbol='', labels=None, properties=None)#
Bases:
ABCAbstract class representing an LPG graph object, i.e., a
Edgeor aNode.- Parameters:
- clingo_symbol()#
Returns a symbol for use with clingo.
- abstractmethod go_equals(other)#
- Returns:
Whether 2 graph objects are equivalent
- class gnfd.LeftEdge(symbol='', labels=None, properties=None, src_pattern=None, tgt_pattern=None)#
Bases:
EdgeRepresents an LPG edge directed to the left.
- property leftmost_node#
- Returns:
the left most node of the pattern, i.e., the leaf of always choosing pattern 1
- minimal_pattern_intersections(other)#
Computes the minimal pattern intersection between this and the
otherpattern.- Returns:
a list of tuples consisting of (1) the pattern that is the minimal intersection between this and the
otherpattern and of (2) tuples denote variable correspondences between the patterns.
- property rightmost_node#
- Returns:
the right most node of the pattern, i.e., the leaf of always choosing pattern 2
- class gnfd.Node(symbol='', labels=None, properties=None)#
Bases:
GraphObject,PatternRepresents an LPG node.
- contains_property(symbol, key)#
Checks whether the pattern contains a graph object whose variable symbol is
symboland which has a propertykey.
- contains_var(symbol)#
Checks whether the pattern contains a graph object whose variable symbol is
symbol.- Parameters:
symbol¶ (str) – The symbol which should be looked for in the pattern.
- Returns:
Whether there is a
GraphObjecthavingsymbolas its symbol.- Return type:
- equals(other)#
Computes whether the structure of this and the
otherpattern and their labels and properties are equal.
- get_graph_object_with_symbol(symbol)#
- Returns:
a graph object with the given symbol
- Return type:
GraphObject | None
- get_graph_objects()#
- Returns:
- Return type:
- go_equals(other)#
- Returns:
Whether 2 graph objects are equivalent
- property leftmost_node#
- Returns:
the left most node of the pattern, i.e., the leaf of always choosing pattern 1
- minimal_pattern_intersections(other)#
Computes the minimal pattern intersection between this and the
otherpattern.- Returns:
a list of tuples consisting of (1) the pattern that is the minimal intersection between this and the
otherpattern and of (2) tuples denote variable correspondences between the patterns.
- property rightmost_node#
- Returns:
the right most node of the pattern, i.e., the leaf of always choosing pattern 2
- to_clingo_tableau(lhs, constants=True)#
- Returns:
The pattern represented as clingo facts containing constants or variables.
- Return type:
- class gnfd.Pattern(string)#
Bases:
ABCRepresents a pattern used for matching in an LPG.
- abstractmethod contains_property(symbol, key)#
Checks whether the pattern contains a graph object whose variable symbol is
symboland which has a propertykey.
- abstractmethod contains_var(symbol)#
Checks whether the pattern contains a graph object whose variable symbol is
symbol.- Parameters:
symbol¶ (str) – The symbol which should be looked for in the pattern.
- Returns:
Whether there is a
GraphObjecthavingsymbolas its symbol.- Return type:
- equals(other)#
Computes whether the structure of this and the
otherpattern and their labels and properties are equal.
- abstractmethod get_graph_object_with_symbol(symbol)#
- Returns:
a graph object with the given symbol
- Return type:
GraphObject | None
- abstractmethod get_graph_objects()#
- Returns:
- Return type:
- abstract property leftmost_node#
- Returns:
the left most node of the pattern, i.e., the leaf of always choosing pattern 1
- abstractmethod minimal_pattern_intersections(other)#
Computes the minimal pattern intersection between this and the
otherpattern.
- abstract property rightmost_node#
- Returns:
the right most node of the pattern, i.e., the leaf of always choosing pattern 2
- abstractmethod to_clingo_tableau(lhs, constants=True)#
- Returns:
The pattern represented as clingo facts containing constants or variables.
- Return type:
- class gnfd.PatternConcat(left, right, string)#
Bases:
PatternRepresents a concatenation of two patterns.
- contains_property(symbol, key)#
Checks whether the pattern contains a graph object whose variable symbol is
symboland which has a propertykey.
- contains_var(symbol)#
Checks whether the pattern contains a graph object whose variable symbol is
symbol.- Parameters:
symbol¶ (str) – The symbol which should be looked for in the pattern.
- Returns:
Whether there is a
GraphObjecthavingsymbolas its symbol.- Return type:
- get_graph_object_with_symbol(symbol)#
- Returns:
a graph object with the given symbol
- Return type:
GraphObject | None
- get_graph_objects()#
- Returns:
- Return type:
- property leftmost_node#
- Returns:
the left most node of the pattern, i.e., the leaf of always choosing pattern 1
- minimal_pattern_intersections(other)#
Computes the minimal pattern intersection between this and the
otherpattern.- Returns:
a list of tuples consisting of (1) the pattern that is the minimal intersection between this and the
otherpattern and of (2) tuples denote variable correspondences between the patterns.
- property rightmost_node#
- Returns:
the right most node of the pattern, i.e., the leaf of always choosing pattern 2
- to_clingo_tableau()#
- Returns:
The pattern represented as clingo facts containing constants or variables.
- Return type:
- class gnfd.Reference(reference)#
Bases:
objectRepresents a reference to a property key contained in a graph object or to the graph object itself.
- get_graph_object()#
- Returns:
The graph object of the reference.
- Return type:
- class gnfd.RightEdge(symbol='', labels=None, properties=None, src_pattern=None, tgt_pattern=None)#
Bases:
EdgeRepresents an LPG edge directed to the right.
- property leftmost_node#
- Returns:
the left most node of the pattern, i.e., the leaf of always choosing pattern 1
- minimal_pattern_intersections(other)#
Computes the minimal pattern intersection between this and the
otherpattern.- Returns:
a list of tuples consisting of (1) the pattern that is the minimal intersection between this and the
otherpattern and of (2) tuples denote variable correspondences between the patterns.
- property rightmost_node#
- Returns:
the right most node of the pattern, i.e., the leaf of always choosing pattern 2