Tutorials › Graph Theory (Undergraduate) › Molecular Graphs And Valence Constraints

Applications of Graph Theory · Tutorial 795 of 799

Molecular Graphs And Valence Constraints

Learn to encode bonds and implicit hydrogens in a molecular graph, verify valence locally and globally, and interpret cycle structure in small carbon frameworks.

Intermediate 10 min read

What You'll Learn

  • Represent atoms as vertices and bonds as edges labeled by bond order
  • Distinguish ordinary degree from the sum of bond orders at an atom
  • Check whether implicit hydrogen counts satisfy local valence constraints
  • Use a valence-sum identity as a necessary consistency check
  • Relate cycles and edge counts to hydrogen totals in simple carbon frameworks

From Atoms and Bonds to a Labeled Graph

A molecular graph turns a chemical structure into discrete data that can be checked systematically. Atoms become vertices, bonds become edges, and labels record information such as bond order. The graph does not encode everything about a molecule: in particular, it does not describe three-dimensional shape. Here the aim is narrower: represent small molecular frameworks and test whether their bond assignments are compatible with a stated valence model.

Throughout, use a simplified model for neutral, closed-shell examples. The target valences are \(1\) for hydrogen, \(4\) for carbon, \(3\) for nitrogen, and \(2\) for oxygen. These are modeling assumptions for the examples, not a complete account of chemical bonding. Charged atoms, radicals, aromatic bonding, and other bonding conventions require additional information and are outside this model.

Definition: A molecular graph here consists of a finite simple graph \(G=(V,E)\), an atom type assigned to each vertex, and a positive integer bond order \(b(e)\) assigned to each edge. A single, double, or triple bond has bond order \(1\), \(2\), or \(3\), respectively. Hydrogen atoms may be recorded explicitly as vertices, but in the examples below they are implicit: \(h(v)\) is the nonnegative integer number of hydrogens attached to atom \(v\).

The graph is simple: an atom pair has at most one edge, and a double bond is represented by one edge labeled \(2\), not by two parallel edges. The ordinary degree \(\deg(v)\) counts incident edges, while the bond-order sum at \(v\) is the sum of their labels. These are different when a multiple bond is incident to \(v\).

Definition: A valence assignment is locally feasible if, at every atom \(v\), the sum of the bond orders on edges incident to \(v\), plus \(h(v)\), equals the target valence \(r(v)\) specified by the model: $$ \sum_{\substack{e\in E\\ e\text{ incident to }v}} b(e)+h(v)=r(v). $$

In particular, once the bonds are fixed, the model determines the required implicit hydrogen count at each atom: \(h(v)=r(v)-\sum_{e\ni v}b(e)\). A negative value makes the assignment infeasible; a nonnegative value must still be an integer. Thus checking only the total number of bonds is not enough: every atom must pass its own check.

Worked Valence Checks

Worked Example: Ethane

Consider two carbon vertices \(V=\{C_1,C_2\}\), with edge set \(E=\{C_1C_2\}\) and bond order \(b(C_1C_2)=1\). Each carbon has target valence \(4\). At each vertex the bond-order sum is \(1\), so \(h(C_1)=4-1=3\) and \(h(C_2)=4-1=3\). Both counts are nonnegative integers, so this assignment is feasible.

The total bond order is \(B=1\), and the total number of implicit hydrogens is \(H=3+3=6\). The sum of target valences is \(4+4=8\), while \(2B+H=2(1)+6=8\). This agrees with the valence-sum identity proved below.

Check: each carbon has one single bond and three hydrogens, giving \(1+3=4\) at each vertex. The graph has two vertices joined by one edge, so it has no cycle.

Worked Example: A Six-Carbon Ring

Let \(V=\{C_1,C_2,C_3,C_4,C_5,C_6\}\) and \(E=\{C_1C_2,C_2C_3,C_3C_4,C_4C_5,C_5C_6,C_6C_1\}\). Give every edge bond order \(1\). This underlying graph is the cycle \(C_6\).

