def velocity_graph(data, vkey='<STR_LIT>', xkey='<STR_LIT>', tkey=None, basis=None, n_neighbors=None, n_recurse_neighbors=None,<EOL>random_neighbors_at_max=None, sqrt_transform=False, approx=False, copy=False):
adata = data.copy() if copy else data<EOL>if vkey not in adata.layers.keys(): velocity(adata, vkey=vkey)<EOL>vgraph = VelocityGraph(adata, vkey=vkey, xkey=xkey, tkey=tkey, basis=basis, n_neighbors=n_neighbors, approx=approx,<EOL>n_recurse_neighbors=n_recurse_neighbors, random_neighbors_at_max=random_neighbors_at_max,<EOL>sqrt_transform=sqrt_transform, report=True)<EOL>logg.info('<STR_LIT>', r=True)<EOL>vgraph.compute_cosines()<EOL>adata.uns[vkey+'<STR_LIT>'] = vgraph.graph<EOL>adata.uns[vkey+'<STR_LIT>'] = vgraph.graph_neg<EOL>logg.info('<STR_LIT>', time=True, end='<STR_LIT:U+0020>' if settings.verbosity > <NUM_LIT:2> else '<STR_LIT:\n>')<EOL>logg.hint(<EOL>'<STR_LIT>'<EOL>'<STR_LIT>' + vkey + '<STR_LIT>')<EOL>return adata if copy else None<EOL>
Computes velocity graph based on cosine similarities.

    The cosine similarities are computed between velocities and potential cell state transitions.

    Arguments
    ---------
    data: :class:`~anndata.AnnData`
        Annotated data matrix.
    vkey: `str` (default: `'velocity'`)
        Name of velocity estimates to be used.
    n_neighbors: `int` or `None` (default: None)
        Use fixed number of neighbors or do recursive neighbor search (if `None`).
    n_recurse_neighbors: `int` (default: 2)
        Number of recursions to be done for neighbors search.
    random_neighbors_at_max: `int` or `None` (default: `None`)
        If number of iterative neighbors for an individual cell is higher than this threshold,
        a random selection of such are chosen as reference neighbors.
    sqrt_transform: `bool` (default: `False`)
        Whether to variance-transform the cell states changes and velocities before computing cosine similarities.
    copy: `bool` (default: `False`)
        Return a copy instead of writing to adata.

    Returns
    -------
    Returns or updates `adata` with the attributes
    velocity_graph: `.uns`
        sparse matrix with transition probabilities