Skip to main content

Crate fabryk_graph

Crate fabryk_graph 

Source
Expand description

Knowledge graph infrastructure for Fabryk.

This crate provides graph storage, traversal algorithms, and persistence using petgraph and optional rkyv caching.

§Features

  • graph-rkyv-cache: Enable rkyv-based graph persistence with content-hash cache validation
  • test-utils: Export mock types for testing in downstream crates

§Key Abstractions

  • GraphExtractor trait: Domain implementations provide this to extract nodes and edges from content files
  • Relationship enum: Common relationship types with Custom(String) for domain-specific relationships
  • NodeType enum: Distinguishes domain vs user-query nodes
  • GraphData: Core graph structure with runtime mutation support

Re-exports§

pub use algorithms::CentralityScore;
pub use algorithms::NeighborhoodResult;
pub use algorithms::PathResult;
pub use algorithms::PrerequisitesResult;
pub use algorithms::calculate_centrality;
pub use algorithms::find_bridges;
pub use algorithms::neighborhood;
pub use algorithms::prerequisites_sorted;
pub use algorithms::shortest_path;
pub use builder::BuildError;
pub use builder::BuildStats;
pub use builder::ErrorHandling;
pub use builder::GraphBuilder;
pub use builder::ManualEdge;
pub use extractor::GraphExtractor;
pub use persistence::GraphMetadata;
pub use persistence::SerializableGraph;
pub use persistence::is_cache_fresh;
pub use persistence::load_graph;
pub use persistence::load_graph_from_str;
pub use persistence::save_graph;
pub use query::CategoryCount;
pub use query::EdgeInfo;
pub use query::GraphInfoResponse;
pub use query::NeighborInfo;
pub use query::NeighborhoodResponse;
pub use query::NodeSummary;
pub use query::PathResponse;
pub use query::PathStep;
pub use query::PrerequisiteInfo;
pub use query::PrerequisitesResponse;
pub use query::RelatedConceptsResponse;
pub use query::RelatedGroup;
pub use query::RelationshipCount;
pub use stats::DegreeDirection;
pub use stats::GraphStats;
pub use stats::compute_stats;
pub use stats::quick_summary;
pub use stats::top_nodes_by_degree;
pub use types::Edge;
pub use types::EdgeOrigin;
pub use types::GraphData;
pub use types::Node;
pub use types::NodeType;
pub use types::Relationship;
pub use validation::ValidationIssue;
pub use validation::ValidationResult;
pub use validation::is_valid;
pub use validation::validate_graph;

Modules§

algorithms
Graph algorithms for knowledge graph analysis.
builder
GraphBuilder for constructing knowledge graphs.
extractor
GraphExtractor trait for domain-specific graph extraction.
persistence
Graph persistence and caching.
query
Query response types for graph operations.
stats
Graph statistics and analysis.
types
Core graph types for Fabryk domains.
validation
Graph validation and integrity checking.