Pattern
Advanced Graphs
These problems add weights, costs or grouping rules to the basic walk. Shortest paths over weighted links need a heap, and grouping problems often need a union-find structure. Costs are usually O(E log V), or close to O(E).
1. Min Cost to Connect All Pointsgraph · minimum spanning tree · greedyMed.2. Network Delay Timegraph · shortest path · dijkstra · heapMed.3. Cheapest Flights Within K Stopsgraph · shortest path · bellman-fordMed.4. Reconstruct Itinerarygraph · eulerian path · stackHard5. Swim In Rising Watergraph · shortest path · heap · gridHard6. Alien Dictionarygraph · topological sort · stringHard