The associated matroid is
Thus the graph's edges are the ground set, and the members of are its matroid independent sets.
For the specified rank, if is a forest, itself is an allowed choice in the rank maximum, so . Conversely, if , some forest has . Finiteness forces , so is a forest. Hence the independent sets are exactly all forests in , including the empty forest and forests with isolated vertices.
The matroid independence axioms can also be checked directly. The empty set is a forest, and deleting edges cannot create a cycle. For exchange, let forests have . If every edge of joined vertices within one component of , its restriction to each component would have at most edges. Summing would give , a contradiction. Thus some edge of joins two components of and can be added without creating a cycle. This proves augmentation and identifies as the graphic matroid.
On a finite ground set , a submodular rank function is a set function with the following properties:
These are normalization, monotonicity, submodularity, and unit integer increments. In particular its values are nonnegative integers with . Equivalently, one can require an integer-valued normalized monotone submodular function with : diminishing returns then bounds every marginal increment by one. A general real-valued submodular function need not be a matroid rank.
Use the maximum-weight version of Kruskal's algorithm: sort the edges by decreasing weight, start with no edges, and add an edge exactly when it joins different current connected components of a graph. For the maximum over all forests, skip negative-weight edges; removing a negative edge always preserves a forest and increases its weight. Zero-weight edges are optional. The matroid greedy algorithm for the graphic matroid proves this procedure optimal; it maximizes over independent sets rather than requiring a full basis.
The positive edges are considered in the order
Admit and . Reject , since it closes the triangle on . Admit . Reject , since and are already joined by the path . Skip both negative edges incident with vertex four. Therefore
Vertex four is isolated. Requiring a spanning tree would force a negative edge and solve a different optimization problem. With a disjoint-set data structure, sorting dominates the running time, giving .
Use vertices . Reading each symmetric off-diagonal pair once gives the edge set
Here abbreviates the undirected edge . The diagram displays these seven edges and no loops. The displayed square matrix is an adjacency matrix in the usual terminology: its two indices both label vertices. A vertex-edge incidence matrix would instead have one index for vertices and one for edges. This explains how the source's node-node terminology is being read.
Figure 1.
The graph and its maximum-weight forest, including the isolated fourth vertex
. Original drawing. The left panel shows all seven edges. The right panel shows only the three edges selected for the maximum-weight forest, with their weights; vertex four remains isolated. Details.
With the new right sides, the dual function is
Take . Then , so the minimization dual is unbounded below:
By weak duality, any feasible integer point with finite objective would have to have objective at most every dual value, which is impossible. Thus the modified integer program is infeasible and has no optimal solution. This is an infeasibility certificate from an unbounded Lagrangian dual.
There is also a direct certificate: the assignment equalities force , while the new bounds force it to be at most . Even the modified linear relaxation is infeasible. The earlier problem also had no integer solution, but there its fractional feasible point kept the dual value finite.
The assignment equalities parameterize every feasible matrix of the linear programming relaxation as
The side totals and objective become
The first side constraint gives and the second gives , so the relaxation has the unique feasible point
Direct elimination of the assignment equalities has solved this one-dimensional linear program. Its value matches the Lagrangian dual problem value because the retained assignment polytope is the convex hull of the two integer assignments; it does not make the side-constrained integer problem feasible.
The retained integer assignment constraints have only two feasible matrices,
Their totals are and respectively. For nonnegative Lagrange multipliers , add to the maximization objective. Each feasible point gains a nonnegative amount, so maximizing over the retained assignment set gives an upper bound:
The Lagrangian dual problem minimizes this convex piecewise-linear function over . Put ; every real can occur. The two affine terms average to nine, so their maximum is at least nine, with equality exactly when . Thus
Neither integer assignment satisfies both side constraints: violates the bound and the bound. The finite dual bound is therefore not evidence that the integer primal is feasible. The following part shows why this Lagrangian relaxation of an assignment with side constraints has a finite value anyway.
The constraints give the valid upper bound
For example satisfies every constraint: the first left side is four, the next three are three, five and two, and . Its objective is eight. Hence the upper bound is attained by an integer point, proving
All optimal solutions can also be identified. Equality forces , and . The remaining constraints reduce to and . Thus exactly four integer optima occur:
This is an optimality certificate by a valid relaxation bound and a feasible integer solution; no assumption of total unimodularity is needed. The source's denotes nonnegative integers, as is also necessary for its assignment equations in the next question.
A totally unimodular matrix has the property that every square submatrix has determinant zero, one or minus one. This includes the one-by-one submatrices, so every entry belongs to .
Its importance is integrality of linear-programming vertices: if is totally unimodular and is integral, every vertex of is integral. Adding rows of the identity preserves total unimodularity. A nonsingular active basis therefore has determinant and an integer inverse by the cofactor formula, making its basic solution integral. Thus a finite optimum attained at a vertex of the linear programming relaxation gives an integer optimum without branching.
One sufficient condition is: entries belong to , each column has at most two nonzero entries, and any column with two has one and one . This is the signed column condition for total unimodularity, satisfied by directed vertex-edge incidence matrices. It is sufficient, not necessary.
Write for the undirected edge . At the root of the branch and bound search, the minimum spanning tree on is of cost . The cheapest edges incident to vertex one are , of cost . The root lower bound is therefore twenty, attained by
It is not a tour: vertex four has degree three and vertex three degree one.
A tour must omit at least one edge from , since its degree at vertex four is two. Partition tours according to the first omitted edge in that ordered list. This gives three disjoint, exhaustive children, retaining included and excluded edges when recomputing the one-tree relaxation:
All tours belong to one of the three children, and no remaining child can improve the incumbent. Therefore
The branching rule is motivated by a violated tour degree equation, rather than by an arbitrary costly edge. This is degree branching with a one-tree bound.
Delete vertex one and its two incident edges from a Hamiltonian cycle. The remaining edges form a Hamiltonian path through all other vertices, hence a spanning tree. Thus every tour is a one-tree, and both problems use the same edge-cost objective. The relaxation enlarges the feasible set, giving
Conversely, a one-tree in which every vertex has degree two is connected and two-regular, so it is a Hamiltonian cycle. Such a minimum one-tree therefore also solves the travelling-salesman problem. This is the one-tree travelling-salesman bound.
The two pieces of a one-tree can be optimized independently. Compute a minimum spanning tree on vertices and choose the two cheapest distinct edges incident to vertex one. Return their union.
Every feasible one-tree contains such a spanning tree and such a pair, so its cost is at least the sum of these two independent minima. Their union is itself feasible, attaining that lower bound. This proves optimality.
Use Prim's algorithm for : repeatedly add a cheapest edge crossing from the current tree to an unvisited vertex. The minimum spanning tree cut property makes each chosen edge safe. With the dense weight matrix of a complete graph, maintain the best connection to each unvisited vertex and select the least one by a scan. There are iterations with work apiece. A further scan finds the two cheapest incident edges. Thus the total complexity is , with additional working storage beyond the input matrix.
Choose a small density threshold , then sufficiently small and a lower partition bound sufficiently large that
Apply the regularity lemma. Delete all edges incident with , all edges within a class , all edges between irregular pairs, and all edges between regular pairs of density below . Their total is at most
If a triangle remains, its vertices lie in three distinct nonexceptional classes, all whose pairs were regular with original density at least . Part (c) then forces at least triangles in the original graph, where is the common class size. Since and , we have , so this is at least .
Choose and take large enough for the regularity lemma. An original graph with at most triangles cannot leave any triangle after these deletions. Thus deleting at most edges makes the graph triangle-free. This is the triangle removal lemma; boundedly many large regular clusters turn any surviving triangle into a positive-density family of original triangles.
Apply part (b) to and . Fewer than vertices fail at least one of the degree bounds. For any remaining vertex , put and . Then
Regularity of gives . Every edge between and makes a distinct triangle containing . Hence belongs to at least
such triangles. This proves the asserted bound on exceptional vertices.
There are at least good vertices. Summing their triangle counts counts each triangle with one vertex in each cluster exactly once, at its vertex. Therefore
There is no factor of three to divide out in this cross-cluster count.
This is the regular triangle counting lemma with explicit coarse constants.
Let be the vertices with fewer than neighbours in . If , regularity applies to the pair and gives
But averaging the defining strict degree inequality over gives , a contradiction. Therefore
Regularity controls the neighbourhood of almost every vertex because a large set of exceptional low-degree vertices would itself witness an irregular density.
For disjoint nonempty sets , let count edges between them. Their edge density is
The pair is -regular if every and with , satisfies .
An -regular partition has disjoint classes covering , with , equal positive sizes , and at most unordered pairs with that are not -regular. The set is exceptional and its pairs need not satisfy regularity.
Szemerédi regularity lemma states that for every and integer , there are integers such that every graph with vertices has such a partition with
The bounds depend on , not on the graph order. Using a strict regularity inequality or a slightly different constant in the allowed pair count gives an equivalent conventional version; the displayed convention will be used below.
Fix a proper colouring with exactly nonempty colour classes. For any class , suppose every vertex in it misses at least one of the other colours in its neighbourhood. Recolour each of these vertices by one of its missing colours. No edge joins two vertices of , so these simultaneous recolourings cannot conflict with one another, and the chosen colours do not conflict with vertices outside .
This would eliminate colour and produce a -colouring, contradicting optimality. Therefore each colour class contains a vertex adjacent to at least one vertex of every other colour. That vertex has degree at least . Choosing one from each class gives distinct vertices, proving
For , a nonempty graph already has a vertex of degree at least zero, so the conclusion holds as well.

There are unlisted articles, also show them or only show them.