aplbrain / aplbrain/grand-cypher

Support passing `hints` in grandiso

Ouverte
#63 3 commentaires 0 réactions 1 personne assignée Réclamée par @j6k4m8 Voir sur GitHub
enhancement performance
Langage dominant
Python
Étoiles
129
Forks
17
Métriques de merge des PR
Métriques de PR en attente

Description

`grandiso.find_motifs` supports a `hints` attribute with is a list of partial-mappings, instead of requiring an exhaustive search:

```python
host = nx.DiGraph()
nx.add_path(host, ["A", "B", "C", "A"])
motif = nx.DiGraph()
nx.add_path(motif, ["A", "B", "C", "A"])
assert (
find_motifs(
motif,
host,
count_only=True,
# ↓ won't yield anything ↓ ↓ results in 1 match ↓
hints=[{"A": "A", "B": "C"}, {"A": "A", "B": "B"}],
)
== 1
)
```

It would be a HUGE query savings if we could optionally pass a set of `hints` directly to the grandcypher constructor:

```python
GrandCypher(G.nx).run(" ... ", grandiso_hints=[{"A": "A", "B": "B"}])
```

It would also be a huge performance boost if we took the attributes that have "simple" mappings (attribute equality, for instance) and auto-generated a set of hints from that. For example,

```cypher
MATCH (A)-[]->(B)
WHERE B.username == "j6k4m8"
RETURN A
```

We should see that `B` can be easily found first, and populate a set of hints with all valid matches for `B` before we even call the motif search [here](https://github.com/aplbrain/grand-cypher/blob/fff7651f5af821700baa49e7d81d5f7946fda299/grandcypher/__init__.py#L931).

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.