|
|
|
@ -8,26 +8,26 @@ use miette::{bail, ensure, Diagnostic, Result};
|
|
|
|
|
use smartstring::{LazyCompact, SmartString};
|
|
|
|
|
use thiserror::Error;
|
|
|
|
|
|
|
|
|
|
use crate::algo::all_pairs_shortest_path::{BetweennessCentrality, ClosenessCentrality};
|
|
|
|
|
use crate::algo::astar::ShortestPathAStar;
|
|
|
|
|
use crate::algo::bfs::Bfs;
|
|
|
|
|
// use crate::algo::all_pairs_shortest_path::{BetweennessCentrality, ClosenessCentrality};
|
|
|
|
|
// use crate::algo::astar::ShortestPathAStar;
|
|
|
|
|
// use crate::algo::bfs::Bfs;
|
|
|
|
|
use crate::algo::constant::Constant;
|
|
|
|
|
use crate::algo::csv::CsvReader;
|
|
|
|
|
use crate::algo::degree_centrality::DegreeCentrality;
|
|
|
|
|
use crate::algo::dfs::Dfs;
|
|
|
|
|
use crate::algo::jlines::JsonReader;
|
|
|
|
|
use crate::algo::kruskal::MinimumSpanningForestKruskal;
|
|
|
|
|
use crate::algo::label_propagation::LabelPropagation;
|
|
|
|
|
use crate::algo::louvain::CommunityDetectionLouvain;
|
|
|
|
|
use crate::algo::pagerank::PageRank;
|
|
|
|
|
use crate::algo::prim::MinimumSpanningTreePrim;
|
|
|
|
|
use crate::algo::random_walk::RandomWalk;
|
|
|
|
|
use crate::algo::reorder_sort::ReorderSort;
|
|
|
|
|
use crate::algo::shortest_path_dijkstra::ShortestPathDijkstra;
|
|
|
|
|
// use crate::algo::csv::CsvReader;
|
|
|
|
|
// use crate::algo::degree_centrality::DegreeCentrality;
|
|
|
|
|
// use crate::algo::dfs::Dfs;
|
|
|
|
|
// use crate::algo::jlines::JsonReader;
|
|
|
|
|
// use crate::algo::kruskal::MinimumSpanningForestKruskal;
|
|
|
|
|
// use crate::algo::label_propagation::LabelPropagation;
|
|
|
|
|
// use crate::algo::louvain::CommunityDetectionLouvain;
|
|
|
|
|
// use crate::algo::pagerank::PageRank;
|
|
|
|
|
// use crate::algo::prim::MinimumSpanningTreePrim;
|
|
|
|
|
// use crate::algo::random_walk::RandomWalk;
|
|
|
|
|
// use crate::algo::reorder_sort::ReorderSort;
|
|
|
|
|
// use crate::algo::shortest_path_dijkstra::ShortestPathDijkstra;
|
|
|
|
|
use crate::algo::strongly_connected_components::StronglyConnectedComponent;
|
|
|
|
|
use crate::algo::top_sort::TopSort;
|
|
|
|
|
use crate::algo::triangles::ClusteringCoefficients;
|
|
|
|
|
use crate::algo::yen::KShortestPathYen;
|
|
|
|
|
// use crate::algo::top_sort::TopSort;
|
|
|
|
|
// use crate::algo::triangles::ClusteringCoefficients;
|
|
|
|
|
// use crate::algo::yen::KShortestPathYen;
|
|
|
|
|
use crate::data::expr::Expr;
|
|
|
|
|
use crate::data::program::{MagicAlgoApply, MagicAlgoRuleArg, MagicSymbol};
|
|
|
|
|
use crate::data::symb::Symbol;
|
|
|
|
@ -38,26 +38,26 @@ use crate::runtime::db::Poison;
|
|
|
|
|
use crate::runtime::in_mem::InMemRelation;
|
|
|
|
|
use crate::runtime::transact::SessionTx;
|
|
|
|
|
|
|
|
|
|
pub(crate) mod all_pairs_shortest_path;
|
|
|
|
|
pub(crate) mod astar;
|
|
|
|
|
pub(crate) mod bfs;
|
|
|
|
|
// pub(crate) mod all_pairs_shortest_path;
|
|
|
|
|
// pub(crate) mod astar;
|
|
|
|
|
// pub(crate) mod bfs;
|
|
|
|
|
pub(crate) mod constant;
|
|
|
|
|
pub(crate) mod csv;
|
|
|
|
|
pub(crate) mod degree_centrality;
|
|
|
|
|
pub(crate) mod dfs;
|
|
|
|
|
pub(crate) mod jlines;
|
|
|
|
|
pub(crate) mod kruskal;
|
|
|
|
|
pub(crate) mod label_propagation;
|
|
|
|
|
pub(crate) mod louvain;
|
|
|
|
|
pub(crate) mod pagerank;
|
|
|
|
|
pub(crate) mod prim;
|
|
|
|
|
pub(crate) mod random_walk;
|
|
|
|
|
pub(crate) mod reorder_sort;
|
|
|
|
|
pub(crate) mod shortest_path_dijkstra;
|
|
|
|
|
// pub(crate) mod csv;
|
|
|
|
|
// pub(crate) mod degree_centrality;
|
|
|
|
|
// pub(crate) mod dfs;
|
|
|
|
|
// pub(crate) mod jlines;
|
|
|
|
|
// pub(crate) mod kruskal;
|
|
|
|
|
// pub(crate) mod label_propagation;
|
|
|
|
|
// pub(crate) mod louvain;
|
|
|
|
|
// pub(crate) mod pagerank;
|
|
|
|
|
// pub(crate) mod prim;
|
|
|
|
|
// pub(crate) mod random_walk;
|
|
|
|
|
// pub(crate) mod reorder_sort;
|
|
|
|
|
// pub(crate) mod shortest_path_dijkstra;
|
|
|
|
|
pub(crate) mod strongly_connected_components;
|
|
|
|
|
pub(crate) mod top_sort;
|
|
|
|
|
pub(crate) mod triangles;
|
|
|
|
|
pub(crate) mod yen;
|
|
|
|
|
// pub(crate) mod top_sort;
|
|
|
|
|
// pub(crate) mod triangles;
|
|
|
|
|
// pub(crate) mod yen;
|
|
|
|
|
|
|
|
|
|
pub(crate) trait AlgoImpl {
|
|
|
|
|
fn run<'a>(
|
|
|
|
@ -106,29 +106,29 @@ impl AlgoHandle {
|
|
|
|
|
|
|
|
|
|
pub(crate) fn get_impl(&self) -> Result<Box<dyn AlgoImpl>> {
|
|
|
|
|
Ok(match &self.name.name as &str {
|
|
|
|
|
"ClusteringCoefficients" => Box::new(ClusteringCoefficients),
|
|
|
|
|
"DegreeCentrality" => Box::new(DegreeCentrality),
|
|
|
|
|
"ClosenessCentrality" => Box::new(ClosenessCentrality),
|
|
|
|
|
"BetweennessCentrality" => Box::new(BetweennessCentrality),
|
|
|
|
|
"DepthFirstSearch" | "DFS" => Box::new(Dfs),
|
|
|
|
|
"BreadthFirstSearch" | "BFS" => Box::new(Bfs),
|
|
|
|
|
"ShortestPathDijkstra" => Box::new(ShortestPathDijkstra),
|
|
|
|
|
"ShortestPathAStar" => Box::new(ShortestPathAStar),
|
|
|
|
|
"KShortestPathYen" => Box::new(KShortestPathYen),
|
|
|
|
|
"MinimumSpanningTreePrim" => Box::new(MinimumSpanningTreePrim),
|
|
|
|
|
"MinimumSpanningForestKruskal" => Box::new(MinimumSpanningForestKruskal),
|
|
|
|
|
"TopSort" => Box::new(TopSort),
|
|
|
|
|
"ConnectedComponents" => Box::new(StronglyConnectedComponent::new(false)),
|
|
|
|
|
// "ClusteringCoefficients" => Box::new(ClusteringCoefficients),
|
|
|
|
|
// "DegreeCentrality" => Box::new(DegreeCentrality),
|
|
|
|
|
// "ClosenessCentrality" => Box::new(ClosenessCentrality),
|
|
|
|
|
// "BetweennessCentrality" => Box::new(BetweennessCentrality),
|
|
|
|
|
// "DepthFirstSearch" | "DFS" => Box::new(Dfs),
|
|
|
|
|
// "BreadthFirstSearch" | "BFS" => Box::new(Bfs),
|
|
|
|
|
// "ShortestPathDijkstra" => Box::new(ShortestPathDijkstra),
|
|
|
|
|
// "ShortestPathAStar" => Box::new(ShortestPathAStar),
|
|
|
|
|
// "KShortestPathYen" => Box::new(KShortestPathYen),
|
|
|
|
|
// "MinimumSpanningTreePrim" => Box::new(MinimumSpanningTreePrim),
|
|
|
|
|
// "MinimumSpanningForestKruskal" => Box::new(MinimumSpanningForestKruskal),
|
|
|
|
|
// "TopSort" => Box::new(TopSort),
|
|
|
|
|
// "ConnectedComponents" => Box::new(StronglyConnectedComponent::new(false)),
|
|
|
|
|
"StronglyConnectedComponents" | "SCC" => {
|
|
|
|
|
Box::new(StronglyConnectedComponent::new(true))
|
|
|
|
|
}
|
|
|
|
|
"PageRank" => Box::new(PageRank),
|
|
|
|
|
"CommunityDetectionLouvain" => Box::new(CommunityDetectionLouvain),
|
|
|
|
|
"LabelPropagation" => Box::new(LabelPropagation),
|
|
|
|
|
"RandomWalk" => Box::new(RandomWalk),
|
|
|
|
|
"ReorderSort" => Box::new(ReorderSort),
|
|
|
|
|
"JsonReader" => Box::new(JsonReader),
|
|
|
|
|
"CsvReader" => Box::new(CsvReader),
|
|
|
|
|
// "PageRank" => Box::new(PageRank),
|
|
|
|
|
// "CommunityDetectionLouvain" => Box::new(CommunityDetectionLouvain),
|
|
|
|
|
// "LabelPropagation" => Box::new(LabelPropagation),
|
|
|
|
|
// "RandomWalk" => Box::new(RandomWalk),
|
|
|
|
|
// "ReorderSort" => Box::new(ReorderSort),
|
|
|
|
|
// "JsonReader" => Box::new(JsonReader),
|
|
|
|
|
// "CsvReader" => Box::new(CsvReader),
|
|
|
|
|
"Constant" => Box::new(Constant),
|
|
|
|
|
name => bail!(AlgoNotFoundError(name.to_string(), self.name.span)),
|
|
|
|
|
})
|
|
|
|
|