Every carbon has two incident single bonds, so its bond-order sum is \(1+1=2\), and its implicit hydrogen count is \(4-2=2\). Thus \(H=6(2)=12\). The total bond order is \(B=6(1)=6\), and the sum of the six carbon target valences is \(6(4)=24\). The global check gives \(2B+H=2(6)+12=24\).

Check: at each of the six vertices, the two ring bonds and two hydrogens contribute \(1+1+1+1=4\). Every edge is part of the displayed six-cycle; the cycle is a feature of the framework, independent of whether its valence checks pass.

Worked Example: One Double Bond in a Six-Carbon Ring

Use the same vertex set and cycle edges as in the previous example. Set \(b(C_1C_2)=2\), and give each of the other five edges bond order \(1\). At \(C_1\) and \(C_2\), the bond-order sum is \(2+1=3\), so each requires \(4-3=1\) hydrogen. At \(C_3,C_4,C_5,C_6\), the bond-order sum is \(1+1=2\), so each requires \(4-2=2\) hydrogens. Consequently \(H=1+1+2+2+2+2=10\).

The total bond order is \(B=2+1+1+1+1+1=7\). The total target valence is \(6(4)=24\), and \(2B+H=2(7)+10=14+10=24\). The same six-cycle framework can therefore have different bond labels and different implicit hydrogen counts while satisfying this model.

Check: the two double-bond endpoints each have bond-order sum \(3\) and one hydrogen, giving \(3+1=4\). Each other carbon has bond-order sum \(2\) and two hydrogens, giving \(2+2=4\). The underlying edge set, and hence its cycle, has not changed.

A Global Valence-Sum Check

Theorem: Suppose a finite molecular graph has a locally feasible valence assignment. Let \(B=\sum_{e\in E}b(e)\) be the total bond order, let \(H=\sum_{v\in V}h(v)\) be the total number of implicit hydrogens, and let \(r(v)\) be the target valence at \(v\). Then $$ \sum_{v\in V}r(v)=2B+H. $$

Proof. Sum the local valence equation over all vertices. The hydrogen terms sum to \(H\). Each edge \(e=uv\) contributes its bond order \(b(e)\) once to the sum at \(u\) and once to the sum at \(v\), so its total contribution is \(2b(e)\). Summing over all edges gives \(2\sum_{e\in E}b(e)=2B\). Therefore the sum of the target valences is \(2B+H\), as claimed. If \(V\) and \(E\) are empty, both sides are zero, so the identity still holds. \(\square\)

This identity is a useful consistency check, but it is only a necessary global check: it does not guarantee that each atom has an acceptable hydrogen count. For example, for an all-carbon graph with only single bonds, \(B=|E|\) and every target valence is \(4\), so any feasible assignment must satisfy \(4|V|=2|E|+H\). The local condition remains \(h(v)=4-\deg(v)\ge 0\) at every vertex.

Worked Example: Why a Correct Total Can Hide a Local Failure

Take \(V=\{C_0,C_1,C_2,C_3,C_4\}\) and \(E=\{C_0C_1,C_0C_2,C_0C_3,C_0C_4\}\). Set \(b(C_0C_1)=2\), and set the other three bond orders to \(1\). All vertices are carbon, with target valence \(4\).

At \(C_0\), the bond-order sum is \(2+1+1+1=5\), so its formal deficit is \(4-5=-1\). At \(C_1\), which is incident to the double bond, the bond-order sum is \(2\), so its deficit is \(4-2=2\). Each of \(C_2,C_3,C_4\) has bond-order sum \(1\), so each has deficit \(4-1=3\). The sum of these formal deficits is \(-1+2+3+3+3=10\).

The total bond order is \(B=2+1+1+1=5\), so the aggregate check gives \(2B+10=2(5)+10=20\). The total target valence is \(5(4)=20\), so the totals agree exactly. Nevertheless, \(C_0\) has a negative deficit, and no nonnegative hydrogen count can make its local valence equation hold. The assignment is therefore infeasible.

Check: the negative value occurs at \(C_0\), which has four incident edges but a bond-order sum of five. The graph is connected and has four edges on five vertices, with no cycle; its failure is a local valence failure, not a cycle failure or a mismatch in the global sum.

