Skip to main content

reddb_server/application/
ports_impls_graph.rs

1use super::*;
2impl RuntimeGraphPort for RedDBRuntime {
3    fn resolve_graph_projection(
4        &self,
5        name: Option<&str>,
6        inline: Option<RuntimeGraphProjection>,
7    ) -> RedDBResult<Option<RuntimeGraphProjection>> {
8        RedDBRuntime::resolve_graph_projection(self, name, inline)
9    }
10
11    fn graph_neighborhood(
12        &self,
13        node: &str,
14        direction: RuntimeGraphDirection,
15        max_depth: usize,
16        edge_labels: Option<Vec<String>>,
17        projection: Option<RuntimeGraphProjection>,
18    ) -> RedDBResult<RuntimeGraphNeighborhoodResult> {
19        RedDBRuntime::graph_neighborhood(self, node, direction, max_depth, edge_labels, projection)
20    }
21
22    fn graph_traverse(
23        &self,
24        source: &str,
25        direction: RuntimeGraphDirection,
26        max_depth: usize,
27        strategy: RuntimeGraphTraversalStrategy,
28        edge_labels: Option<Vec<String>>,
29        projection: Option<RuntimeGraphProjection>,
30    ) -> RedDBResult<RuntimeGraphTraversalResult> {
31        RedDBRuntime::graph_traverse(
32            self,
33            source,
34            direction,
35            max_depth,
36            strategy,
37            edge_labels,
38            projection,
39        )
40    }
41
42    fn graph_shortest_path(
43        &self,
44        source: &str,
45        target: &str,
46        direction: RuntimeGraphDirection,
47        algorithm: RuntimeGraphPathAlgorithm,
48        edge_labels: Option<Vec<String>>,
49        projection: Option<RuntimeGraphProjection>,
50    ) -> RedDBResult<RuntimeGraphPathResult> {
51        RedDBRuntime::graph_shortest_path(
52            self,
53            source,
54            target,
55            direction,
56            algorithm,
57            edge_labels,
58            projection,
59        )
60    }
61
62    fn graph_components(
63        &self,
64        mode: RuntimeGraphComponentsMode,
65        min_size: usize,
66        projection: Option<RuntimeGraphProjection>,
67    ) -> RedDBResult<RuntimeGraphComponentsResult> {
68        RedDBRuntime::graph_components(self, mode, min_size, projection)
69    }
70
71    fn graph_centrality(
72        &self,
73        algorithm: RuntimeGraphCentralityAlgorithm,
74        top_k: usize,
75        normalize: bool,
76        max_iterations: Option<usize>,
77        epsilon: Option<f64>,
78        alpha: Option<f64>,
79        projection: Option<RuntimeGraphProjection>,
80    ) -> RedDBResult<RuntimeGraphCentralityResult> {
81        RedDBRuntime::graph_centrality(
82            self,
83            algorithm,
84            top_k,
85            normalize,
86            max_iterations,
87            epsilon,
88            alpha,
89            projection,
90        )
91    }
92
93    fn graph_communities(
94        &self,
95        algorithm: crate::runtime::RuntimeGraphCommunityAlgorithm,
96        min_size: usize,
97        max_iterations: Option<usize>,
98        resolution: Option<f64>,
99        projection: Option<RuntimeGraphProjection>,
100    ) -> RedDBResult<RuntimeGraphCommunityResult> {
101        RedDBRuntime::graph_communities(
102            self,
103            algorithm,
104            min_size,
105            max_iterations,
106            resolution,
107            projection,
108        )
109    }
110
111    fn graph_clustering(
112        &self,
113        top_k: usize,
114        include_triangles: bool,
115        projection: Option<RuntimeGraphProjection>,
116    ) -> RedDBResult<RuntimeGraphClusteringResult> {
117        RedDBRuntime::graph_clustering(self, top_k, include_triangles, projection)
118    }
119
120    fn graph_personalized_pagerank(
121        &self,
122        seeds: Vec<String>,
123        top_k: usize,
124        alpha: Option<f64>,
125        epsilon: Option<f64>,
126        max_iterations: Option<usize>,
127        projection: Option<RuntimeGraphProjection>,
128    ) -> RedDBResult<RuntimeGraphCentralityResult> {
129        RedDBRuntime::graph_personalized_pagerank(
130            self,
131            seeds,
132            top_k,
133            alpha,
134            epsilon,
135            max_iterations,
136            projection,
137        )
138    }
139
140    fn graph_hits(
141        &self,
142        top_k: usize,
143        epsilon: Option<f64>,
144        max_iterations: Option<usize>,
145        projection: Option<RuntimeGraphProjection>,
146    ) -> RedDBResult<RuntimeGraphHitsResult> {
147        RedDBRuntime::graph_hits(self, top_k, epsilon, max_iterations, projection)
148    }
149
150    fn graph_cycles(
151        &self,
152        max_length: usize,
153        max_cycles: usize,
154        projection: Option<RuntimeGraphProjection>,
155    ) -> RedDBResult<RuntimeGraphCyclesResult> {
156        RedDBRuntime::graph_cycles(self, max_length, max_cycles, projection)
157    }
158
159    fn graph_topological_sort(
160        &self,
161        projection: Option<RuntimeGraphProjection>,
162    ) -> RedDBResult<RuntimeGraphTopologicalSortResult> {
163        RedDBRuntime::graph_topological_sort(self, projection)
164    }
165
166    fn graph_properties(
167        &self,
168        projection: Option<RuntimeGraphProjection>,
169    ) -> RedDBResult<RuntimeGraphPropertiesResult> {
170        RedDBRuntime::graph_properties(self, projection)
171    }
172}