Find paths with type constraints
(
&self,
start_node_id: &str,
path_elements: &[PathElement],
path_type: &PathType,
graph: &Arc<GraphCache>,
_context: &mut ExecutionContext,
)
| 6392 | |
| 6393 | /// Find paths with type constraints |
| 6394 | fn find_paths_with_constraints( |
| 6395 | &self, |
| 6396 | start_node_id: &str, |
| 6397 | path_elements: &[PathElement], |
| 6398 | path_type: &PathType, |
| 6399 | graph: &Arc<GraphCache>, |
| 6400 | _context: &mut ExecutionContext, |
| 6401 | ) -> Result<Vec<Vec<String>>, ExecutionError> { |
| 6402 | let mut all_paths = Vec::new(); |
| 6403 | let mut current_paths = vec![vec![start_node_id.to_string()]]; |
| 6404 | let mut visited_nodes = std::collections::HashSet::new(); |
| 6405 | let mut visited_edges = std::collections::HashSet::new(); |
| 6406 | |
| 6407 | // For each path element, expand the paths |
| 6408 | for element in path_elements { |
| 6409 | let mut new_paths = Vec::new(); |
| 6410 | |
| 6411 | for path in current_paths { |
| 6412 | // Handle quantifiers |
| 6413 | let element_paths = self.expand_quantified_element( |
| 6414 | &path, |
| 6415 | element, |
| 6416 | path_type, |
| 6417 | graph, |
| 6418 | &mut visited_nodes, |
| 6419 | &mut visited_edges, |
| 6420 | )?; |
| 6421 | |
| 6422 | new_paths.extend(element_paths); |
| 6423 | } |
| 6424 | |
| 6425 | current_paths = new_paths; |
| 6426 | } |
| 6427 | |
| 6428 | // Add final node if needed (path_elements might be empty for simple patterns) |
| 6429 | all_paths.extend(current_paths); |
| 6430 | |
| 6431 | Ok(all_paths) |
| 6432 | } |
| 6433 | |
| 6434 | /// Expand a quantified path element (handles {n,m}, ?, etc.) |
| 6435 | fn expand_quantified_element( |
no test coverage detected