struct Network<'a> {
links: HashMap<&'a str, HashSet<&'a str>>,
}
Expand description
Represents a network of computers as a map from any computer to the ids of its direct connections
Fields§
§links: HashMap<&'a str, HashSet<&'a str>>
Implementations§
source§impl<'a> Network<'a>
impl<'a> Network<'a>
sourcefn trios(&self) -> HashSet<Vec<&str>>
fn trios(&self) -> HashSet<Vec<&str>>
Find all the sets of three mutually interconnected computers
sourcefn clusters_containing(&self, char: &str) -> Vec<Vec<&str>>
fn clusters_containing(&self, char: &str) -> Vec<Vec<&str>>
Uses Network::trios
to find all clusters of three, and filters to only those where at least one computer
starts with the provided character
sourcefn find_fully_connected_cluster(
&self,
start: &'a str,
connected: &HashSet<&'a str>,
) -> Vec<&str>
fn find_fully_connected_cluster( &self, start: &'a str, connected: &HashSet<&'a str>, ) -> Vec<&str>
Given a starting computer id and the list of it’s direct connections, find all that are also mutually interconnected
sourcefn find_lan_password(&self) -> String
fn find_lan_password(&self) -> String
For each node find a cluster that is fully interconnected, and then take the biggest and turn it into a password.
Trait Implementations§
impl<'a> Eq for Network<'a>
impl<'a> StructuralPartialEq for Network<'a>
Auto Trait Implementations§
impl<'a> Freeze for Network<'a>
impl<'a> RefUnwindSafe for Network<'a>
impl<'a> Send for Network<'a>
impl<'a> Sync for Network<'a>
impl<'a> Unpin for Network<'a>
impl<'a> UnwindSafe for Network<'a>
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
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.