Applying the recurrence in source item order gives the complete table
At inclusion wins, since . Thus and the residual capacity is two. Items three and two are too heavy for it, and item one exactly fits. Consequently
Its weight is . The recurrence proves that no binary selection with capacity seven has greater profit.
Let item have weight and profit . Define as the largest profit obtainable from the first items with capacity at most the nonnegative integer . Set . The last item is either absent or present once, giving the dynamic programming recursion
The two alternatives exhaust the feasible binary decisions. In the second alternative, deleting item leaves exactly the smaller subproblem with capacity , which proves the recurrence.
Fill rows , and within each row capacities . Store which alternative attains each maximum. Backtrack from : when exclusion was chosen, set and move to ; when inclusion was chosen, set and move to . Ties may be resolved either way. Thus the stored values yield an actual optimal selection, not just its objective value.
For items and capacity , the algorithm uses arithmetic operations and space with the full backtracking table. It is a pseudo-polynomial algorithm, since is a numerical capacity rather than its bit length. A value-only version can use one row, but must update capacities in decreasing order to avoid reusing the same item.
For , write , and let count the connected components of , including isolated vertices. A maximal forest in each component has one fewer edge than vertices, so . The required forest polytope is
We prove both inclusions, using the matroid independence polytope argument explicitly.
If is a forest, is an independent subset of , so . Its indicator is nonnegative. All convex combinations of these indicators therefore lie in .
For the converse, take any real objective vector . List just its positive-weight edges as with , put , and set . Run the forest greedy algorithm on these edges and call the output . At every prefix, the accepted edges form a maximal forest of , so
Indeed a previously rejected edge still has its endpoints joined later; therefore no rejected prefix edge can augment the chosen forest. A maximal forest spans every prefix component and has the stated size.
For every , dropping nonpositive objective terms and telescoping now gives
The last equality uses the same telescoping identity for the greedy indicator. If there are no positive coefficients, the empty forest attains the bound zero. Thus every linear objective over is maximized by a forest indicator.
The singleton inequalities give , so is compact. The convex hull of the finitely many forest indicators is also compact. If some were outside , the finite-dimensional separating hyperplane theorem would give with , contradicting the bound just proved. Therefore , completing the convex-hull proof.
An equivalent system indexed by vertex sets is
where contains all edges with both ends in . The rank system implies this since . Conversely, split any edge set into its vertex components . Nonnegativity and the vertex inequalities give . Hence this second system describes the same polytope.
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.

Pinned article: Introduction to the OurBigBook Project

Welcome to the OurBigBook Project! Our goal is to create the perfect publishing platform for STEM subjects, and get university-level students to write the best free STEM tutorials ever.
Everyone is welcome to create an account and play with the site: ourbigbook.com/go/register. We belive that students themselves can write amazing tutorials, but teachers are welcome too. You can write about anything you want, it doesn't have to be STEM or even educational. Silly test content is very welcome and you won't be penalized in any way. Just keep it legal!
We have two killer features:
  1. topics: topics group articles by different users with the same title, e.g. here is the topic for the "Fundamental Theorem of Calculus" ourbigbook.com/go/topic/fundamental-theorem-of-calculus
    Articles of different users are sorted by upvote within each article page. This feature is a bit like:
    • a Wikipedia where each user can have their own version of each article
    • a Q&A website like Stack Overflow, where multiple people can give their views on a given topic, and the best ones are sorted by upvote. Except you don't need to wait for someone to ask first, and any topic goes, no matter how narrow or broad
    This feature makes it possible for readers to find better explanations of any topic created by other writers. And it allows writers to create an explanation in a place that readers might actually find it.
    Figure 1.
    Screenshot of the "Derivative" topic page
    . View it live at: ourbigbook.com/go/topic/derivative
  2. local editing: you can store all your personal knowledge base content locally in a plaintext markup format that can be edited locally and published either:
    This way you can be sure that even if OurBigBook.com were to go down one day (which we have no plans to do as it is quite cheap to host!), your content will still be perfectly readable as a static site.
    Figure 5. . You can also edit articles on the Web editor without installing anything locally.
    Video 3.
    Edit locally and publish demo
    . Source. This shows editing OurBigBook Markup and publishing it using the Visual Studio Code extension.
  3. https://raw.githubusercontent.com/ourbigbook/ourbigbook-media/master/feature/x/hilbert-space-arrow.png
  4. Infinitely deep tables of contents:
    Figure 6.
    Dynamic article tree with infinitely deep table of contents
    .
    Descendant pages can also show up as toplevel e.g.: ourbigbook.com/cirosantilli/chordate-subclade
All our software is open source and hosted at: github.com/ourbigbook/ourbigbook
Further documentation can be found at: docs.ourbigbook.com
Feel free to reach our to us for any help or suggestions: docs.ourbigbook.com/#contact