fn first_of_ties(&self, mut i: usize) -> usize {
        if i == 0 || self.neighbors.is_empty() {
            return 0;
        }

        let d = self
            .neighbors
            .get(i)
            .expect("first_of_ties() called on wrong index")
            .distance;

        while let Some(neigh) = self.neighbors.get(i - 1) {
            if !approx_eq!(f64, neigh.distance, d) {
                break;
            }
            i -= 1;
            if i == 0 {
                break;
            }
        }
        i
    }
/// Returns the index of the first neighbor with the same distance as
/// self.neighbors[i].
Returns the index of the first neighbor with the same distance as
self.neighbors[i].
Returns the index of the first neighbor with the same distance as self . neighbors [ i ] .
fn first_of_ties(&self, mut i: usize) -> usize {
        if i == 0 || self.neighbors.is_empty() {
            return 0;
        }
        let d = self
            .neighbors
            .get(i)
            .expect("first_of_ties() called on wrong index")
            .distance;
        while let Some(neigh) = self.neighbors.get(i - 1) {
            if !approx_eq!(f64, neigh.distance, d) {
                break;
            }
            i -= 1;
            if i == 0 {
                break;
            }
        }
        i
    }
fn first_of_ties ( & self , mut i : usize ) -> usize { if i == 0 || self . neighbors . is_empty ( ) { return 0 ; } let d = self . neighbors . get ( i ) . expect ( " " ) . distance ; while let Some ( neigh ) = self . neighbors . get ( i - 1 ) { if ! approx_eq ! ( f64 neigh distance d ) { break ; } i -= 1 ; if i == 0 { break ; } } i }
Returns the index of the first neighbor with the same distance as
self.neighbors[i].
Returns the index of the first neighbor with the same distance as self . neighbors [ i ] .
&self
i
usize
&self
i
usize