pub struct DistanceBfsResources {
pub queue: VecDeque<(VertexId, usize)>,
pub visited: HashSet<VertexId>,
pub distances: HashMap<VertexId, usize>,
}Expand description
Pool for distance-annotated BFS
Fields§
§queue: VecDeque<(VertexId, usize)>Queue with (vertex, distance) pairs
visited: HashSet<VertexId>Set of visited vertices
distances: HashMap<VertexId, usize>Distance map
Implementations§
Source§impl DistanceBfsResources
impl DistanceBfsResources
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Create with capacity
Sourcepub fn bfs_within_radius<F>(
&mut self,
source: VertexId,
radius: usize,
adjacency: F,
) -> &HashSet<VertexId>
pub fn bfs_within_radius<F>( &mut self, source: VertexId, radius: usize, adjacency: F, ) -> &HashSet<VertexId>
Perform BFS from a source vertex
Returns the set of vertices reachable within the given radius.
§Arguments
source- Starting vertexradius- Maximum distance to traverseadjacency- Function to get neighbors of a vertex
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DistanceBfsResources
impl RefUnwindSafe for DistanceBfsResources
impl Send for DistanceBfsResources
impl Sync for DistanceBfsResources
impl Unpin for DistanceBfsResources
impl UnwindSafe for DistanceBfsResources
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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