Skip to content

Commit 8e53faa

Browse files
authored
Fix formatting and improve documentation clarity
1 parent 0797f13 commit 8e53faa

1 file changed

Lines changed: 5 additions & 11 deletions

File tree

‎graphs/graph_centrality.py‎

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
other reachable nodes (harmonic closeness centrality).
99
1010
Problem Description:
11-
Given a weighted graph G = (V, E), where V is the set of vertices and E is the set of
11+
Given a weighted graph G = (V, E), where V is the set of vertices, and E is the set of
1212
edges with positive weights representing distances between nodes, determine:
1313
14-
- Central Node: The node with minimal eccentricity. Eccentricity of a node v is defined
15-
as the greatest distance between v and any other node reachable from v.
14+
- Central Node: The node with minimal eccentricity. The eccentricity of a node v is
15+
defined as the greatest distance between v and any other node reachable from v.
1616
1717
- Median Node: The node with maximal harmonic closeness centrality. The harmonic
1818
closeness centrality of a node v is the sum of the reciprocals of the shortest-path
@@ -43,6 +43,7 @@
4343
- Median Node: node with maximal closeness.
4444
4545
References:
46+
- https://en.wikipedia.org/wiki/Centrality
4647
- Floyd-Warshall Algorithm: https://en.wikipedia.org/wiki/Floyd%E2%80%93Warshall_algorithm
4748
- Closeness Centrality: https://en.wikipedia.org/wiki/Closeness_centrality
4849
@@ -379,14 +380,7 @@ def test_large_fully_connected_graph() -> None:
379380
"""
380381

381382

382-
def main() -> None:
383-
"""
384-
Main driver function for testing the implementation with doctests.
385-
"""
383+
if __name__ == "__main__":
386384
import doctest
387385

388386
doctest.testmod()
389-
390-
391-
if __name__ == "__main__":
392-
main()

0 commit comments

Comments
 (0)