Repository navigation
Commit a5f9b2e
committed
Initial Commit: Add algorithms to determine peripheral and farthest nodes in a weighted graph
- Implemented Floyd-Warshall algorithm to calculate all-pairs shortest paths,
supporting positive edge weights for weighted graphs.
- Added functions to identify peripheral and far nodes:
- `find_peripheral_node`: Determines the node with maximal eccentricity.
- `find_far_node`: Finds the node with maximal farness, summing shortest-path distances.
- Included error handling for non-positive edge weights, with appropriate ValueError raising.
- Developed extensive test cases using doctests:
- Covered single-node, fully connected, sparse, cyclic, directed acyclic, and
disconnected graphs.
- Validated handling of edge cases including zero and negative weights.
- Ensured code meets PEP 8 standards and passed all lint checks with `ruff`.
- Provided detailed module-level docstring with explanations of algorithms,
complexity, and example applications.
This commit provides foundational functionality for graph-theoretical analysis
and sets up for future expansions or integrations.1 parent 2d671df commit a5f9b2e
1 file changed
Lines changed: 400 additions & 0 deletions
0 commit comments