Skip to content

Commit d618013

Browse files
authored
Refactor main function and update docstring formatting
1 parent a5f9b2e commit d618013

1 file changed

Lines changed: 5 additions & 12 deletions

File tree

‎graphs/graph_peripherality.py‎

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
all other reachable nodes (farness).
1010
1111
Problem Description:
12-
Given a weighted graph G = (V, E), where V is the set of vertices and E is the set of
13-
edges with positive weights representing distances between nodes, determine:
12+
Given a weighted graph G = (V, E), where V is the set of vertices, and E is the set
13+
of edges with positive weights representing distances between nodes, determine:
1414
15-
- Peripheral Node: The node with maximal eccentricity. Eccentricity of a node v is
16-
defined as the greatest distance between v and any other node reachable from v.
15+
- Peripheral Node: The node with maximal eccentricity. The eccentricity of a node v
16+
is defined as the greatest distance between v and any other node reachable from v.
1717
1818
- Far Node: The node with maximal farness. Farness of a node v is the sum of the
1919
shortest-path distances from v to all other reachable nodes.
@@ -387,14 +387,7 @@ def test_large_fully_connected_graph() -> None:
387387
"""
388388

389389

390-
def main() -> None:
391-
"""
392-
Main driver function for testing the implementation with doctests.
393-
"""
390+
if __name__ == "__main__":
394391
import doctest
395392

396393
doctest.testmod()
397-
398-
399-
if __name__ == "__main__":
400-
main()

0 commit comments

Comments
 (0)