src/visualize¶
Phase 5 module for generating interactive HTML visualizations.
Functions¶
build_networkx_graph(graph_json_path: str) → nx.DiGraph¶
Load a knowledge graph from a JSON file into a NetworkX DiGraph.
Parameters:
| Name | Type | Description |
|---|---|---|
graph_json_path |
str |
Path to knowledge_graph.json |
Returns: NetworkX directed graph.
create_network_viz(G: nx.DiGraph, output_path: str) → None¶
Generate an interactive force-directed network graph using Pyvis.
Parameters:
| Name | Type | Description |
|---|---|---|
G |
nx.DiGraph |
Knowledge graph |
output_path |
str |
Output HTML file path |
Features:
- Nodes colored by type (gold=Laureate, light blue=Work, green=Concept, orange=Award, purple=Field)
- Node sizes scaled by degree
CROSS_INSPIREDedges highlighted in red with increased width- Barnes-Hut physics simulation for layout
- HTML legend overlay
create_timeline_viz(G: nx.DiGraph, output_path: str) → None¶
Generate a timeline scatter plot of concepts using Plotly.
Parameters:
| Name | Type | Description |
|---|---|---|
G |
nx.DiGraph |
Knowledge graph |
output_path |
str |
Output HTML file path |
Features:
- X-axis: Year, Y-axis: Field
- Marker size scaled by connection count
- Red arrow annotations for
CROSS_INSPIREDedges - Hover text with concept details
create_heatmap_viz(G: nx.DiGraph, output_path: str) → None¶
Generate a field-to-field cross-discipline heatmap using Plotly.
Parameters:
| Name | Type | Description |
|---|---|---|
G |
nx.DiGraph |
Knowledge graph |
output_path |
str |
Output HTML file path |
Features:
- Square matrix of source field × target field
- YlOrRd color scale
- Hover showing exact migration count
run() → None¶
Execute the full Phase 5 pipeline:
- Load configuration
- Build graph from JSON
- Generate
network.html - Generate
timeline.html - Generate
heatmap.html