def sum_risk(method):
    """ Sum risk of all nodes in the method graph. """
    risk = 0
    for node_name in method.graph.nodes_iter():
        node = method.graph.node[node_name]
        if "entry_point" in node:
            continue
        if "risk" in node:
            risk += node["risk"]
    return risk