Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Clarify when graph methods return None? #491

Merged
merged 1 commit into from May 22, 2022

Commits on May 10, 2022

  1. docs: Clarify when graph methods return None?

    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`.
    ```
    beyarkay committed May 10, 2022
    Copy the full SHA
    30e47f2 View commit details
    Browse the repository at this point in the history