Cycle Structure and Carbon Frameworks

A cycle in the underlying simple graph is a closed sequence of at least three edges whose vertices are distinct except that the final vertex returns to the first. In a molecular graph, this describes a closed route through the atom framework. Bond labels do not change whether that route is a cycle. A cycle is useful structural information, but it does not by itself determine bond orders, implicit hydrogens, or local feasibility.

Theorem: Let \(G\) be a tree on \(n\ge 1\) vertices, interpreted as an all-carbon framework with every edge a single bond. If \(\deg(v)\le 4\) for every vertex, then the locally feasible implicit hydrogen counts are \(h(v)=4-\deg(v)\), and their total is \(H=2n+2\).

Proof. We first show that a tree on \(n\) vertices has \(n-1\) edges. For \(n=1\), it has no edges, so the claim holds. Suppose \(n\ge2\). Choose a path of maximum length in the tree; such a path exists because the graph is finite. Each endpoint has degree \(1\): if an endpoint had a neighbor outside the path, the path could be extended, and if it had another neighbor on the path, that edge together with part of the path would form a cycle. Remove one endpoint and its single incident edge. The remaining graph is acyclic, and it is connected because a path between any two remaining vertices cannot need a degree-one vertex as an interior vertex. It is therefore a tree on \(n-1\) vertices. Induction gives \(n-2\) edges in the remaining tree, so the original tree has \((n-2)+1=n-1\) edges.

In an all-single-bond framework, the bond-order sum at \(v\) is \(\deg(v)\). The hypothesis \(\deg(v)\le4\) makes \(h(v)=4-\deg(v)\) a nonnegative integer, and this choice satisfies the local equation at every vertex. Summing these equations, or using the valence-sum identity, gives \(4n=2|E|+H\). Since \(|E|=n-1\), it follows that \(H=4n-2(n-1)=2n+2\). \(\square\)

This result highlights how edge count and cycle structure affect the hydrogen total in this restricted model. For example, an all-single-bond carbon path on four vertices has three edges and, when feasible, \(H=4(4)-2(3)=10\). A four-vertex cycle has four edges and \(H=4(4)-2(4)=8\). In both cases the formula follows from the valence-sum identity; local degrees must still be checked. In the path, the endpoint degrees are \(1\) and the internal degrees are \(2\), so every degree is at most \(4\). In the cycle, every degree is \(2\), so its local hydrogen counts are also feasible.

Common Pitfalls and Practical Use

Do not substitute ordinary degree for bond-order sum. A double bond is one edge and contributes \(1\) to ordinary degree, but contributes \(2\) to the local valence sum at each endpoint. In the five-carbon example above, \(C_1\) has degree \(1\) but bond-order sum \(2\). Treating its deficit as \(4-1=3\) would be a wrong calculation; the correct deficit is \(4-2=2\).

Do not mistake a global identity for a local certificate. The equation \(\sum_v r(v)=2B+H\) follows whenever all local equations hold, but agreement of the totals does not force each local equation to hold. The example with \(C_0\) has matching totals and still fails because one formal deficit is negative.

These checks are useful when translating a proposed small framework into graph data: state the vertices and edges, record bond orders, calculate each local deficit, then perform the global sum as an independent consistency check. Finally, inspect cycles in the underlying graph separately. A cycle records a closed route through the framework; valence feasibility is determined by the bond-order sums and the allowed implicit hydrogen counts.

Check Your Understanding

Use the stated neutral-valence model. In each question, distinguish the ordinary graph from its bond-order labels and check local conditions before relying on totals.

  1. For two carbon vertices joined by a double bond, find the implicit hydrogen count at each vertex and verify the global valence-sum identity.
  2. Give a vertex set and edge set for a three-carbon path with single bonds. Find each carbon's implicit hydrogen count and the total \(H\).
  3. Explain why a negative formal hydrogen deficit at one atom makes a proposed assignment infeasible even if the valence-sum identity holds.
  4. For a four-carbon cycle with all single bonds, calculate \(B\), the hydrogen count at each vertex, and \(H\).
  5. State why a double bond is represented by one labeled edge rather than two edges in this convention.