aplbrain / aplbrain/grand-cypher
Find siblings including self
- Lingua principale
- Python
- Stelle
- 129
- Fork
- 17
- Metriche di merge delle PR
- Metriche PR in attesa
Descrizione
I would like to create a simple query to the graph with hierarchy. Starting from a child I would like to find a parent and all children of this parent including starting node. Here the example of the code,
```python
from grandcypher import GrandCypher
import networkx as nx
host = nx.DiGraph()
host.add_node("p", foo="Parent")
host.add_node("c1", foo="Child01")
host.add_node("c2", foo="Child02")
host.add_node("c3", foo="Child03")
host.add_node("c4", foo="Child04")
host.add_node("c5", foo="Child05")
host.add_edge("c1", "p")
host.add_edge("c2", "p")
host.add_edge("c3", "p")
host.add_edge("c4", "p")
host.add_edge("c5", "p")
qry = """
MATCH (n {foo: "Child01"})-->()<--(s)
RETURN s.foo
"""
print(GrandCypher(host).run(qry))
```
In current implementation the code output exclude initial node `Child01`
`{'s.foo': ['Child02', 'Child03', 'Child04', 'Child05']}`
Is it implemented on purpose?
How I can alter this behavior in single query?
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Valutazione
Questa issue non è ancora stata valutata.