Skip to content

Commit

Permalink
Reverse direction in shortest path
Browse files Browse the repository at this point in the history
  • Loading branch information
JustusAdam committed Sep 6, 2024
1 parent b1b1a2b commit 01e95ed
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions crates/paralegal-policy/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use paralegal_spdg::{
use anyhow::{anyhow, bail, Result};
use itertools::{Either, Itertools};
use petgraph::prelude::Bfs;
use petgraph::visit::{EdgeFiltered, EdgeRef, IntoNeighborsDirected, Topo, Walker};
use petgraph::visit::{EdgeFiltered, EdgeRef, IntoNeighborsDirected, Reversed, Topo, Walker};
use petgraph::Direction::Outgoing;
use petgraph::{Direction, Incoming};

Expand Down Expand Up @@ -923,7 +923,8 @@ impl NodeExt for GlobalNode {
&ctx.desc.controllers[&self.controller_id()]
};
let mut ancestors = HashMap::new();
let fg = edge_selection.filter_graph(&g.graph);
let filtered = edge_selection.filter_graph(&g.graph);
let fg = Reversed(&filtered);
let mut found = false;
'outer: for this in petgraph::visit::Bfs::new(&fg, self.local_node()).iter(&fg) {
for next in fg.neighbors_directed(this, Outgoing) {
Expand Down

0 comments on commit 01e95ed

Please sign in to comment.