Crate cnetworks[][src]

Expand description

From Wikipedia:

Complex network is a graph-like structure with non-trivial characteristics. A complex network is a graph (network) with non-trivial topological features—features that do not occur in simple networks such as lattices or random graphs but often occur in networks representing real systems. The study of complex networks is a young and active area of scientific research inspired largely by empirical findings of real-world networks such as computer networks, biological networks, technological networks, brain networks, climate networks and social networks.

Structs

Network

Network is the main graph-like data structure.

Enums

Error

Error is used to signify a recoverable error.

Model

Model decides the algorithm used to connect the nodes during Network’s initialization.

Weight

Weight determines the weight of each link in the network (ie. the probability of the infection spreading through it in each time step).

Functions

bfs

Perform a breadth-first search over the network, starting with root and looking for target. Return a HashSet of all nodes discovered in the process or None if the path is not found. Returns Err if the root or target nodes do not exist. Panics if the network is corrupted or when the queue operations fail.

explore

Explore the network with BFS starting with root. Return a tuple of two HashSets: one with the explored nodes (including the root) and another with the unexplored. Returns Err if the root does not exist. Panics when the network is corrupted or if the queue operations fail.

spread_si

Simulate spread of information according to the susceptible-infected diffusion model.

stitch_together

Stitch the network together if it is not whole.