/// Constructs a finite graph representing bonds per unitcell.
///
/// This is basically just a different representation of FracBonds, which is
/// better equipped for certain types of lookup and modification.
/// (It's *terrible* for most graph algorithms, though)
///
/// # Properties
///
/// * Node indices will match site indices.
/// * The graph will be a directed multi-graph.
/// * Parallel edges will each represent a different `image_diff`, stored
///   as the edge weight.
Constructs a finite graph representing bonds per unitcell.
This is basically just a different representation of FracBonds, which is
better equipped for certain types of lookup and modification.
(It's *terrible* for most graph algorithms, though)
Constructs a finite graph representing bonds per unitcell . This is basically just a different representation of FracBonds which is better equipped for certain types of lookup and modification . ( It ' s * terrible * for most graph algorithms though )
pub fn to_periodic_graph(&self) -> PeriodicGraph {
            let num_atoms = self.num_atoms_per_cell();
            let mut graph = DiGraph::new();
            for site in 0..num_atoms {
                assert_eq!(NodeIndex::new(site), graph.add_node(()));
            }
            for FracBond { from, to, image_diff } in self {
                graph.add_edge(NodeIndex::new(from), NodeIndex::new(to), image_diff);
            }
            PeriodicGraph(graph)
        }
pub fn to_periodic_graph ( & self ) -> PeriodicGraph { let num_atoms = self . num_atoms_per_cell ( ) ; let mut graph = DiGraph :: new ( ) ; for site in 0 .. num_atoms { assert_eq ! ( NodeIndex new ( site ) graph add_node ( ( ) ) ) ; } for FracBond { from , to , image_diff } in self { graph . add_edge ( NodeIndex :: new ( from ) , NodeIndex :: new ( to ) , image_diff ) ; } PeriodicGraph ( graph ) }
Constructs a finite graph representing bonds per unitcell.
Constructs a finite graph representing bonds per unitcell .
&self
properties
Node indices will match site indices.
The graph will be a directed multi-graph.
Parallel edges will each represent a different `image_diff`, stored
as the edge weight.
Node indices will match site indices . The graph will be a directed multi - graph . Parallel edges will each represent a different ` image_diff ` stored as the edge weight .