graphrust_ffi/
cxx_bindings.rs1use crate::FFIGraph;
10
11pub struct AlgorithmWrapper;
13
14impl AlgorithmWrapper {
15 pub fn bfs_traverse_cpp(graph: &FFIGraph, start: u32) -> Vec<u32> {
17 graph.bfs_traverse_ffi(start)
18 }
19
20 pub fn dijkstra_cpp(graph: &FFIGraph, start: u32) -> Vec<f64> {
22 graph.dijkstra_ffi(start)
23 }
24
25 pub fn pagerank_cpp(graph: &FFIGraph, iterations: u32, damping_factor: f64) -> Vec<f64> {
27 graph.pagerank_ffi(iterations, damping_factor)
28 }
29
30 pub fn triangle_count_cpp(graph: &FFIGraph) -> u64 {
32 graph.triangle_count_ffi()
33 }
34
35 pub fn component_count_cpp(graph: &FFIGraph) -> u32 {
37 graph.component_count_ffi()
38 }
39
40 pub fn clustering_coefficient_cpp(graph: &FFIGraph) -> f64 {
42 graph.clustering_coefficient_ffi()
43 }
44}
45
46#[cfg(test)]
47mod tests {
48 use super::*;
49
50 #[test]
51 fn test_algorithm_wrapper() {
52 let _graph = FFIGraph::new(5, true);
53 }
55}