Graph algorithms are procedures for computing properties of graphs—mathematical structures used to model pairwise relations between objects. A graph consists of a set of vertices (also called nodes) and a set of edges, each edge connecting two vertices. Graphs can be undirected, where edges have no direction, or directed, where each edge has a source and a target. They may be weighted, with numerical values on edges representing costs, distances, or capacities, or unweighted. The field of graph algorithms studies how to solve problems on such structures efficiently: finding paths, partitioning vertices, detecting patterns, ordering elements, or optimizing flows, among many others.
The central questions of the field are existential and computational. Given a graph and a property, does the property hold? Can we find a structure that satisfies given constraints? And crucially, can we do so quickly, using an amount of time and memory that scales reasonably with the size of the graph? Because graphs arise naturally in countless domains—transportation networks, social connections, communication systems, biological interactions, dependency structures, and circuit layouts—the practical stakes are high. A graph algorithm that runs in time proportional to the number of edges can handle networks with millions of connections; one that requires checking all subsets of vertices cannot. Much of the field's intellectual energy goes into determining which problems admit efficient algorithms, which do not, and what compromises are possible.
Graph theory as a mathematical subject began in the eighteenth century with Leonhard Euler's analysis of the Königsberg bridge problem, which asked whether a walk could traverse each of the city's seven bridges exactly once. Euler abstracted the problem into vertices (land masses) and edges (bridges), showing that no such walk exists because too many vertices have odd degree—the number of edges incident to them. This early result was a theorem about graphs, not yet an algorithm. For more than a century, graph theory remained a branch of pure mathematics, concerned with existence and characterization rather than computation.
The algorithmic study of graphs emerged in the mid-twentieth century, driven by two converging forces. The first was the rise of computers, which made it meaningful to ask not just whether a structure exists but how to find it efficiently. The second was the growth of operations research and engineering, which posed concrete problems: how to route telephone calls, schedule tasks, or design networks at minimum cost. Early work in the 1950s and 1960s produced foundational algorithms that remain in use: methods for finding shortest paths, building minimum spanning trees, and computing maximum flows. These were developed by researchers such as Edsger Dijkstra, Robert Floyd, Lester Ford, Delbert Fulkerson, Joseph Kruskal, and Robert Prim, often working independently and sometimes publishing nearly simultaneously.
A second major development came in the 1970s with the theory of NP-completeness, which provided a framework for understanding why some graph problems seem intractable. Many natural graph problems—finding a Hamiltonian cycle, coloring a graph with few colors, or finding a large clique—appear to require exponential time in the worst case. The theory of NP-completeness showed that these problems are all equivalent in a precise sense: if any one of them has an efficient algorithm, then all of them do, and such an algorithm is widely believed not to exist. This result reshaped the field. It separated graph problems into those with known efficient algorithms and those that are NP-hard, and it motivated new research directions: approximation algorithms that find near-optimal solutions, parameterized algorithms that are efficient when some aspect of the input is small, and special-case algorithms for restricted graph classes.
The field is not organized into rival schools in the way that, say, some philosophical traditions are. Rather, it is structured by distinct research programmes that address different kinds of questions and use different mathematical tools. These approaches coexist and often combine.
One of the oldest and most practically important branches concerns finding optimal paths and structures in weighted graphs. The single-source shortest path problem asks for the minimum-cost route from one vertex to all others. Dijkstra's algorithm, which greedily expands the set of vertices with known shortest distances, solves this problem efficiently when edge weights are nonnegative. For graphs with negative weights, the Bellman-Ford algorithm handles the general case but runs more slowly. The all-pairs shortest path problem, which asks for distances between every pair of vertices, can be solved by repeated application of single-source algorithms or by the Floyd-Warshall algorithm, which uses dynamic programming.
A related problem is the minimum spanning tree: find a set of edges that connects all vertices with minimum total weight. Kruskal's and Prim's algorithms solve this problem greedily, and both are efficient. The maximum flow problem asks how much material can be sent from a source to a sink through a network of edges with capacities. The Ford-Fulkerson method, and its refinement by Edmonds and Karp, established the basic approach; subsequent algorithms by Dinic and others improved the worst-case running time substantially. A central result, the max-flow min-cut theorem, states that the maximum flow equals the minimum capacity of a cut separating source from sink—a duality that connects flow computation to the problem of finding bottlenecks.
These problems share a common structure: they are all solvable by polynomial-time algorithms, and they all have practical applications in routing, logistics, and network design. The approach is characterized by careful data structures, greedy or dynamic programming strategies, and rigorous worst-case analysis. The field has matured to the point where these algorithms are standard components of software libraries, and the main research questions concern specialized variants: dynamic graphs where edges change over time, distributed settings where no single processor has the whole graph, and approximation for NP-hard optimization problems.
A second major tradition is the study of computational hardness. Beginning in the early 1970s, Stephen Cook and Richard Karp established that a large class of graph problems are NP-complete: they are at least as hard as any problem whose solution can be verified quickly, and no efficient algorithm for them is known. Classic examples include the traveling salesman problem (find the shortest tour visiting all vertices), graph coloring (assign colors to vertices so that adjacent vertices differ, using few colors), and the clique problem (find a large set of mutually connected vertices).
The significance of this work is not merely negative. Knowing that a problem is NP-hard changes the kind of algorithm one seeks. Instead of an exact polynomial-time algorithm, researchers may develop approximation algorithms that guarantee a solution within a factor of the optimum, or heuristic methods that work well in practice without formal guarantees, or exact algorithms that are exponential but faster than brute force. The theory also provides a classification scheme: problems are organized by their computational complexity, and reductions between problems reveal deep structural relationships. For example, the fact that vertex cover, independent set, and clique are all equivalent under polynomial-time reductions means that an insight about any one of them applies to all three.
This tradition is characterized by a particular style of argument: to show a problem is hard, one constructs a reduction from a known hard problem, mapping instances in a way that preserves the answer. The approach has limits. NP-completeness is a worst-case notion; a problem may be NP-hard in general yet easy on the graphs that actually arise in practice. Moreover, the theory does not distinguish between problems that are merely hard and those that are truly infeasible; some NP-hard problems admit approximation schemes that get arbitrarily close to optimal, while others cannot be approximated at all unless P equals NP.
A more recent research programme, developed primarily from the late 1980s onward, asks a different question: instead of measuring complexity only by the size of the graph, what if we also measure it by some additional parameter? For many NP-hard problems, there is a natural parameter—the size of the solution, the treewidth of the graph, or the number of vertices that need to be deleted to make the graph simple—that is small in practical instances. Parameterized complexity studies algorithms that run in time polynomial in the input size but possibly exponential in the parameter. A problem that admits such an algorithm is called fixed-parameter tractable.
For example, the vertex cover problem—find the smallest set of vertices that touches every edge—is NP-hard in general. But if we ask whether there is a vertex cover of size at most k, there are algorithms that run in time roughly 2^k times a polynomial in the graph size. When k is small, say 20 or 30, such algorithms are practical even for very large graphs. The theory also identifies problems that are unlikely to be fixed-parameter tractable, using a hierarchy of complexity classes and reductions that preserve the parameter.
This approach has changed how researchers think about hard graph problems. It provides a refined landscape that distinguishes between problems that are hard only in an uninteresting worst-case sense and those that remain hard even when a natural parameter is small. It has also produced deep connections to graph structure theory, particularly through the notion of treewidth, which measures how tree-like a graph is. Many NP-hard problems become easy on graphs of bounded treewidth, and algorithms that exploit this structure have become a major tool.
A fourth tradition, more mathematical in flavor, studies the global structure of graphs and uses it to derive algorithmic consequences. The most influential development here is the graph minor theory of Neil Robertson and Paul Seymour, developed over a series of papers from the 1980s through the 2000s. A graph H is a minor of a graph G if H can be obtained from G by deleting vertices, deleting edges, and contracting edges (merging adjacent vertices). Robertson and Seymour proved that every family of graphs closed under taking minors can be characterized by a finite set of forbidden minors—a result known as the graph minor theorem. This theorem is highly nonconstructive, but it has algorithmic consequences: for any fixed graph H, testing whether H is a minor of G can be done in polynomial time, and many problems that are NP-hard in general become solvable in polynomial time on graphs that exclude a fixed minor.
This tradition emphasizes structural decomposition. Graphs that exclude a fixed minor have a hierarchical structure that can be exploited algorithmically: they can be decomposed into pieces that are nearly planar, arranged in a tree-like fashion. This leads to algorithms that are efficient in theory, though often with enormous constant factors that make them impractical. The influence of this work is more conceptual than practical; it provides a deep understanding of what makes graphs hard and offers a unifying framework for many seemingly unrelated results.
A fifth approach considers settings where the standard assumption—that a single processor has random access to the entire graph—does not hold. In distributed computing, each vertex is a processor that communicates with its neighbors, and the goal is to compute global properties using only local communication. In parallel computing, the graph is processed by many processors simultaneously, and the goal is to minimize the number of parallel steps. In streaming algorithms, the graph is revealed incrementally, and the algorithm must make decisions with limited memory.
These settings change the nature of algorithmic thinking. A problem that is trivial in the standard model—say, determining whether a graph is connected—becomes nontrivial when no processor can see the whole graph. The central questions concern trade-offs: how much communication is needed, how many rounds of parallel computation, how much memory. These models have grown in importance with the rise of large-scale networks and distributed systems, and they have produced distinctive techniques, such as random sampling, sketching, and local computation.
These traditions are not isolated. The most productive work in graph algorithms often combines them. Approximation algorithms for NP-hard problems frequently use structural insights from graph theory; parameterized algorithms often rely on the decomposition techniques developed in minor theory; distributed algorithms for optimization problems build on classical shortest path and flow methods. The field is unified by a common object of study—the graph—and by a common standard of rigor: algorithms must be correct, and their resource usage must be analyzed precisely.
There are also genuine tensions. The worst-case analysis that dominates the classical tradition can be misleading for practical inputs, leading some researchers to study average-case complexity or to design algorithms with good practical performance even when worst-case guarantees are weak. The graph minor theory, while mathematically profound, has produced few algorithms that are usable in practice, and some researchers question whether its elaborate machinery justifies its complexity. These disagreements are productive; they reflect different priorities—theoretical elegance, practical efficiency, worst-case guarantees, or empirical performance—rather than incompatible worldviews.
The current field of graph algorithms is broad and active. Classical problems continue to receive attention, with improvements in running times achieved through better data structures and more refined analysis. The maximum flow problem, for instance, has seen a sequence of improvements over decades, and recent work has achieved near-linear time algorithms for certain settings. Shortest path algorithms have been extended to handle dynamic graphs, where edges are inserted and deleted over time.
The rise of massive real-world networks has pushed the field in new directions. Graphs with billions of vertices and edges are now common in social media, web search, and biological data, and algorithms must be designed to run in external memory, in parallel, or in streaming fashion. This has led to a renewed interest in simple, scalable algorithms that may lack optimal worst-case guarantees but perform well empirically. At the same time, the theory of NP-hardness continues to guide expectations, and the search for better approximation algorithms and parameterized algorithms remains active.
Machine learning on graphs has also emerged as a neighboring field, using graph structure as input to neural networks. While this work is not traditionally part of graph algorithms, it has created new demand for efficient graph computations—particularly for operations like message passing, neighborhood aggregation, and graph embedding—and has led to cross-fertilization between the communities.
The field's enduring questions remain what they have always been: What can be computed about graphs, and how fast? The answers are increasingly nuanced, depending on the model of computation, the class of graphs, and the notion of efficiency. What makes the field coherent is not a single method or school but a shared commitment to precise, rigorous reasoning about a structure that appears everywhere in human and natural systems.