Skip to content

Commit 9a90081

Browse files
Add cypher query docs
1 parent 06f19a3 commit 9a90081

1 file changed

Lines changed: 13 additions & 23 deletions

File tree

knowledge_base/AI/KnowledgeGraph.md

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -53,46 +53,36 @@ If i search for "Animal" with search depth of 2, sematically Cat is similar, Cat
5353
This is the most popular method of retrieval, the natural language query is converted to cypher query using AI provided the knowledge graph schema
5454

5555
### Agentic Retrieval
56-
This is an extension of cypher Query retrieval technique, when the agent is not satisfied with the retrieved nodes, it can regenerate the cypher query, or nativate to nodes relative to retrieved nodes
56+
This is an extension of cypher Query retrieval technique, when the agent is not satisfied with the retrieved nodes, it can regenerate the cypher query, or navigate to nodes relative to retrieved nodes
5757

5858
### Heirachical Retrieval
5959
When the knowledge graph grows, the schema of the knowledge graph too grows depending on the type of data that were are storing, the llm which converts natural language query to cypher query maynot be able to interpret such large schema
6060
So in heirarchical Retrieval, the knowledge graph is built in a way that has high level communities and sub communities
6161
The schema of high level communities can alone be used in first stage of cypher query generation and the iteration continues for subsequent levels with it's respective schema
6262
This technique was used in [microsoft graphRAG](https://microsoft.github.io/graphrag/)
6363

64-
### Graph Properties for better querying
65-
- Direction
66-
- Unidirectional
67-
- Bidirectional
68-
- Weight : How strong is the relationship
69-
- Traversing Algorithm
70-
- BFS
71-
- DFS
64+
### Cypher Queries are powerful - Neo4j
65+
- [neo4j Cypher manual](https://neo4j.com/docs/cypher-manual/current/introduction/)
66+
- Flexible filtering of nodes, using node properties and relationships
67+
- Use Semantic search as part of cypher query - [ref](https://neo4j.com/blog/genai/vector-search-deeper-insights/)
68+
- Use builtin 65+ Advanced [Neo4j Graph Algorithms](https://neo4j.com/docs/graph-data-science/current/algorithms/) like shortest path between nodes, community detection, topological sorting etc
69+
70+
## Tips to Build knowledge graphs
71+
- Build a single knowledge graph instead of multiple small ones
72+
- Use flexible schema while doing LLM extraction and do cleanup later to avoid dataloss
7273

7374
## Limitations
74-
- Data Cleaning process is difficuilt
75+
- Data Cleaning process is difficuilt, different nodes with same meaning etc
76+
- When the graph size increases the schema size will increase too, difficuilt to get cypher query from LLM with large schema in context
7577

7678
## Libraries
7779
### Neo4j
7880
- graph database
79-
- use cypher query language
81+
- uses cypher query language
8082

8183
### Microsoft GraphRAG
8284
- [Repo](https://github.com/microsoft/graphrag?tab=readme-ov-file),[White Paper](https://arxiv.org/pdf/2404.16130),[Demo Video](https://youtu.be/jCjyaQL-7mA?si=PTPT9XdJdX-2wbdi)
8385
- Good for QFS (Query Focused Summarization) (eg: What is this document about?)
8486
- get answer with score for a query parallely in local communities
8587
- filter by score and combine them and give to global community for final answer
8688

87-
#### Doubts
88-
precision and recall?
89-
gleanings?
90-
logitbias?
91-
community detection algorithms? Leiden algorithm?
92-
93-
### Explore
94-
- In Datasheets
95-
- Structured DB vs knowledge graphs
96-
- neo4j repos
97-
98-

0 commit comments

Comments
 (0)