Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: Clarify when graph methods return None? (petgraph#491)
This is a docs change, and should not affect any functionality. While looking about the API, I didn't quite understand why I had to `unwrap()` every time I wanted to access an edge or a node. I understand now it's because that weight or node might not exist, but that was only clear to me after looking at the source code. This change adds a line to the relevant docstrings that explain when a `Some()` will be returned vs when a `None` will be returned. The docstring for `remove_node` already had a similar line in it: ``` /// Remove `a` from the graph if it exists, and return its weight. /// If it doesn't exist in the graph, return `None`. ``` So I made sure the lines I added were phrased similarly to keep the code base consistent, like ``` /// If ____ doesn't exist in the graph, return `None`. ```
- Loading branch information