> ## Documentation Index
> Fetch the complete documentation index at: https://leetcode-py.wisl.dev/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> leetcode-py is a Python LeetCode practice environment generator with one CLI: lcpy. It is not a service or platform.
> Each problem is a directory under leetcode/ with README.md, solution.py, test_solution.py, helpers.py, and playground.ipynb. lcpy gen creates them from JSON templates bundled with the package.
> Examples are backed by tests; copy them verbatim.

# Graph Theory in Python with Tests

> All 52 Graph Theory LeetCode problems with tested Python solutions.

Graph Theory holds 52 problems (1 Easy, 31 Medium, 20 Hard).
Generate any of them into the current directory with `lcpy gen -n <number>`.

| # | Problem | Difficulty | Solution |
| - | - | - | - |
| 329 | [Longest Increasing Path in a Matrix](https://leetcode-py.wisl.dev/problems/longest-increasing-path-in-a-matrix) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/longest_increasing_path_in_a_matrix/solution.py) |
| 332 | [Reconstruct Itinerary](https://leetcode-py.wisl.dev/problems/reconstruct-itinerary) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/reconstruct_itinerary/solution.py) |
| 399 | [Evaluate Division](https://leetcode-py.wisl.dev/problems/evaluate-division) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/evaluate_division/solution.py) |
| 547 | [Number of Provinces](https://leetcode-py.wisl.dev/problems/number-of-provinces) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/number_of_provinces/solution.py) |
| 684 | [Redundant Connection](https://leetcode-py.wisl.dev/problems/redundant-connection) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/redundant_connection/solution.py) |
| 685 | [Redundant Connection II](https://leetcode-py.wisl.dev/problems/redundant-connection-ii) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/redundant_connection_ii/solution.py) |
| 743 | [Network Delay Time](https://leetcode-py.wisl.dev/problems/network-delay-time) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/network_delay_time/solution.py) |
| 753 | [Cracking the Safe](https://leetcode-py.wisl.dev/problems/cracking-the-safe) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/cracking_the_safe/solution.py) |
| 765 | [Couples Holding Hands](https://leetcode-py.wisl.dev/problems/couples-holding-hands) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/couples_holding_hands/solution.py) |
| 785 | [Is Graph Bipartite?](https://leetcode-py.wisl.dev/problems/is-graph-bipartite) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/is_graph_bipartite/solution.py) |
| 787 | [Cheapest Flights Within K Stops](https://leetcode-py.wisl.dev/problems/cheapest-flights-within-k-stops) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/cheapest_flights_within_k_stops/solution.py) |
| 797 | [All Paths From Source to Target](https://leetcode-py.wisl.dev/problems/all-paths-source-target) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/all_paths_source_target/solution.py) |
| 802 | [Find Eventual Safe States](https://leetcode-py.wisl.dev/problems/find-eventual-safe-states) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/find_eventual_safe_states/solution.py) |
| 834 | [Sum of Distances in Tree](https://leetcode-py.wisl.dev/problems/sum-of-distances-in-tree) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/sum_of_distances_in_tree/solution.py) |
| 841 | [Keys and Rooms](https://leetcode-py.wisl.dev/problems/keys-and-rooms) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/keys_and_rooms/solution.py) |
| 847 | [Shortest Path Visiting All Nodes](https://leetcode-py.wisl.dev/problems/shortest-path-visiting-all-nodes) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/shortest_path_visiting_all_nodes/solution.py) |
| 851 | [Loud and Rich](https://leetcode-py.wisl.dev/problems/loud-and-rich) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/loud_and_rich/solution.py) |
| 882 | [Reachable Nodes In Subdivided Graph](https://leetcode-py.wisl.dev/problems/reachable-nodes-in-subdivided-graph) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/reachable_nodes_in_subdivided_graph/solution.py) |
| 886 | [Possible Bipartition](https://leetcode-py.wisl.dev/problems/possible-bipartition) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/possible_bipartition/solution.py) |
| 913 | [Cat and Mouse](https://leetcode-py.wisl.dev/problems/cat-and-mouse) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/cat_and_mouse/solution.py) |
| 947 | [Most Stones Removed with Same Row or Column](https://leetcode-py.wisl.dev/problems/most-stones-removed-with-same-row-or-column) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/most_stones_removed_with_same_row_or_column/solution.py) |
| 990 | [Satisfiability of Equality Equations](https://leetcode-py.wisl.dev/problems/satisfiability-of-equality-equations) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/satisfiability_of_equality_equations/solution.py) |
| 997 | [Find the Town Judge](https://leetcode-py.wisl.dev/problems/find-the-town-judge) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/find_the_town_judge/solution.py) |
| 1334 | [Find the City With the Smallest Number of Neighbors at a Threshold Distance](https://leetcode-py.wisl.dev/problems/find-the-city-with-the-smallest-number-of-neighbors-at-a-threshold-distance) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/find_the_city_with_the_smallest_number_of_neighbors_at_a_threshold_distance/solution.py) |
| 1462 | [Course Schedule IV](https://leetcode-py.wisl.dev/problems/course-schedule-iv) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/course_schedule_iv/solution.py) |
| 1466 | [Reorder Routes to Make All Paths Lead to the City Zero](https://leetcode-py.wisl.dev/problems/reorder-routes-to-make-all-paths-lead-to-the-city-zero) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/reorder_routes_to_make_all_paths_lead_to_the_city_zero/solution.py) |
| 1489 | [Find Critical and Pseudo-Critical Edges in Minimum Spanning Tree](https://leetcode-py.wisl.dev/problems/find-critical-and-pseudo-critical-edges-in-minimum-spanning-tree) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/find_critical_and_pseudo_critical_edges_in_minimum_spanning_tree/solution.py) |
| 1514 | [Path with Maximum Probability](https://leetcode-py.wisl.dev/problems/path-with-maximum-probability) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/path_with_maximum_probability/solution.py) |
| 1557 | [Minimum Number of Vertices to Reach All Nodes](https://leetcode-py.wisl.dev/problems/minimum-number-of-vertices-to-reach-all-nodes) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/minimum_number_of_vertices_to_reach_all_nodes/solution.py) |
| 1579 | [Remove Max Number of Edges to Keep Graph Fully Traversable](https://leetcode-py.wisl.dev/problems/remove-max-number-of-edges-to-keep-graph-fully-traversable) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/remove_max_number_of_edges_to_keep_graph_fully_traversable/solution.py) |
| 1584 | [Min Cost to Connect All Points](https://leetcode-py.wisl.dev/problems/min-cost-to-connect-all-points) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/min_cost_to_connect_all_points/solution.py) |
| 1857 | [Largest Color Value in a Directed Graph](https://leetcode-py.wisl.dev/problems/largest-color-value-in-a-directed-graph) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/largest_color_value_in_a_directed_graph/solution.py) |
| 1976 | [Number of Ways to Arrive at Destination](https://leetcode-py.wisl.dev/problems/number-of-ways-to-arrive-at-destination) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/number_of_ways_to_arrive_at_destination/solution.py) |
| 2045 | [Second Minimum Time to Reach Destination](https://leetcode-py.wisl.dev/problems/second-minimum-time-to-reach-destination) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/second_minimum_time_to_reach_destination/solution.py) |
| 2050 | [Parallel Courses III](https://leetcode-py.wisl.dev/problems/parallel-courses-iii) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/parallel_courses_iii/solution.py) |
| 2092 | [Find All People With Secret](https://leetcode-py.wisl.dev/problems/find-all-people-with-secret) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/find_all_people_with_secret/solution.py) |
| 2101 | [Detonate the Maximum Bombs](https://leetcode-py.wisl.dev/problems/detonate-the-maximum-bombs) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/detonate_the_maximum_bombs/solution.py) |
| 2115 | [Find All Possible Recipes from Given Supplies](https://leetcode-py.wisl.dev/problems/find-all-possible-recipes-from-given-supplies) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/find_all_possible_recipes_from_given_supplies/solution.py) |
| 2285 | [Maximum Total Importance of Roads](https://leetcode-py.wisl.dev/problems/maximum-total-importance-of-roads) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/maximum_total_importance_of_roads/solution.py) |
| 2290 | [Minimum Obstacle Removal to Reach Corner](https://leetcode-py.wisl.dev/problems/minimum-obstacle-removal-to-reach-corner) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/minimum_obstacle_removal_to_reach_corner/solution.py) |
| 2359 | [Find Closest Node to Given Two Nodes](https://leetcode-py.wisl.dev/problems/find-closest-node-to-given-two-nodes) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/find_closest_node_to_given_two_nodes/solution.py) |
| 2392 | [Build a Matrix With Conditions](https://leetcode-py.wisl.dev/problems/build-a-matrix-with-conditions) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/build_a_matrix_with_conditions/solution.py) |
| 2421 | [Number of Good Paths](https://leetcode-py.wisl.dev/problems/number-of-good-paths) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/number_of_good_paths/solution.py) |
| 2467 | [Most Profitable Path in a Tree](https://leetcode-py.wisl.dev/problems/most-profitable-path-in-a-tree) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/most_profitable_path_in_a_tree/solution.py) |
| 2477 | [Minimum Fuel Cost to Report to the Capital](https://leetcode-py.wisl.dev/problems/minimum-fuel-cost-to-report-to-the-capital) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/minimum_fuel_cost_to_report_to_the_capital/solution.py) |
| 2492 | [Minimum Score of a Path Between Two Cities](https://leetcode-py.wisl.dev/problems/minimum-score-of-a-path-between-two-cities) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/minimum_score_of_a_path_between_two_cities/solution.py) |
| 2577 | [Minimum Time to Visit a Cell In a Grid](https://leetcode-py.wisl.dev/problems/minimum-time-to-visit-a-cell-in-a-grid) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/minimum_time_to_visit_a_cell_in_a_grid/solution.py) |
| 2685 | [Count the Number of Complete Components](https://leetcode-py.wisl.dev/problems/count-complete-components) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/count_complete_components/solution.py) |
| 2924 | [Find Champion II](https://leetcode-py.wisl.dev/problems/find-champion-ii) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/find_champion_ii/solution.py) |
| 2976 | [Minimum Cost to Convert String I](https://leetcode-py.wisl.dev/problems/minimum-cost-to-convert-string-i) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/minimum_cost_to_convert_string_i/solution.py) |
| 3203 | [Find Minimum Diameter After Merging Two Trees](https://leetcode-py.wisl.dev/problems/find-minimum-diameter-after-merging-two-trees) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/find_minimum_diameter_after_merging_two_trees/solution.py) |
| 3243 | [Shortest Distance After Road Addition Queries I](https://leetcode-py.wisl.dev/problems/shortest-distance-after-queries-i) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/shortest_distance_after_queries_i/solution.py) |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.