pub struct AttributedDiGraph<N: Node, E: EdgeWeight, Ix: IndexType = u32> { /* private fields */ }
Expand description
Directed graph with node and edge attributes
Implementations§
Source§impl<N: Node, E: EdgeWeight, Ix: IndexType> AttributedDiGraph<N, E, Ix>
impl<N: Node, E: EdgeWeight, Ix: IndexType> AttributedDiGraph<N, E, Ix>
Sourcepub fn from_digraph(graph: DiGraph<N, E, Ix>) -> Self
pub fn from_digraph(graph: DiGraph<N, E, Ix>) -> Self
Create an attributed directed graph from an existing directed graph
Sourcepub fn add_node_with_attributes(&mut self, node: N, attributes: Attributes)
pub fn add_node_with_attributes(&mut self, node: N, attributes: Attributes)
Add a node with initial attributes
Sourcepub fn add_edge(&mut self, source: N, target: N, weight: E) -> Result<()>
pub fn add_edge(&mut self, source: N, target: N, weight: E) -> Result<()>
Add an edge between two nodes with a given weight
Sourcepub fn add_edge_with_attributes(
&mut self,
source: N,
target: N,
weight: E,
attributes: Attributes,
) -> Result<()>
pub fn add_edge_with_attributes( &mut self, source: N, target: N, weight: E, attributes: Attributes, ) -> Result<()>
Add an edge with initial attributes
Sourcepub fn set_node_attribute<K: Into<String>>(
&mut self,
node: &N,
key: K,
value: AttributeValue,
)
pub fn set_node_attribute<K: Into<String>>( &mut self, node: &N, key: K, value: AttributeValue, )
Set a node attribute
Sourcepub fn get_node_attribute(&self, node: &N, key: &str) -> Option<&AttributeValue>
pub fn get_node_attribute(&self, node: &N, key: &str) -> Option<&AttributeValue>
Get a node attribute
Sourcepub fn set_edge_attribute<K: Into<String>>(
&mut self,
source: &N,
target: &N,
key: K,
value: AttributeValue,
) -> Result<()>
pub fn set_edge_attribute<K: Into<String>>( &mut self, source: &N, target: &N, key: K, value: AttributeValue, ) -> Result<()>
Set an edge attribute
Sourcepub fn get_edge_attribute(
&self,
source: &N,
target: &N,
key: &str,
) -> Option<&AttributeValue>
pub fn get_edge_attribute( &self, source: &N, target: &N, key: &str, ) -> Option<&AttributeValue>
Get an edge attribute
Sourcepub fn set_graph_attribute<K: Into<String>>(
&mut self,
key: K,
value: AttributeValue,
)
pub fn set_graph_attribute<K: Into<String>>( &mut self, key: K, value: AttributeValue, )
Set a graph-level attribute
Sourcepub fn get_graph_attribute(&self, key: &str) -> Option<&AttributeValue>
pub fn get_graph_attribute(&self, key: &str) -> Option<&AttributeValue>
Get a graph-level attribute
Sourcepub fn predecessors(&self, node: &N) -> Result<Vec<N>>where
N: Clone,
pub fn predecessors(&self, node: &N) -> Result<Vec<N>>where
N: Clone,
Get predecessors of a node
Sourcepub fn graph_mut(&mut self) -> &mut DiGraph<N, E, Ix>
pub fn graph_mut(&mut self) -> &mut DiGraph<N, E, Ix>
Get a mutable reference to the underlying directed graph
Sourcepub fn into_digraph(self) -> DiGraph<N, E, Ix>
pub fn into_digraph(self) -> DiGraph<N, E, Ix>
Convert back to a regular directed graph (losing attributes)
Trait Implementations§
Auto Trait Implementations§
impl<N, E, Ix> Freeze for AttributedDiGraph<N, E, Ix>
impl<N, E, Ix> RefUnwindSafe for AttributedDiGraph<N, E, Ix>
impl<N, E, Ix> Send for AttributedDiGraph<N, E, Ix>where
Ix: Send,
impl<N, E, Ix> Sync for AttributedDiGraph<N, E, Ix>where
Ix: Sync,
impl<N, E, Ix> Unpin for AttributedDiGraph<N, E, Ix>
impl<N, E, Ix> UnwindSafe for AttributedDiGraph<N, E, Ix>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more