Expand description
§Link Graph Analysis
Link graph implementation for Obsidian vault relationships using petgraph.
Provides:
- Directed graph of vault files and links
- Link resolution (wikilinks, aliases, folder paths)
- Backlink queries
- Related notes discovery (BFS)
- Orphan detection
- Cycle detection
- Graph statistics
- Vault health analysis
- Broken link detection
§Quick Start
use turbovault_graph::LinkGraph;
// Create a new link graph
let graph = LinkGraph::new();
// The graph is built by adding VaultFile objects
// and their links will be indexed automatically
println!("Nodes: {}", graph.node_count());
println!("Edges: {}", graph.edge_count());§Core Concepts
§Nodes and Edges
- Nodes: Represent vault files (notes)
- Edges: Represent links between files
- Directed: Links flow from source to target
§Graph Operations
- Backlinks: Find all notes linking to a given note
- Forward Links: Find all notes linked from a given note
- Related Notes: Discover related notes through BFS traversal
- Orphans: Find isolated notes with no links in or out
§Vault Health Metrics
The health analyzer provides:
- Health Score: Overall vault connectivity (0-100)
- Connectivity Rate: Percentage of connected notes
- Link Density: Ratio of existing links to possible links
- Broken Links: Links to non-existent targets
- Orphaned Notes: Isolated notes with no relationships
§Advanced Usage
§Finding Broken Links
use turbovault_graph::{LinkGraph, HealthAnalyzer};
let graph = LinkGraph::new();
// Create health analyzer for comprehensive analysis
let analyzer = HealthAnalyzer::new(&graph);
// Analyze vault health (includes broken link detection)
if let Ok(report) = analyzer.analyze() {
for broken in &report.broken_links {
println!("Broken: {} -> {}",
broken.source_file.display(),
broken.target
);
}
}§Graph Statistics
use turbovault_graph::LinkGraph;
let graph = LinkGraph::new();
println!("Nodes: {}", graph.node_count());
println!("Edges: {}", graph.edge_count());§Modules
§Performance Characteristics
Built on petgraph for optimal performance:
- Graph construction: O(n + m) where n = nodes, m = edges
- Backlink queries: O(degree) with caching
- Orphan detection: O(n)
- Cycle detection: O(n + m)
- Health analysis: O(n + m)
Re-exports§
pub use graph::GraphStats;pub use graph::LinkGraph;pub use health::BrokenLink;pub use health::HealthAnalyzer;pub use health::HealthReport;
Modules§
- graph
- Link graph using petgraph for vault relationship analysis
- health
- Vault health analysis and broken link detection.
- prelude
Structs§
- Block
- A block in vault content
- Callout
- A callout block in vault content
- Composite
Validator - Composite validator that runs multiple validators
- Content
Validator - Validates file content structure
- Counter
- A lock-free counter metric (monotonically increasing)
- File
Metadata - File metadata
- Frontmatter
- YAML frontmatter
- Frontmatter
Validator - Validates frontmatter structure and required fields
- Heading
- A heading in vault content
- Histogram
- A histogram for tracking value distributions
- Link
- A link in vault content
- Link
Validator - Validates link syntax and format
- Metrics
Context - Global metrics context registry (rarely used)
- Multi
Vault Manager - Multi-vault manager coordinating multiple vaults
- Server
Config - Global server configuration
- Source
Position - Position in source text (line, column, byte offset)
- Tag
- A tag in vault content
- Task
Item - A task item in vault content
- Validation
Issue - A validation issue found in content
- Validation
Report - Result of validating content
- Vault
Config - Configuration for a single vault
- Vault
File - A complete vault file with parsed content
- Vault
Info - Information about a registered vault
Enums§
- Config
Profile - Profile selector for pre-configured deployments
- Error
- The core error type for all Obsidian operations.
- Link
Type - Type of link in Obsidian content
- Severity
- Severity level for validation issues
Traits§
- Validator
- Trait for content validators
Type Aliases§
- Result
- Convenient Result type alias