Skip to content

Commit

Permalink
find_motifs_iter: report best match
Browse files Browse the repository at this point in the history
  • Loading branch information
aleclearmind committed Aug 16, 2024
1 parent e377f35 commit 043ce4b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions grandiso/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ def find_motifs_iter(
is_node_structural_match=_is_node_structural_match,
is_node_attr_match=_is_node_attr_match,
is_edge_attr_match=_is_edge_attr_match,
best_match=[None],
) -> Generator[dict, None, None]:
"""
Yield mappings from motif node IDs to host graph IDs.
Expand Down Expand Up @@ -404,6 +405,10 @@ def find_motifs_iter(

# Graph path traversal function
def walk(path):

if best_match[0] is None or len(best_match[0]) < len(path):
best_match[0] = dict(path)

if path and len(path) == len(motif):
# Path complete
yield path
Expand Down

0 comments on commit 043ce4b

Please sign in to comment.