Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

find_motifs_iter: report best match #44

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading