Skip to content

Commit

Permalink
Merge branch 'typos'
Browse files Browse the repository at this point in the history
  • Loading branch information
cbueth committed Apr 16, 2024
2 parents c166929 + f775cab commit 9ac5dec
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions superblockify/metrics/measures.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
def calculate_directness(distance_matrix, measure1, measure2):
r"""Calculate the directness for the given network measures.
The directness in the mean of the ratios between the distances of the two
The directness is the mean of the ratios between the distances of the two
network measures.
If any of the distances is 0 or infinite, it is ignored in the calculation.
Expand Down Expand Up @@ -193,7 +193,7 @@ def write_relative_increase_to_edges(
):
"""Write the relative increase of the distance matrix to the edges of the graph.
For each edge the relative increases to and from every node to the two nodes
For each edge, the relative increases to and from every node to the two nodes
of the edge are averaged and written to the edge attribute "rel_increase".
Parameters
Expand Down Expand Up @@ -245,7 +245,7 @@ def betweenness_centrality(
Uses the predecessors to calculate the betweenness centrality of the nodes and
edges. The normalized betweenness centrality is calculated, length-scaled, and
linearly scaled betweenness centrality are calculated for the nodes and edges. When
linearly scaled betweenness centrality is calculated for the nodes and edges. When
passing a k, the summation is only done over k random nodes. [1]_ [2]_ [3]_
Parameters
Expand Down Expand Up @@ -280,19 +280,19 @@ def betweenness_centrality(
Raises
------
ValueError
If weight is not None and the graph does not have the weight attribute on all
If weight is not None, and the graph does not have the weight attribute on all
edges.
Notes
-----
Works in-place on the graph.
Does not include endpoints.
It Does not include endpoints.
Modified from :mod:`networkx.algorithms.centrality.betweenness`.
The :attr:`weight` attribute is not used to determine the shortest paths, these are
taken from the predecessors matrix. It is only used for parallel edges, to decide
taken from the predecessor matrix. It is only used for parallel edges to decide
which edge to attribute the betweenness centrality to.
If there are :math:`<=` 2 nodes, node betweenness is 0 for all nodes. If there are
Expand Down Expand Up @@ -600,7 +600,7 @@ def _sum_bc(
"""

betweennesses = np.zeros((len(pred) + len(edges_uv), 3), dtype=np.float64)
# The first len(pred) rows correspond to node betweenness, the rest to edge
# The first len(pred) rows correspond to node betweenness; the rest to edge
# The 3 layers correspond to normal, length-scaled, and linearly scaled

# Loop over nodes to collect betweenness using pair-wise dependencies
Expand Down Expand Up @@ -681,7 +681,7 @@ def __calculate_high_bc_clustering(coord_bc, threshold_idx):
\sum_{i = 1}^{N_{\theta}} x_i
The distance calculation :math:`\| x_i - x_{\mathrm{cm}, \theta} \|` includes the
x and y coordinates of the node, and is the Euclidean distance. In this case it
x and y coordinates of the node, and is the Euclidean distance. In this case, it
is the Frobenius norm of the difference between the node coordinates and the
center of mass of the high betweenness nodes.
Expand All @@ -700,15 +700,15 @@ def __calculate_high_bc_clustering(coord_bc, threshold_idx):
Raises
------
ValueError
If the coordinate array is has less than two nodes.
If the coordinate array has less than two nodes.
ValueError
If the threshold index is greater than the number of nodes.
"""
if len(coord_bc) < 2:
raise ValueError("Coordinate array must have at least two nodes.")
if threshold_idx >= len(coord_bc):
raise ValueError("Threshold index must be less than the number of nodes.")
# Center of mass of high betweenness nodes
# High betweenness nodes center of mass
high_bc_cm = np.mean(coord_bc[threshold_idx:, :2], axis=0)
# Average distance to center of mass
avg_dist = np.mean(
Expand All @@ -729,7 +729,7 @@ def __calculate_high_bc_anisotropy(coord_high_bc):
Parameters
----------
coord_high_bc : np.ndarray
Array of node coordinates of the high betweenness nodes.
Array of the high betweenness nodes coordinates.
Returns
-------
Expand Down

0 comments on commit 9ac5dec

Please sign in to comment.