spacenet.centrality.laplacian#

spacenet.centrality.laplacian(spatial_network, nodes=None, edge_weight_name='Distance', add_as_node_label=False, node_label_name='laplacian')#

Computes the Laplacian centrality for the nodes in the spatial network. The Laplacian centrality of a node is defined as the change in the Laplacian energy of the network when that node is removed. This measure captures the importance of a node in terms of its contribution to the overall connectivity of the network, with higher values indicating more central nodes.

Parameters:
spatial_networkNetworkX graph

The spatial network for which to calculate the Laplacian centrality.

nodeslist or np.ndarray, optional

The set of nodes to compute the centrality. Default is ‘None’, computing for all nodes.

edge_weight_namestr, optional

The name of the edge attribute in the graph that corresponds to the distance between nodes. Default is ‘Distance’.

add_as_node_labelbool, optional

Whether to add the computed centrality values as a node attribute in the spatial network. Default is False.

node_label_namestr, optional

The name of the node attribute to which to add the computed centrality values if add_as_node_label is True. Default is ‘laplacian’.

Returns:
laplacian_valuesnp.ndarray

An array of Laplacian centrality values for the specified nodes in the spatial network. The order of the values corresponds to the order of the nodes in the ‘nodes’ parameter.

nodesnp.ndarray

An array of the node ids for which the centrality values were computed. The order of the nodes corresponds to the order of the values in the ‘laplacian_values’ array.