Skip to main content

linkrs_query/planning/plan/logical/logical_nodes/
algorithm.rs

1//! Logical algorithm nodes: MultiShortestPath, BFSShortest, AllPaths, ShortestPath.
2
3use crate::define_logical_binary_input_node;
4use linkrs_core::types::EdgeDirection;
5use linkrs_core::types::VertexId;
6use linkrs_core::Value;
7
8define_logical_binary_input_node! {
9    pub struct LogicalMultiShortestPathNode {
10        steps: usize,
11        left_vid_var: String,
12        right_vid_var: String,
13        termination_var: String,
14        single_shortest: bool,
15        edge_types: Vec<String>,
16        direction: EdgeDirection,
17        target_vertex_ids: Vec<Value>,
18    }
19    enum: MultiShortestPath
20    input: BinaryInputNode
21}
22
23define_logical_binary_input_node! {
24    pub struct LogicalBFSShortestNode {
25        space_id: u64,
26        steps: usize,
27        edge_types: Vec<String>,
28        with_walk: bool,
29        with_loop: bool,
30        reverse: bool,
31    }
32    enum: BFSShortest
33    input: BinaryInputNode
34}
35
36define_logical_binary_input_node! {
37    pub struct LogicalAllPathsNode {
38        space_id: u64,
39        steps: usize,
40        edge_types: Vec<String>,
41        min_hop: usize,
42        max_hop: usize,
43        path_uniqueness: crate::planning::plan::core::nodes::traversal::path_algorithms::PathUniqueness,
44        direction: EdgeDirection,
45        has_step_limit: bool,
46        limit: i64,
47        offset: i64,
48        filter: Option<linkrs_core::types::expr::contextual::ContextualExpression>,
49        start_vertex_ids: Vec<VertexId>,
50        end_vertex_ids: Vec<VertexId>,
51    }
52    enum: AllPaths
53    input: BinaryInputNode
54}
55
56define_logical_binary_input_node! {
57    pub struct LogicalShortestPathNode {
58        space_id: u64,
59        edge_types: Vec<String>,
60        max_step: usize,
61        weight_expression: Option<String>,
62        heuristic_expression: Option<String>,
63        no_reverse: bool,
64        start_vertex_ids: Vec<Value>,
65        end_vertex_ids: Vec<Value>,
66    }
67    enum: ShortestPath
68    input: BinaryInputNode
69}