Compute the cyclomatic complexity of a function
    Args:
        function (core.declarations.function.Function)
    Returns:
        int

def compute_cyclomatic_complexity(function):
    """
    Compute the cyclomatic complexity of a function
    Args:
        function (core.declarations.function.Function)
    Returns:
        int
    """
    # from https://en.wikipedia.org/wiki/Cyclomatic_complexity
    # M = E - N + 2P
    # where M is the complexity
    # E number of edges
    # N number of nodes
    # P number of connected components

    E = compute_number_edges(function)
    N = len(function.nodes)
    P = len(compute_strongly_connected_components(function))
    return E - N + 2 * P