{ } Raw JSON

bundles / skimage 0.26.1rc0.dev0+git20260530.b607368ff / skimage / graph / _graph / central_pixel

function

skimage.graph._graph:central_pixel

source: /dev/scikit-image/src/skimage/graph/_graph.py :163

Signature

def   central_pixel ( graph nodes = None shape = None partition_size = 100 )

Summary

Find the pixel with the highest closeness centrality.

Extended Summary

Closeness centrality is the inverse of the total sum of shortest distances from a node to every other node.

Parameters

graph : scipy.sparse.csr_array or scipy.sparse.csr_matrix

The sparse representation of the graph.

nodes : array of int

The raveled index of each node in graph in the image. If not provided, the returned value will be the index in the input graph.

shape : tuple of int

The shape of the image in which the nodes are embedded. If provided, the returned coordinates are a NumPy multi-index of the same dimensionality as the input shape. Otherwise, the returned coordinate is the raveled index provided in nodes.

partition_size : int

This function computes the shortest path distance between every pair of nodes in the graph. This can result in a very large (N*N) matrix. As a simple performance tweak, the distance values are computed in lots of partition_size, resulting in a memory requirement of only partition_size*N.

Returns

position : int or tuple of int

If shape is given, the coordinate of the central pixel in the image. Otherwise, the raveled index of that pixel.

distances : array of float

The total sum of distances from each node to each other reachable node.

Aliases

  • skimage.graph.central_pixel