NetworkX-based GraphQAChain uses directed graph, missing parent relations during entity knowledge extraction #29279
MuhammadArham-43
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Checked
Feature request
GraphQA for knowledge graph entity recognition misses parent relations as it performs BFS on a directed graph. Move implementation to a NetworkX graph implementation to get all close and relevant relationships.
From my understanding, getting parents relations is important for generalized information and improved context parsing. Let me know if I am missing something or understanding the notion incorrectly.
Motivation
I was experimenting with GraphRAG with LLMGraphTransfomer and GraphQAChain in experimental langchain that uses network graph wrapper class behind for extracting relevant knowledge. However, some leaf nodes get no relevant information and relations as the directed graph makes it impossible to extract relations with parents.
This misses close relations and can lead to sub-optimal results. Generalization of concept can populate relevant information for in-context learning that can improve precision of the results.
Proposal (If applicable)
I can open an issue and convert the Directed Graph implementation to a Simple Graph implementation. The only changes required are in file:
https://github.com/langchain-ai/langchain/blob/master/libs/community/langchain_community/graphs/networkx_graph.py
We need to change knowledge_triples and add src and sink of the relation with the edge so we do not reverse the direction when populating relations later. I can change, test and open a pull request to improve this feature.
Beta Was this translation helpful? Give feedback.
All reactions