def get_std_dev(total_size: int, comm_size: int) -> float:
    """
    In community generation, larger communities should have a smaller standard
    deviation (representing tighter-knit communities). This generates a std dev
    based on the ratio of the number of nodes in this community to the number
    of nodes in the total graph.

    Since we want a larger standard deviation for a smaller ratio, we take
    1/ratio, which goes from total_size (for comm_size=1) to 1 (for ratio = 1).
    We divide this by total_size to get a normalised value, and then by 3 so
    that we can easily go three standard deviations without leaving the range.
    """
    ratio = comm_size / total_size  # range 0 to 1.
    return (1 / ratio) / (total_size * 3)