[−][src]Struct gsgdt::Graph
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]
&self,
w: &mut W,
settings: &GraphvizSettings,
as_subgraph: bool
) -> Result<()>
Returns the dot representation of the given graph. This can rendered using the graphviz program.
Trait Implementations
impl<'de> Deserialize<'de> for Graph
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,