Struct matrixgraph::SimpleGraph [] [src]

pub struct SimpleGraph {
    // some fields omitted
}

A simple graph represented by the upper right triangle of an adjacency matrix of fixed size

The cells of the adjacency matrix are assigned values of type Option where a None value represents the absence of an edge.

Methods

impl SimpleGraph

fn new(size: usize) -> SimpleGraph

Creates a new simple graph object with a fixed size.

fn from_vec(weights: &Vec<Option<f64>>) -> SimpleGraph

Creates a new simple graph object with a fixed size from a vector that is the row-wise representation of the upper right triangle of an adjacency matrix.

Note: A zero-sized vector creates a graph with a single vertex.

fn to_vec(&self) -> Vec<Option<f64>>

Returns the vector that is the row-wise representation of the upper right triangle of the adjacency matrix of the simple graph.

fn to_digraph_vec(&self) -> Vec<Option<f64>>

Returns the vector that is the row-wise representation of the full adjacency matrix of the simple graph.

Trait Implementations

impl BasicGraphMethods for SimpleGraph

fn size(&self) -> usize

fn get_edge(&self, edge: (usize, usize)) -> Option<f64>

fn set_edge(&mut self, edge: (usize, usize), value: Option<f64>)

Derived Implementations

impl Debug for SimpleGraph

fn fmt(&self, __arg_0: &mut Formatter) -> Result

impl Clone for SimpleGraph

fn clone(&self) -> SimpleGraph

fn clone_from(&mut self, source: &Self)

impl PartialEq for SimpleGraph

fn eq(&self, __arg_0: &SimpleGraph) -> bool

fn ne(&self, __arg_0: &SimpleGraph) -> bool