scipy 1.8.0 Pypi GitHub Homepage
Other Docs
ParametersReturnsBackRef
csgraph_masked_from_dense(graph, null_value=0, nan_null=True, infinity_null=True, copy=True)
versionadded

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

Construct a masked array graph representation from a dense matrix.

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)
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

scipy.sparse.csgraph._tools.csgraph_masked_from_dense

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : None#None
type: <class 'builtin_function_or_method'>
Commit: