pub fn subgraph(&self, nodes: &[usize]) -> Graph {
        use itertools::Itertools;

        let mut g = Graph::with_size(nodes.len());
        g.atoms = nodes
            .iter()
            .map(|&i| *self.atoms.get(i as usize).unwrap())
            .collect();

        for (i, j) in (0..nodes.len()).tuple_combinations() {
            let v = *self.bonds.get(nodes[i] as usize, nodes[j] as usize);
            *g.bonds.get_mut(i, j) = v;
            *g.bonds.get_mut(j, i) = v;
            g.set_edge_impossible(i, j);
            g.set_edge_impossible(j, i);
        }

        assert!(g.is_contiguous());

        g
    }
/// Creates a new graph from the given node ids.
/// Atom labels and edges carry over.
Creates a new graph from the given node ids.
Atom labels and edges carry over.
Creates a new graph from the given node ids . Atom labels and edges carry over .
pub fn subgraph(&self, nodes: &[usize]) -> Graph {
        use itertools::Itertools;
        let mut g = Graph::with_size(nodes.len());
        g.atoms = nodes
            .iter()
            .map(|&i| *self.atoms.get(i as usize).unwrap())
            .collect();
        for (i, j) in (0..nodes.len()).tuple_combinations() {
            let v = *self.bonds.get(nodes[i] as usize, nodes[j] as usize);
            *g.bonds.get_mut(i, j) = v;
            *g.bonds.get_mut(j, i) = v;
            g.set_edge_impossible(i, j);
            g.set_edge_impossible(j, i);
        }
        assert!(g.is_contiguous());
        g
    }
pub fn subgraph ( & self , nodes : & [ usize ] ) -> Graph { use itertools :: Itertools ; let mut g = Graph :: with_size ( nodes . len ( ) ) ; g . atoms = nodes . iter ( ) . map ( | & i | * self . atoms . get ( i as usize ) . unwrap ( ) ) . collect ( ) ; for ( i , j ) in ( 0 .. nodes . len ( ) ) . tuple_combinations ( ) { let v = * self . bonds . get ( nodes [ i ] as usize , nodes [ j ] as usize ) ; * g . bonds . get_mut ( i , j ) = v ; * g . bonds . get_mut ( j , i ) = v ; g . set_edge_impossible ( i , j ) ; g . set_edge_impossible ( j , i ) ; } assert ! ( g is_contiguous ( ) ) ; g }
Creates a new graph from the given node ids.
Creates a new graph from the given node ids .
&self
nodes
&[usize]