closeness_centrality#
- closeness_centrality(domain, network_name='default_network', edge_weight_name=None, add_as_label_to_objects=True, new_label_name='closeness centrality', label_cmap='plasma')#
Computes the closeness centrality of each node using the networkx implementation. Average shortest distance to all other reachable nodes. Centrality values will be added as object labels if add_as_label_to_objects is True.
- Parameters:
- domainobject
The domain object containing the network.
- network_namestr, optional
The name of the network to compute centrality for, by default ‘default_network’.
- edge_weight_namestr, optional
The name of the edge weight attribute to use for the computation, by default None.
- add_as_label_to_objectsbool, optional
Whether to add the centrality values as labels to the objects, by default True.
- new_label_namestr, optional
The name of the new label to be added, by default ‘closeness centrality’.
- label_cmapstr, optional
The colormap to use for the labels, by default ‘plasma’.
- Returns:
- dict
A dictionary of nodes with their corresponding closeness centrality values.
- Raises:
- ValueError
If the network name is not in the list of generated networks.
- ValueError
If the edge weight name is not in the list of edge weights for the network.