File size: 470 Bytes
c60583f
 
0d5fe24
c60583f
 
9590c46
c60583f
 
ad3d10d
c60583f
 
 
 
0d5fe24
 
9590c46
0d5fe24
c60583f
9590c46
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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 to nodes
for node in net.nodes:
    node["color"] = "#{:06x}".format(random.randint(0, 0xFFFFFF))

# Save and display the network
net.show("knowledge_graph.html")