Participer au site avec un Tip
Rechercher
 

Améliorations / Corrections

Vous avez des améliorations (ou des corrections) à proposer pour ce document : je vous remerçie par avance de m'en faire part, cela m'aide à améliorer le site.

Emplacement :

Description des améliorations :

Vous êtes un professionnel et vous avez besoin d'une formation ? Programmation Python
Les fondamentaux
Voir le programme détaillé
Module « scipy.sparse.csgraph »

Fonction csgraph_masked_from_dense - module scipy.sparse.csgraph

Signature de la fonction csgraph_masked_from_dense

def csgraph_masked_from_dense(graph, null_value=0, nan_null=True, infinity_null=True, copy=True) 

Description

help(scipy.sparse.csgraph.csgraph_masked_from_dense)

    csgraph_masked_from_dense(graph, null_value=0, nan_null=True,
                              infinity_null=True, copy=True)

    Construct a masked array graph representation from a dense matrix.

    .. versionadded:: 0.11.0

    Parameters
    ----------
    graph : array_like
        Input graph.  Shape should be (n_nodes, n_nodes).
    null_value : float or None (optional)
        Value that denotes non-edges in the graph.  Default is zero.
    infinity_null : bool
        If True (default), then infinite entries (both positive and negative)
        are treated as null edges.
    nan_null : bool
        If True (default), then NaN entries are treated as non-edges

    Returns
    -------
    csgraph : MaskedArray
        masked array representation of graph

    Examples
    --------
    >>> from scipy.sparse.csgraph import csgraph_masked_from_dense

    >>> graph = [
    ... [0, 1, 2, 0],
    ... [0, 0, 0, 1],
    ... [0, 0, 0, 3],
    ... [0, 0, 0, 0]
    ... ]

    >>> csgraph_masked_from_dense(graph)
    masked_array(
      data=[[--,  1,  2, --],
            [--, --, --,  1],
            [--, --, --,  3],
            [--, --, --, --]],
      mask=[[ True, False, False,  True],
            [ True,  True,  True, False],
            [ True,  True,  True, False],
            [ True,  True,  True,  True]],
      fill_value=0)

    


Vous êtes un professionnel et vous avez besoin d'une formation ? Calcul scientifique
avec Python
Voir le programme détaillé