Skip to content

Using Hints

Jordan Matelsky edited this page Mar 18, 2021 · 1 revision

GrandIso optionally accepts an argument hints which is a list of valid partial mappings to use to seed the search. For example, in this code:

host = nx.DiGraph()
nx.add_path(host, ["A", "B", "C", "A"])
motif = nx.DiGraph()
nx.add_path(motif, ["a", "b", "c", "a"])

find_motifs(motif, host)

There are three valid mappings (because each of A, B, and C can map to a, b, or c).

We can declare that node A maps to node a or b like this:

host = nx.DiGraph()
nx.add_path(host, ["A", "B", "C", "A"])
motif = nx.DiGraph()
nx.add_path(motif, ["a", "b", "c", "a"])

find_motifs(
    motif, host,
    hints=[{"A": "a"}, {"A", "b"}]
)
Clone this wiki locally