Struct falcon::graph::Graph [−][src]
A directed graph.
Methods
impl<V, E> Graph<V, E> where
V: Vertex,
E: Edge,
[src]
impl<V, E> Graph<V, E> where
V: Vertex,
E: Edge,
pub fn new() -> Graph<V, E>
[src]
pub fn new() -> Graph<V, E>
pub fn num_vertices(&self) -> usize
[src]
pub fn num_vertices(&self) -> usize
pub fn has_vertex(&self, index: usize) -> bool
[src]
pub fn has_vertex(&self, index: usize) -> bool
Returns true if the vertex with the given index exists in this graph
pub fn set_head(&mut self, index: usize) -> Result<()>
[src]
pub fn set_head(&mut self, index: usize) -> Result<()>
Sets the head of this graph.
pub fn head(&self) -> Option<usize>
[src]
pub fn head(&self) -> Option<usize>
Returns the head of this graph.
pub fn remove_vertex(&mut self, index: usize) -> Result<()>
[src]
pub fn remove_vertex(&mut self, index: usize) -> Result<()>
Removes a vertex, and all edges associated with that vertex.
pub fn remove_edge(&mut self, head: usize, tail: usize) -> Result<()>
[src]
pub fn remove_edge(&mut self, head: usize, tail: usize) -> Result<()>
Removes an edge
pub fn insert_vertex(&mut self, v: V) -> Result<()>
[src]
pub fn insert_vertex(&mut self, v: V) -> Result<()>
pub fn insert_edge(&mut self, edge: E) -> Result<()>
[src]
pub fn insert_edge(&mut self, edge: E) -> Result<()>
pub fn successors(&self, index: usize) -> Result<Vec<&V>>
[src]
pub fn successors(&self, index: usize) -> Result<Vec<&V>>
Returns all immediate successors of a vertex from the graph.
pub fn predecessors(&self, index: usize) -> Result<Vec<&V>>
[src]
pub fn predecessors(&self, index: usize) -> Result<Vec<&V>>
Returns all immediate predecessors of a vertex from the graph.
pub fn compute_post_order(&self, root: usize) -> Result<Vec<usize>>
[src]
pub fn compute_post_order(&self, root: usize) -> Result<Vec<usize>>
pub fn compute_dominance_frontiers(
&self,
start_index: usize
) -> Result<HashMap<usize, HashSet<usize>>>
[src]
pub fn compute_dominance_frontiers(
&self,
start_index: usize
) -> Result<HashMap<usize, HashSet<usize>>>
Computes the dominance frontiers for all vertices in the graph
Warning
Unsure of correctness of this implementation
pub fn compute_immediate_dominators(
&self,
start_index: usize
) -> Result<HashMap<usize, usize>>
[src]
pub fn compute_immediate_dominators(
&self,
start_index: usize
) -> Result<HashMap<usize, usize>>
pub fn compute_dominators(
&self,
start_index: usize
) -> Result<HashMap<usize, HashSet<usize>>>
[src]
pub fn compute_dominators(
&self,
start_index: usize
) -> Result<HashMap<usize, HashSet<usize>>>
Computes dominators for all vertices in the graph
pub fn compute_predecessors(&self) -> Result<HashMap<usize, HashSet<usize>>>
[src]
pub fn compute_predecessors(&self) -> Result<HashMap<usize, HashSet<usize>>>
Computes predecessors for all vertices in the graph
The resulting sets include all predecessors for each vertex in the graph, not just immediate predecessors.
Given A -> B -> C, both A and B will be in the set for C.
pub fn compute_acyclic(
&self,
start_index: usize
) -> Result<Graph<NullVertex, NullEdge>>
[src]
pub fn compute_acyclic(
&self,
start_index: usize
) -> Result<Graph<NullVertex, NullEdge>>
Creates an acyclic graph with NullVertex and NullEdge
pub fn vertices(&self) -> Vec<&V>
[src]
pub fn vertices(&self) -> Vec<&V>
Returns all vertices in the graph.
pub fn vertices_mut(&mut self) -> Vec<&mut V>
[src]
pub fn vertices_mut(&mut self) -> Vec<&mut V>
pub fn vertex(&self, index: usize) -> Result<&V>
[src]
pub fn vertex(&self, index: usize) -> Result<&V>
Fetches an index from the graph by index.
pub fn vertex_mut(&mut self, index: usize) -> Result<&mut V>
[src]
pub fn vertex_mut(&mut self, index: usize) -> Result<&mut V>
pub fn edge(&self, head: usize, tail: usize) -> Result<&E>
[src]
pub fn edge(&self, head: usize, tail: usize) -> Result<&E>
pub fn edge_mut(&mut self, head: usize, tail: usize) -> Result<&mut E>
[src]
pub fn edge_mut(&mut self, head: usize, tail: usize) -> Result<&mut E>
pub fn edges(&self) -> Vec<&E>
[src]
pub fn edges(&self) -> Vec<&E>
Get a reference to every Edge
in the Graph
.
pub fn edges_mut(&mut self) -> Vec<&mut E>
[src]
pub fn edges_mut(&mut self) -> Vec<&mut E>
Get a mutable reference to every Edge
in the Graph
.
pub fn edges_out(&self, index: usize) -> Result<&Vec<E>>
[src]
pub fn edges_out(&self, index: usize) -> Result<&Vec<E>>
Return all edges out for a vertex
pub fn edges_in(&self, index: usize) -> Result<&Vec<E>>
[src]
pub fn edges_in(&self, index: usize) -> Result<&Vec<E>>
Return all edges in for a vertex
pub fn dot_graph(&self) -> String
[src]
pub fn dot_graph(&self) -> String
Returns a string in the graphviz format
Trait Implementations
impl<V: Clone + Vertex, E: Clone + Edge> Clone for Graph<V, E>
[src]
impl<V: Clone + Vertex, E: Clone + Edge> Clone for Graph<V, E>
fn clone(&self) -> Graph<V, E>
[src]
fn clone(&self) -> Graph<V, E>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl<V: Debug + Vertex, E: Debug + Edge> Debug for Graph<V, E>
[src]
impl<V: Debug + Vertex, E: Debug + Edge> Debug for Graph<V, E>
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl<V: Eq + Vertex, E: Eq + Edge> Eq for Graph<V, E>
[src]
impl<V: Eq + Vertex, E: Eq + Edge> Eq for Graph<V, E>
impl<V: Hash + Vertex, E: Hash + Edge> Hash for Graph<V, E>
[src]
impl<V: Hash + Vertex, E: Hash + Edge> Hash for Graph<V, E>
fn hash<__HVE: Hasher>(&self, state: &mut __HVE)
[src]
fn hash<__HVE: Hasher>(&self, state: &mut __HVE)
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl<V: Ord + Vertex, E: Ord + Edge> Ord for Graph<V, E>
[src]
impl<V: Ord + Vertex, E: Ord + Edge> Ord for Graph<V, E>
fn cmp(&self, other: &Graph<V, E>) -> Ordering
[src]
fn cmp(&self, other: &Graph<V, E>) -> Ordering
This method returns an Ordering
between self
and other
. Read more
fn max(self, other: Self) -> Self
1.21.0[src]
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
impl<V: PartialEq + Vertex, E: PartialEq + Edge> PartialEq for Graph<V, E>
[src]
impl<V: PartialEq + Vertex, E: PartialEq + Edge> PartialEq for Graph<V, E>
fn eq(&self, other: &Graph<V, E>) -> bool
[src]
fn eq(&self, other: &Graph<V, E>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Graph<V, E>) -> bool
[src]
fn ne(&self, other: &Graph<V, E>) -> bool
This method tests for !=
.
impl<V: PartialOrd + Vertex, E: PartialOrd + Edge> PartialOrd for Graph<V, E>
[src]
impl<V: PartialOrd + Vertex, E: PartialOrd + Edge> PartialOrd for Graph<V, E>
fn partial_cmp(&self, other: &Graph<V, E>) -> Option<Ordering>
[src]
fn partial_cmp(&self, other: &Graph<V, E>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &Graph<V, E>) -> bool
[src]
fn lt(&self, other: &Graph<V, E>) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &Graph<V, E>) -> bool
[src]
fn le(&self, other: &Graph<V, E>) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &Graph<V, E>) -> bool
[src]
fn gt(&self, other: &Graph<V, E>) -> bool
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &Graph<V, E>) -> bool
[src]
fn ge(&self, other: &Graph<V, E>) -> bool
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more