def get_kVal(G, n, weightParameter):
    """
    Helper function to get the total weight of all edges to a node
    """
    if weightParameter:
        retk = 0
        for e in G.edges(n, data=True):
            retk += e[2][weightParameter]
    else:
        retk = len(G.edges(n))
    return retk
