Classes
GraphNode
dataclass
Node in the graph visualization.
GraphNode
dataclass Node in the graph visualization.
Attributes
| Name | Type | Description |
|---|---|---|
id |
str |
Unique identifier for the node |
label |
str |
Display label (page title) |
url |
str |
URL to the page |
type |
str |
Page type (page, index, generated, etc.) |
tags |
list[str] |
List of tags |
incoming_refs |
int |
Number of incoming references |
outgoing_refs |
int |
Number of outgoing references |
connectivity |
int |
Total connectivity score |
size |
int |
Visual size (based on connectivity) |
color |
str |
Node color (based on type or connectivity) |
GraphEdge
dataclass
Edge in the graph visualization.
GraphEdge
dataclass Edge in the graph visualization.
Attributes
| Name | Type | Description |
|---|---|---|
source |
str |
Source node ID |
target |
str |
Target node ID |
weight |
int |
Edge weight (link strength) |
GraphVisualizer
Generate interactive D3.js visualizations of knowledge graphs.
Creates standalone HTML files with:…
GraphVisualizer
Generate interactive D3.js visualizations of knowledge graphs.
Creates standalone HTML files with:
- Force-directed graph layout
- Interactive node exploration
- Search and filtering
- Responsive design
- Customizable styling
Methods 2
generate_graph_data
Generate D3.js-compatible graph data.
generate_graph_data
def generate_graph_data(self) -> dict[str, Any]
Generate D3.js-compatible graph data.
Returns
Dictionary with 'nodes' and 'edges' arraysdict[str, Any]
—
generate_html
Generate complete standalone HTML visualization.
generate_html
def generate_html(self, title: str | None = None) -> str
Generate complete standalone HTML visualization.
Parameters 1
title |
str | None |
Page title (defaults to site title) |
Returns
Complete HTML document as stringstr
—
Internal Methods 3
__init__
Initialize graph visualizer.
__init__
def __init__(self, site: Site, graph: KnowledgeGraph)
Initialize graph visualizer.
Parameters 2
site |
Site |
Site instance |
graph |
KnowledgeGraph |
Built KnowledgeGraph instance |
_get_page_id
Get a stable ID for a page (using source_path hash).
_get_page_id
def _get_page_id(self, page: Any) -> str
Get a stable ID for a page (using source_path hash).
Parameters 1
page |
Any |
Page object |
Returns
String ID for the pagestr
—
_get_node_color
Determine node color based on page properties.
Returns CSS variable name that …
_get_node_color
def _get_node_color(self, page: Any, connectivity: Any) -> str
Determine node color based on page properties.
Returns CSS variable name that will be resolved in JavaScript. JavaScript will read the computed value from CSS custom properties.
Parameters 2
page |
Any |
Page object |
connectivity |
Any |
PageConnectivity object |
Returns
CSS variable name (e.g., "var(--graph-node-hub)")str
—