[][src]Struct gsgdt::Graph

pub struct Graph {
    pub name: String,
    pub nodes: Vec<Node>,
    pub edges: Vec<Edge>,
}

Graph represents a directed graph as a list of nodes and list of edges.

Fields

name: String

Identifier for the graph

nodes: Vec<Node>

The Vector containing the Nodes

edges: Vec<Edge>

The Vector containing the Edges

Implementations

impl Graph[src]

pub fn new(name: String, nodes: Vec<Node>, edges: Vec<Edge>) -> Graph[src]

pub fn adj_list(&self) -> AdjList<'_>[src]

Returns the adjacency list representation of the graph. Adjacency list can be used to easily find the childern of a given node. If the a node does not have any childern, then the list correspoding to that node will be empty.

pub fn rev_adj_list(&self) -> AdjList<'_>[src]

Returns the reverse adjacency list representation of the graph. Reverse adjacency list represents the adjacency list of a directed graph where the edges have been reversed. Reverse adjacency list can be used to easily find the parents of a given node. If the a node does not have any childern, then the list correspoding to that node will be empty.

pub fn get_node_by_label(&self, label: &str) -> Option<&Node>[src]

Returns the node with the given label, if found.

pub fn to_dot<W: Write>(
    &self,
    w: &mut W,
    settings: &GraphvizSettings,
    as_subgraph: bool
) -> Result<()>
[src]

Returns the dot representation of the given graph. This can rendered using the graphviz program.

Trait Implementations

impl<'de> Deserialize<'de> for Graph[src]

impl Serialize for Graph[src]

Auto Trait Implementations

impl RefUnwindSafe for Graph

impl Send for Graph

impl Sync for Graph

impl Unpin for Graph

impl UnwindSafe for Graph

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.