def get_mean_degree_for_edges(edge_index, degree):
    """Finds the mean degree for each edge. This is done by finding the mean of the degree at each end of the edges.

    Parameters
    ----------
    edge_index : array
        A 2 dimensional array, containing the node indexes on either side of each edge.
    degree : array
        The degree for each node in the graph.

    Returns
    -------
    mean_degree : array
        The mean degree for each edge.
    """
    index1, index2 = edge_index[0], edge_index[1]
    mean_degree = 0.5 * (degree[index1] + degree[index2])
    return mean_degree