mod id_map;
pub mod projection;
mod traversal;
pub mod algorithms;
pub mod cypher;
pub mod procedure_template;
pub mod procedures;
pub use id_map::IdMap;
pub use projection::{GraphProjection, ProjectionBuilder, ProjectionConfig};
pub use traversal::{BfsIterator, DirectTraversal, Path};
#[cfg(test)]
pub mod test_utils;
use std::collections::HashMap;
use std::sync::Arc;
pub struct AlgorithmRegistry {
procedures: HashMap<String, Arc<dyn procedures::AlgoProcedure>>,
}
impl AlgorithmRegistry {
pub fn new() -> Self {
let mut registry = Self {
procedures: HashMap::default(),
};
registry.register(cypher::PageRankProcedure::default());
registry.register(cypher::WccProcedure::default());
registry.register(cypher::ShortestPathProcedure);
registry.register(cypher::LouvainProcedure::default());
registry.register(cypher::LabelPropagationProcedure::default());
registry.register(cypher::BetweennessProcedure::default());
registry.register(cypher::NodeSimilarityProcedure::default());
registry.register(cypher::ClosenessProcedure::default());
registry.register(cypher::TriangleCountProcedure::default());
registry.register(cypher::KCoreProcedure::default());
registry.register(cypher::RandomWalkProcedure::default());
registry.register(cypher::AllPairsShortestPathProcedure::default());
registry.register(cypher::SccProcedure::default());
registry.register(cypher::TopologicalSortProcedure::default());
registry.register(cypher::CycleDetectionProcedure::default());
registry.register(cypher::BipartiteCheckProcedure::default());
registry.register(cypher::BridgesProcedure::default());
registry.register(cypher::ArticulationPointsProcedure::default());
registry.register(cypher::AStarProcedure);
registry.register(cypher::BellmanFordProcedure::default());
registry.register(cypher::BidirectionalDijkstraProcedure::default());
registry.register(cypher::KShortestPathsProcedure::default());
registry.register(cypher::MstProcedure::default());
registry.register(cypher::MaxMatchingProcedure::default());
registry.register(cypher::DinicProcedure::default());
registry.register(cypher::FordFulkersonProcedure::default());
registry.register(cypher::GraphMetricsProcedure::default());
registry.register(cypher::DiameterProcedure::default());
registry.register(cypher::DegreeCentralityProcedure::default());
registry.register(cypher::HarmonicCentralityProcedure::default());
registry.register(cypher::EigenvectorCentralityProcedure::default());
registry.register(cypher::KatzCentralityProcedure::default());
registry.register(cypher::MaximalCliquesProcedure::default());
registry.register(cypher::AllSimplePathsProcedure);
registry.register(cypher::ElementaryCircuitsProcedure::default());
registry.register(cypher::GraphColoringProcedure::default());
registry
}
pub fn register<P: procedures::AlgoProcedure + 'static>(&mut self, proc: P) {
self.procedures
.insert(proc.name().to_string(), Arc::new(proc));
}
pub fn get(&self, name: &str) -> Option<Arc<dyn procedures::AlgoProcedure>> {
self.procedures.get(name).cloned()
}
pub fn list(&self) -> Vec<&str> {
self.procedures.keys().map(|s| s.as_str()).collect()
}
}
impl Default for AlgorithmRegistry {
fn default() -> Self {
Self::new()
}
}
#[derive(Debug, Clone)]
pub struct AlgorithmConfig {
pub max_projection_memory: usize,
pub max_vertices: usize,
pub l0_warning_threshold: f64,
}
impl Default for AlgorithmConfig {
fn default() -> Self {
Self {
max_projection_memory: 1 << 30, max_vertices: 100_000_000, l0_warning_threshold: 0.1, }
}
}