def cost(G, e):
    """Returns the weight of the edges of G.
    
    Parameters
    ----------
    G: NetworkX graph
    
    e : the nodes on either side of the edge.
    
    Returns
    -------
    Weight of the edges of G.
    """
    return G[e[0]][e[1]]['weight']