The following step-by-step guide walks through the process to visualize a knowledge graph after it’s been constructed by graphrag. Note that some of the settings recommended below are based on our own experience of what works well. Feel free to change and explore other settings for a better visualization experience!
Before building an index, please review your settings.yaml configuration file and ensure that graphml snapshots is enabled.
snapshots:
graphml: true
(Optional) To support other visualization tools and exploration, additional parameters can be enabled that provide access to vector embeddings.
embed_graph:
enabled: true # will generate node2vec embeddings for nodes
umap:
enabled: true # will generate UMAP embeddings for nodes, giving the entities table an x/y position to plot
After running the indexing pipeline over your data, there will be an output folder (defined by the storage.base_dir setting).
In the output folder, look for a file named graph.graphml. graphml is a standard file format supported by many visualization tools. We recommend trying Gephi.
output folder containing the various parquet files.graph.graphml file into Gephi. This will result in a fairly plain view of the undirected graph nodes and edges.
Tools -> Plugins.Install and restart Gephi.Statistics tab on the right, click Run for Average Degree and Leiden Algorithm.
Appearance pane in the upper left side of Gephi.
Nodes, then Partition, and click the color palette icon in the upper right.Cluster from the dropdown.Palette... hyperlink, then Generate....Limit number of colors, click Generate, and then Ok.Apply to color the graph. This will color the graph based on the partitions discovered by Leiden.Appearance pane in the upper left, select Nodes -> RankingSizing icon in the upper right.Degree and set:
Apply.Layout tab in the lower left, select OpenORD.
Liquid and Expansion stages to 50, and everything else to 0.Run and monitor the progress.Force Atlas 2 in the layout options.
Run and wait.Stop when it looks like the graph nodes have settled and no longer change position significantly.Your final graph should now be visually organized and ready for analysis!