(graph, embedding)
return result
Given a bipartite graph representing the 1-simplices and strengths between the
     new points and the original data set along with an embedding of the original points
    initialize the positions of new points relative to the strengths (of their neighbors in the source data).

    If a point is in our original data set it embeds at the original points coordinates.
    If a point has no neighbours in our original dataset it embeds as the np.nan vector.
    Otherwise a point is the weighted average of it's neighbours embedding locations.

    Parameters
    ----------
    graph: csr_matrix (n_new_samples, n_samples)
        A matrix indicating the the 1-simplices and their associated strengths.  These strengths should
        be values between zero and one and not normalized.  One indicating that the new point was identical
        to one of our original points.

    embedding: array of shape (n_samples, dim)
        The original embedding of the source data.

    Returns
    -------
    new_embedding: array of shape (n_new_samples, dim)
        An initial embedding of the new sample points.
Given a bipartite graph representing the 1-simplices and strengths between the
     new points and the original data set along with an embedding of the original points
    initialize the positions of new points relative to the strengths (of their neighbors in the source data).
Given a bipartite graph representing the 1 - simplices and strengths between the new points and the original data set along with an embedding of the original points initialize the positions of new points relative to the strengths ( of their neighbors in the source data ) .
def init_graph_transform(graph, embedding):
    """Given a bipartite graph representing the 1-simplices and strengths between the
     new points and the original data set along with an embedding of the original points
    initialize the positions of new points relative to the strengths (of their neighbors in the source data).

    If a point is in our original data set it embeds at the original points coordinates.
    If a point has no neighbours in our original dataset it embeds as the np.nan vector.
    Otherwise a point is the weighted average of it's neighbours embedding locations.

    Parameters
    ----------
    graph: csr_matrix (n_new_samples, n_samples)
        A matrix indicating the the 1-simplices and their associated strengths.  These strengths should
        be values between zero and one and not normalized.  One indicating that the new point was identical
        to one of our original points.

    embedding: array of shape (n_samples, dim)
        The original embedding of the source data.

    Returns
    -------
    new_embedding: array of shape (n_new_samples, dim)
        An initial embedding of the new sample points.
    """
    result = np.zeros((graph.shape[0], embedding.shape[1]), dtype=np.float32)

    for row_index in range(graph.shape[0]):
        num_neighbours = len(graph[row_index].indices)
        if num_neighbours == 0:
            result[row_index] = np.nan
            continue
        row_sum = np.sum(graph[row_index])
        for col_index in graph[row_index].indices:
            if graph[row_index, col_index] == 1:
                result[row_index, :] = embedding[col_index, :]
                break
            for d in range(embedding.shape[1]):
                result[row_index, d] += (
                    graph[row_index, col_index] / row_sum * embedding[col_index, d]
                )

    return result
def init_graph_transform ( graph , embedding ) : result = np . zeros ( ( graph . shape [ 0 ] , embedding . shape [ 1 ] ) , dtype = np . float32 ) for row_index in range ( graph . shape [ 0 ] ) : num_neighbours = len ( graph [ row_index ] . indices ) if num_neighbours == 0 : result [ row_index ] = np . nan continue row_sum = np . sum ( graph [ row_index ] ) for col_index in graph [ row_index ] . indices : if graph [ row_index , col_index ] == 1 : result [ row_index , : ] = embedding [ col_index , : ] break for d in range ( embedding . shape [ 1 ] ) : result [ row_index , d ] += ( graph [ row_index , col_index ] / row_sum * embedding [ col_index , d ] ) return result