Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /HKUDS_LightRAG /examples /graph_visual_with_html.py
| import pipmaster as pm | |
| if not pm.is_installed("pyvis"): | |
| pm.install("pyvis") | |
| if not pm.is_installed("networkx"): | |
| pm.install("networkx") | |
| import networkx as nx | |
| from pyvis.network import Network | |
| import random | |
| # Load the GraphML file | |
| G = nx.read_graphml("./dickens/graph_chunk_entity_relation.graphml") | |
| # Create a Pyvis network | |
| net = Network(height="100vh", notebook=True) | |
| # Convert NetworkX graph to Pyvis network | |
| net.from_nx(G) | |
| # Add colors and title to nodes | |
| for node in net.nodes: | |
| 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 | |
| net.show("knowledge_graph.html") | |
Xet Storage Details
- Size:
- 819 Bytes
- Xet hash:
- dec256dc840fa5dcb6e8b950ef0aebb3ce8b3e4f0bf89f1b24d0fcdd122affbb
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.