1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
//!
//! # Define struct Network for graph theory
//! 
//! This is my experimental project to use Rust for numerical calculation of graph theory.  
//! My goal is to perform numerical calculation of percolation procedure and measure the time, compare it with the C/C++ one.  
//! 
//! ## struct Network is the universe of the graph system
//! The struct Network is the universe of the system in mathmatics literature.  
//! This struct is the simplest expression of the network or graph. See page of struct Network.  
//! Functions exist to manage struct Network.   
//! This is the design of this crate. 
//! 
//! ## Notice : Why use Rust
//! I think we should use C/C++ or Fortran for numerical calculation thanks to the calculation time.    
//! Rust may be the member of them.     
//! But here is the problem : the existance of the intel compiler.  
//! I know icc, which is a c compiler made by Intel, is the killer one for my field of study. 
//! 
//! **Rust's Strong Point**
//! - Cargo. I want cargo like utility for C++.
//! - Wasm. I think the document for "wasm+rust" is great, or "wasm+c" is too bad.
//! I want easy access to visualization for numerial simulation, with same code for non-visual simulation.
//! Browser is the most powerful tool for visualization.
//! If we want to add visualization to lifecycle of the program, which should be browser with wasm.
//! - Intelligence of compiler. I hate bug, error, panic.
//! - Reuse of code. I couldn't find a smart way to manage the C/C++ library project.  I experiment creates.io lifecycle.
//! - New. We are young and go further.
//! 
//! **Rust's Weak Point**
//! - Intel Compiler. This is the fatal point.
//! - Limitation of language itself. C/C++ can do everything literatually. This may be angel, or demon.
//! - Less of history. Is there a library for conjugate gradient method?
//! - Few people use Rust for numerical simulation. Yah, I may become the one of them if I conclude C/C++ is the better way. Now on judge procedure.
//! 

mod create;
mod get;

/// 
/// # Definition of struct Network, the implementation of network in mathmatics.
/// 
/// Expression of network or graph is "The set of vertexes and the set of links which is pair of the vertex".   
/// I use this index rule: the vertex is denoted by number 0 ~ n-1, n as the amount of the vertex.  
/// So the expression of the struct Network becomes simple and smart.   
/// 
/// Note : A famous way of the expression of network is adjacency matrix, but it use O(n^2) memory space.   
/// I may prepare the access to the adjacency matrix bia function, but it is not inevitable.    
/// Many of the calculation experiment program for the network dynamics like percolation is written with using edge list expression of the network, not adjacency matrix.   
/// Adjacency matrix is used with the research of the behave of the eigenvalue, but I marely use it ( ; ; ).   
/// 
#[derive(Clone)]
pub struct Network {
    n: u32,
    edge_list: Vec<(u32, u32)>,
}