For a directed graph, store in for the edge . The reverse edge is separate and is stored only if it exists. Consequently, list length is outdegree, not indegree, and each directed edge contributes one entry in total. An incoming-list index is additional storage.[ref]
Orient the seven edges of our example from earlier to later labels. The resulting directed graph has
There are now seven entries, with outdegrees . In particular, needs an empty list even though it is reached from : incoming edges do not make 's outgoing list nonempty. Replacing each directed edge by an undirected graph connection would lose this distinction.
Our running simple graph excludes self-loops and repeated edges. If those restrictions are relaxed, specify how the adjacency list encodes them. Here an undirected self-loop at contributes two copies of to , matching its contribution of two to the degree of a vertex. A directed self-loop contributes one copy, and one each to outdegree and indegree. Distinct parallel edges retain distinct entries; a multigraph's list length can therefore exceed its number of distinct neighbours.[ref][ref]
For example, add one undirected self-loop at to the seven-edge example. Its list becomes , the vertex degree of becomes four, and the total entry count becomes sixteen for eight edges. If an application instead stores a self-loop once, it must account for its doubled undirected vertex degree separately. In a weighted graph, an entry can be an ordered pair meaning destination and weight ; the weight belongs to the edge, not to the destination vertex.
Closed walk Created 2026-10-06 Updated 2026-10-14
A closed walk is a walk with equal endpoint vertices, . Under our convention this includes the zero-length walk ; returning after traversing at least one edge requires . Closure imposes no other restriction on repeated vertices or edges. In a directed graph, a closed directed walk must also follow every directed edge in its permitted direction.[ref]
Figure 1.
Returning to : backtracking closed walk, closed trail with a repeated internal vertex, and graph cycle
. Details.
In the shared simple graph, is a length-two closed walk that immediately backtracks along . It is not a trail, since is used twice, and it is not a graph cycle. The length-six closed walk is a trail, since its six edges are distinct, but is not a graph cycle: it returns to midway through the journey. The length-three closed walk is a graph cycle, with all vertices distinct apart from the required endpoint repetition. In a simple graph that is an undirected graph, a graph cycle has length at least three; the two-step backtrack is excluded.[ref]
A positive-length closed walk therefore need not reveal a graph cycle: even a tree permits an out-and-back journey on an edge. A positive-length closed trail in a simple graph does contain a graph cycle. For a proof outline, choose a shortest positive-length consecutive portion of the trail whose endpoint vertices coincide. It cannot repeat an internal vertex, since that would give a shorter such portion; it cannot have length one or two because self-loops and repeated edges are excluded. It is consequently a graph cycle. Cutting it out leaves another closed trail, possibly of length zero, so repetition partitions the original edges into graph cycles. In our six-step example these are the two triangles in a graph. A closed trail using every edge would be an Euler circuit; here is omitted.
Counting return journeys makes closed walks useful even when they repeat edges. For a finite simple graph with adjacency matrix , the walk count from powers of an adjacency matrix gives length- walks from to , for every nonnegative integer . A proof outline is that matrix multiplication appends one allowed step, summing over the previous endpoint; is the identity matrix, recording the unique zero-length walk at each vertex. Consequently
The trace counts closed walks with a specified starting vertex and traversal order, not distinct graph cycles. These formulas use adjacency entries, not arbitrary travel costs in a weighted graph.[ref]
In our example, : the five length-two closed walks are , , , , and . Also , going round either triangle in a graph in either direction, and : each of the two triangles in a graph supplies three choices of starting vertex and two directions. These exact counts for the constructed graph illustrate why return counts and graph cycle counts differ.
A closed walk naturally models a delivery or inspection journey that returns to its depot. Repeated vertices let it combine several excursions; repeated edges let it serve a dead end and return. For an Euclidean travelling salesman tour, one can first construct a closed walk visiting all locations and then use the triangle inequality to shortcut repeated visits without increasing total length. That argument assumes direct travel between the retained locations is permitted, as in a complete graph weighted by Euclidean distance; an arbitrary road network need not contain those shortcut edges.
Critical path method Created 2026-10-14 Updated 2026-11-05
The critical path method calculates an earliest schedule, a latest schedule for a chosen finish time, and each activity's task float. A critical path is a start-to-finish graph path whose total duration is greatest. There can be several such graph paths, and every one constrains completion. In the six-activity project scheduling example, the critical graph path is A-C-D-F, of duration .
Add a zero-duration source before every initial activity and a zero-duration sink after every terminal activity. Give each edge weight , including zero weight on edges leaving . This produces a weighted graph in which a graph path's weight counts every activity on it exactly once. The possible source-to-sink graph paths in our example, omitting the dummy endpoints, are A-B-D-F with weight 8, A-C-D-F with weight 10, and E-F with weight 4.
Every feasible schedule must accommodate each of these sequential chains. Consequently,
This bound applies to all source-to-sink graph paths, not just the one we happen to inspect. The critical path method attains the bound by setting each activity's earliest start to the maximum of its predecessors' earliest finish times:
Evaluate this recurrence in a topological order, obtained by topological sorting. Each satisfies every incoming optimization constraint, so these times form a feasible solution. The same recurrence calculates the greatest weight of a graph path from to ; hence the feasible finish matches the lower bound. This is dynamic programming on a directed acyclic graph, rather than an enumeration of all graph paths. See Paul Johnson, Scheduling and longest paths, longest-path algorithm. The linear programming formulation and its certificate are developed in project scheduling duality and unit-flow certificate for project duration.
For our project scheduling example, , , and the two merges give
F finishes at 10. All six activities are completed, even though E is absent from the critical graph path. Recording which predecessor attains each maximum lets us trace a critical graph path backward from the sink; retaining tied choices exposes multiple critical graph paths.
Now fix the project start at zero and the finish at . The latest starts come from a backward pass in reverse topological order:
Every activity must finish by the earliest of its successors' latest starts, explaining the minimum here. This gives , , , , , and . These latest times themselves form a feasible solution finishing at 10. The backward calculation depends on the chosen finish time; a later deadline would give different latest times and task floats. The forward and backward passes are described in Olivier de Weck, MIT ESD.36 Lecture 2, slides 22–29.
ActivityEarliest start Earliest finish Latest start Latest finish Task float
A03030
B35572
C37370
D79790
E03696
F9109100
Figure 1.
Earliest solid and latest hollow activity bars for the critical path method, with task floats of 2 for B and 6 for E
. Details.
Changing a duration can change which graph paths are critical. If B's duration becomes 4, A-B-D-F and A-C-D-F both take 10: there are two critical graph paths. Shortening C alone then cannot reduce the finish time, because the chain through B still takes 10. If B's duration instead becomes 5, the earliest starts of D and F become 8 and 10, and the finish becomes 11. A-B-D-F is now the unique critical graph path; C has task float 1 relative to that new optimal finish. These calculations show why the critical path method is useful for understanding where a duration change matters, even in a project containing many parallel activities.
Dirichlet energy space with zero boundary at infinity Created 2026-09-24 Updated 2026-11-05
For a transient weighted graph, is the completion of the finitely supported functions in the norm . Its elements have finite Dirichlet energy and vanish at infinity in the energy sense.
Electrical network Created 2026-09-24 Updated 2026-11-05
An electrical network is a weighted graph whose edge weights are interpreted as electrical conductances. Random-walk hitting quantities can then be expressed through voltages, currents, and effective resistance.
Geometric spanner Created 2026-10-14 Updated 2026-10-20
A geometric spanner is a weighted graph on points in Euclidean space, with edge weights equal to their Euclidean distances, in which every pair has a graph path of length at most times its direct distance. Its stretch factor is the largest ratio , where is shortest-path distance. A square's four perimeter edges, without diagonals, give stretch factor : adjacent points have ratio one, and diagonal pairs have route length instead of . The aim is to retain short routes with fewer edges than a complete graph. [ref].
Graph theory Created 2026-09-24 Updated 2026-10-13
Graph theory studies vertices and the edges connecting them: which graph paths exist, how efficiently we can travel, and which connections are indispensable. A road map becomes a graph when junctions are vertices and road segments are edges; a communications network uses routers and links instead. The drawing helps us see connections, but its apparent lengths need not be the costs being optimized. Record travel times or transmission costs separately in a weighted graph.
The appeal of graph theory is that one model serves many practical questions. Graph paths describe routes, connected components of a graph identify isolated regions, and minimum spanning trees connect all locations cheaply. The shortest path problem asks a different question: find the cheapest journey between specified locations. Our four-vertex example below makes that distinction concrete and shows how the Dijkstra algorithm discovers a route without trying every graph path.
Green function of a transient weighted graph Created 2026-09-24 Updated 2026-11-05
For the walk on a weighted graph, the Green function normalized by vertex weight is
Symmetry of the conductances makes , and for finitely supported .
Last-exit decomposition for a transient random walk Created 2026-09-24 Updated 2026-11-05
For a transient random walk on a weighted graph, let be a finite set of graph vertices, and . Its last-exit decomposition for a transient random walk is
where is the Green function of a transient weighted graph and is the equilibrium measure of a finite set.
On the event of a visit to , transient graph and finiteness of ensure a unique last visit. Partition by its time and location and apply the Markov property at that deterministic time. Every summand is nonnegative, so Tonelli's theorem justifies the infinite sum. The identity expresses a hitting probability as occupation weighted by an escape probability; it does not require a last-visit time to be a stopping time. For a singleton it reduces to the singleton equilibrium potential from the Green function.
Minimum spanning tree Created 2026-10-07 Updated 2026-11-05
A minimum spanning tree of a finite connected undirected weighted graph minimizes the sum of edge weights over all spanning trees. Kruskal's algorithm repeatedly accepts a least-weight edge joining different current connected components. The cut-exchange argument preserves an optimum containing every accepted edge, including when weights tie.
For nonnegative edge costs, an MST gives a lower bound on a travelling salesman tour: removing one tour edge leaves a spanning path whose cost is no greater than the tour cost, and the minimum spanning tree costs no more than that path.
Nonnegativity is needed for this comparison. A triangle with all three edge weights equal to minus one has tour cost and minimum spanning tree cost , so the latter is not a lower bound. The MST optimization problem itself permits negative edge weights.
Network science 2026-11-05
Network science studies systems represented by graphs, combining structural measurements, data analysis and models of network formation or dynamics. Vertices represent entities and edges represent a specified relation; directed graphs, weighted graphs and temporal data encode different kinds of interaction.
A transportation network might assign stations to vertices and direct services to edges. Vertex degree counts immediate connections, while shortest-path graph distances measure routes through several stations. These answer different questions: a high-degree station need not minimize all journey times, especially when edge weights represent duration.
Useful models must connect the graph definition to the measured system. A biological network built from physical binding experiments differs from one built from statistical correlation. Comparing an observed statistic with a suitable random graph model helps distinguish a structural pattern from what the vertex and edge counts already imply.
The inequality need not be strict. Start with the nearest-neighbour weighted graph , attach a new leaf only to the origin , and give its edge positive weight. Take and . A walk starting from must move to at its first non-killed step, while any walk reaching from elsewhere must first pass through . Hence the equilibrium potential of a finite set is the same for the two sets:
Using for a finite set gives
despite .
Random walk on a graph Created 2026-09-24 Updated 2026-11-05
A random walk on a graph is a Markov chain whose allowed moves follow the graph edges. For the simple random walk on an unweighted graph, a graph vertex of positive finite vertex degree chooses each neighbor with transition probability . A weighted graph instead uses normalized edge weights, and directed graph edges permit asymmetric transitions. At an isolated graph vertex, a holding or termination convention is needed.
On a three-vertex path , the transition matrix in that order is
Its stationary distribution is because the central graph vertex has twice the vertex degree of either endpoint. Starting at , the probability distribution nevertheless alternates between the two parts of the bipartite graph, so stationarity does not by itself imply convergence. Hitting times, recurrence, and mixing times ask different questions about the same Markov chain.
Reverse-delete algorithm Created 2026-10-14 Updated 2026-11-05
The reverse-delete algorithm processes edges of a finite connected undirected weighted graph in nonincreasing weight order, deleting an edge whenever the graph stays connected.
Maintain the invariant that the surviving graph contains some minimum spanning tree. A deletable edge lies on a cycle. Previously retained heavier edges are bridges and remain bridges after further deletions, so every other edge on that cycle has weight at most . If a current optimum contains , removing it creates a cut. Another cycle edge crosses that cut; replacing by gives a surviving tree of no greater weight. Thus an optimum remains after deleting .
At termination the graph is connected and acyclic, hence is itself a minimum spanning tree. With tied weights, need not be excluded from every optimum. On a triangle with all weights one, every edge belongs to some optimum, yet deleting any one edge is safe. The minimum spanning tree cycle property excludes an edge from every optimum only when it is uniquely heaviest on a cycle.
Shortest path problem 2026-10-14
The shortest path problem asks for a graph path from a source vertex to a destination vertex minimizing its total edge weight. Here is the cost of traversing edge , and costs add along the graph path. If no route exists, its shortest-path distance is . With nonnegative edge weights, deleting cycles in a graph from a walk never increases its cost, so repetitions cannot improve the optimum.
Consider the undirected graph with vertex set and the six edge weights
Each edge can be traversed in either direction at the same cost. The direct graph path costs ; costs ; costs . The cheapest graph path is , costing . The remaining graph path costs , exhausting the possibilities without repeated vertices.
Figure 1.
The shortest path problem: three highlighted edges cost less than the direct connection
. Details.
Thus fewest edges and least total cost are different objectives. Breadth-first search minimizes the number of edges, which suffices when every edge has the same positive cost. Unequal nonnegative costs call for the Dijkstra algorithm. On a map, weights might be minutes rather than kilometres: a longer-looking route can arrive sooner. This is why a weighted graph separates the network's connections from what a particular journey costs.
Shortest-path tree Created 2026-10-25 Updated 2026-10-31
A shortest-path tree rooted at a source vertex is a spanning tree whose unique tree route from the source to every vertex solves the shortest path problem in the original weighted graph. Dijkstra's algorithm constructs one for a finite connected graph with nonnegative edge lengths, recording a predecessor whenever a distance improves. It need not be a minimum spanning tree: one minimizes each source-route length, the other the total weight of the tree's edges.
Figure 1.
Signed shortest paths can conflict; positive predecessor choices form a tree
. Original diagrams and generic model calculations generated by the adjacent Python script. Details.
Simple graph 2026-10-14
An undirected simple graph is exactly a pair of sets
Thus every edge is a two-element set of distinct vertices. The unordered pair equals , so there is no direction. The distinctness condition excludes self-loops, and using a set of edges excludes parallel copies. A simple graph may have vertices with no incident edges; does not by itself determine . For example, and have the same edge set but different vertex sets.[ref]
In the six-vertex example, the vertex neighbourhood of is , so its degree of a vertex is . In label order , the degree sequence is
This is the handshaking lemma: count each edge once at each of its two endpoints. The average degree of a graph here is . The degree sequence is a compact consistency check on an edge list; an odd sum could not describe any finite undirected graph. It also forces the number of odd degrees of vertices to be even, since the even terms do not affect the parity of the sum.
The adjacency matrix in the figure uses label order . Its entry is one exactly when , and zero otherwise. It is a symmetric matrix with zero diagonal, and each row sum gives the corresponding vertex degree. For example, row is . The fourteen ones count both directions of the seven undirected edges; they do not indicate fourteen different edges. This translates a picture into a representation suitable for calculation.
The restrictions matter. A directed graph uses an ordered pair to distinguish from , so reachability can depend on direction. A multigraph can contain several distinct edges between the same vertices; adding another would raise and to four without adding a new neighbour. A self-loop at contributes two to its undirected vertex degree, making it four, because both endpoints lie at . Specify whether self-loops are allowed in a multigraph. Finally, a weighted graph attaches numerical information to edges: if links carry travel times, minimizing the number of edges need not minimize total time. These are changes to the model, rather than changes to how the same simple graph is drawn.
Superincreasing sequence 2026-10-25
A positive sequence is superincreasing if each term exceeds the sum of all earlier terms. If , a geometric series proves . Distinct finite subsets of its indices have distinct sums: cancel their common terms and compare the largest remaining term with the sum of all smaller terms. This gives uniqueness of minimum spanning trees and of simple graph paths with fixed endpoints when a finite weighted graph has such separated edge weights.