pub fn complete_graph(n: usize) -> Self
    {

        let mut vertices = Vec::with_capacity(n);
        for i in 0..n {
            let mut adj = Vec::with_capacity(n - 1);
            adj.extend(0..i);
            adj.extend((i+1)..n);
            
            vertices.push(
                NodeContainer{
                    id: i,
                    node: T::new_from_index(i),
                    adj,
                }
            )
        }

        Self{
            next_id: n,
            edge_count: n*(n - 1) / 2,
            vertices,
            phantom: PhantomData::<T>,
        }
    }
/// Efficiently create a complete graph with n nodes
Efficiently create a complete graph with n nodes
Efficiently create a complete graph with n nodes
pub fn complete_graph(n: usize) -> Self
    {
        let mut vertices = Vec::with_capacity(n);
        for i in 0..n {
            let mut adj = Vec::with_capacity(n - 1);
            adj.extend(0..i);
            adj.extend((i+1)..n);
            vertices.push(
                NodeContainer{
                    id: i,
                    node: T::new_from_index(i),
                    adj,
                }
            )
        }
        Self{
            next_id: n,
            edge_count: n*(n - 1) / 2,
            vertices,
            phantom: PhantomData::<T>,
        }
    }
pub fn complete_graph ( n : usize ) -> Self { let mut vertices = Vec :: with_capacity ( n ) ; for i in 0 .. n { let mut adj = Vec :: with_capacity ( n - 1 ) ; adj . extend ( 0 .. i ) ; adj . extend ( ( i + 1 ) .. n ) ; vertices . push ( NodeContainer { id : i , node : T :: new_from_index ( i ) , adj , } ) } Self { next_id : n , edge_count : n * ( n - 1 ) / 2 , vertices , phantom : PhantomData :: < T > , } }
Efficiently create a complete graph with n nodes
Efficiently create a complete graph with n nodes
n
usize
n
usize