mirror of
https://github.com/HKUDS/LightRAG.git
synced 2025-11-04 19:59:34 +00:00
Merge pull request #424 from kaushikacharya/interactive_graph
Interactive Graph: Mouse hover nodes and edges displays description in pop-up window
This commit is contained in:
commit
77bcf1bea4
@ -11,9 +11,16 @@ net = Network(height="100vh", notebook=True)
|
|||||||
# Convert NetworkX graph to Pyvis network
|
# Convert NetworkX graph to Pyvis network
|
||||||
net.from_nx(G)
|
net.from_nx(G)
|
||||||
|
|
||||||
# Add colors to nodes
|
# Add colors and title to nodes
|
||||||
for node in net.nodes:
|
for node in net.nodes:
|
||||||
node["color"] = "#{:06x}".format(random.randint(0, 0xFFFFFF))
|
node["color"] = "#{:06x}".format(random.randint(0, 0xFFFFFF))
|
||||||
|
if "description" in node:
|
||||||
|
node["title"] = node["description"]
|
||||||
|
|
||||||
|
# Add title to edges
|
||||||
|
for edge in net.edges:
|
||||||
|
if "description" in edge:
|
||||||
|
edge["title"] = edge["description"]
|
||||||
|
|
||||||
# Save and display the network
|
# Save and display the network
|
||||||
net.show("knowledge_graph.html")
|
net.show("knowledge_graph.html")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user