PathRAG icon indicating copy to clipboard operation
PathRAG copied to clipboard

Add graph visualization feature

Open matheu-s opened this issue 9 months ago • 0 comments

Changes introduced:

Adds visualize_graph.py, that generates an HTML visualization of the knowledge graph (graph_chunk_entity_relation.graphml):

Screenshot 2025-03-20 at 23 03 57

These changes are important, as they help the user to identify problems with unconnected nodes and easily debug the processed knowledge graph.

  • It adds the weights on the edge label of connected nodes.
  • All nodes have a tooltip with category, description and chunk source.
Screenshot 2025-03-20 at 23 17 29

How to test:

  1. Process a sample.txt or add a ready graph_chunk_entity_relation.graphml file.
  2. Run visualize_graph.py.
  3. Open knowledge_graph.html.

Obs: If preferred, the functionality could be implemented to automatically generate the visualization HTML, it if executes after graph creation: https://github.com/BUPT-GAMMA/PathRAG/blob/2785a12de7519b1869483b31ed8716179e7bc03e/PathRAG/storage.py#L259-L260

matheu-s avatar Mar 20 '25 22:03 matheu-s