cluster_from_iterator

Function cluster_from_iterator 

Source
pub fn cluster_from_iterator<I: IntoIterator<Item = usize>>(it: I) -> Cluster
Expand description

Construct a cluster from an iterator of point-indices.

TODO: This method only exists due to a malnourished API. An API-improvement should make it obsolete.

ยงExamples

use exact_clustering::cluster_from_iterator;

let cluster = cluster_from_iterator([0,2]);

assert!(cluster.contains(0));
assert!(!cluster.contains(1));
assert!(cluster.contains(2));

assert_eq!(cluster.len(), 2);

assert!(!cluster.is_empty());

let mut cluster_iter = cluster.iter();
assert_eq!(cluster_iter.next(), Some(0));
assert_eq!(cluster_iter.next(), Some(2));
assert_eq!(cluster_iter.next(), None);