diff --git a/src/graph_impl/mod.rs b/src/graph_impl/mod.rs index c8f12a6eb..d0be47337 100644 --- a/src/graph_impl/mod.rs +++ b/src/graph_impl/mod.rs @@ -534,6 +534,7 @@ where /// Access the weight for node `a`. /// + /// If node `a` doesn't exist in the graph, return `None`. /// Also available with indexing syntax: `&graph[a]`. pub fn node_weight(&self, a: NodeIndex) -> Option<&N> { self.nodes.get(a.index()).map(|n| &n.weight) @@ -541,6 +542,7 @@ where /// Access the weight for node `a`, mutably. /// + /// If node `a` doesn't exist in the graph, return `None`. /// Also available with indexing syntax: `&mut graph[a]`. pub fn node_weight_mut(&mut self, a: NodeIndex) -> Option<&mut N> { self.nodes.get_mut(a.index()).map(|n| &mut n.weight) @@ -606,6 +608,7 @@ where /// Access the weight for edge `e`. /// + /// If edge `e` doesn't exist in the graph, return `None`. /// Also available with indexing syntax: `&graph[e]`. pub fn edge_weight(&self, e: EdgeIndex) -> Option<&E> { self.edges.get(e.index()).map(|ed| &ed.weight) @@ -613,12 +616,15 @@ where /// Access the weight for edge `e`, mutably. /// + /// If edge `e` doesn't exist in the graph, return `None`. /// Also available with indexing syntax: `&mut graph[e]`. pub fn edge_weight_mut(&mut self, e: EdgeIndex) -> Option<&mut E> { self.edges.get_mut(e.index()).map(|ed| &mut ed.weight) } /// Access the source and target nodes for `e`. + /// + /// If edge `e` doesn't exist in the graph, return `None`. pub fn edge_endpoints(&self, e: EdgeIndex) -> Option<(NodeIndex, NodeIndex)> { self.edges .get(e.index())