struct BlockData {
pub id: BlockId,
pub reverse_postorder: Option<u32>,
pub only_reach_error: bool,
pub shortest_paths: HashMap<BlockId, usize>,
pub flow: Vector<BlockId, Ratio<DynaInt<u64, BigUint>>>,
}Fields§
§id: BlockId§reverse_postorder: Option<u32>Order in a reverse postorder numbering. None if the block is unreachable.
only_reach_error: boolNode from where we can only reach error nodes (panic, etc.)
shortest_paths: HashMap<BlockId, usize>List of reachable nodes, with the length of shortest path to them. Includes the current node.
flow: Vector<BlockId, Ratio<DynaInt<u64, BigUint>>>Let’s say we put a quantity of water equal to 1 on the block, and the water flows downards. Whenever there is a branching, the quantity of water gets equally divided between the branches. When the control flows join, we put the water back together. The set below computes the amount of water received by each descendant of the node.
TODO: there must be a known algorithm which computes this, right?… This is exactly this problems: https://stackoverflow.com/questions/78221666/algorithm-for-total-flow-through-weighted-directed-acyclic-graph TODO: the way I compute this is not efficient.
Implementations§
Source§impl BlockData
impl BlockData
fn shortest_paths_including_self( &self, ) -> impl Iterator<Item = (BlockId, usize)>
fn shortest_paths_excluding_self( &self, ) -> impl Iterator<Item = (BlockId, usize)>
fn reachable_including_self(&self) -> impl Iterator<Item = BlockId>
fn reachable_excluding_self(&self) -> impl Iterator<Item = BlockId>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for BlockData
impl RefUnwindSafe for BlockData
impl Send for BlockData
impl Sync for BlockData
impl Unpin for BlockData
impl UnwindSafe for BlockData
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<I, T> ExtractContext<I, ()> for T
impl<I, T> ExtractContext<I, ()> for T
§fn extract_context(self, _original_input: I)
fn extract_context(self, _original_input: I)
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more