pub fn validate_map<I>(map: &BTreeMap<I, BTreeSet<I>>) -> boolAvailable on crate feature
chili only.Expand description
Validates a given map.
This algorithm checks if every keys neighbors also contain the specified key. If this is not the case, the map cannot be considered valid. Note that this algorithm does not check if all keys are connected. This means, disjoint sets are allowed.
use cellular_raza_core::backend::chili::validate_map;
let new_map = std::collections::BTreeMap::from([
(1_usize, std::collections::BTreeSet::from([0,2])),
(2_usize, std::collections::BTreeSet::from([1,3])),
(3_usize, std::collections::BTreeSet::from([2,0])),
(0_usize, std::collections::BTreeSet::from([3,1])),
]);
let is_valid = validate_map(&new_map);
assert_eq!(is_valid, true);