Graph algorithms

From rnavarych/alpha-engineer · View interactive version

Graph algorithms is an AI agent skill from the GitHub repository rnavarych/alpha-engineer. Implements graph algorithms — BFS/DFS traversal, shortest paths (Dijkstra, Bellman-Ford, Floyd-Warshall, A*, Johnson's), minimum spanning trees (Kruskal, Prim), topological sort, strongly connected components (Tarjan, Kosaraju), maximum flow (Ford-Fulkerson, Dinic), and bipartite matching (Hopcroft-

How to use this skill

Skill file

Graph Algorithms

When to use

Core principles

  1. Representation determines complexity — adjacency list for sparse, matrix for dense; wrong choice costs orders of magnitude
  2. Negative weights break Dijkstra — if any edge weight is negative, use Bellman-Ford; don't assume inputs are clean
  3. Max-flow = min-cut — network flow problems often hide as cut problems; recognize the dual
  4. Topological sort = DP on a DAG — if you can sort topologically, you can compute DP in one pass
  5. Kruskal needs Union-Find; Prim needs a heap — pick based on graph density, not familiarity

Reference Files

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.