Why Compress a Cell-Level Tree?
A cell minimum spanning tree can contain many vertices whose only role is to connect one cell to the next along an otherwise unbranched route. Drawing every such vertex makes a trajectory difficult to read, even when the scientific question concerns only the broad routes and branch structure. A trajectory skeleton summarizes these routes as segments and retains the locations where routes begin, end, or meet.
The key requirement is to simplify the representation without changing the tree’s topology. In this tutorial, topology means the connectivity and branching relationships of the graph, not its precise shape in an embedding. Compression should therefore remove only vertices that lie inside unbranched paths. A leaf or a branchpoint is structurally meaningful and must remain.
This definition applies to the graph after the MST has been constructed. It does not decide which edge weights or cell geometry should have been used to build that tree. The earlier material on constructing minimum spanning trees and choosing edge weights concerns those upstream choices. Here, the fixed input is a tree, and the task is to represent its structure more compactly.
A segment can retain more than its two endpoint labels. For an original path \(v_0,v_1,\ldots,v_m\), it can store the ordered list of cells along the path, the number of edges, and an aggregate of the edge weights. If the weights \(w_i\) represent additive distances or costs, a natural segment weight is \(W=\sum_{i=1}^{m}w_i\). The internal vertices are omitted from the drawing of the skeleton, not erased from the data or reassigned to a different route.
What Compression Preserves
In a finite tree with at least two vertices, leaves and vertices of degree at least 3 are precisely the vertices retained by the rule. Every other vertex has degree 2 and lies along a unique unbranched route. Because the input is connected and acyclic, there is exactly one path between any two vertices. Thus each maximal degree-2 chain has a well-defined pair of retained endpoints and becomes one segment between them.
Compression preserves which retained vertices are connected by each route. In particular, it preserves the number of leaves, the degree of every retained branchpoint, and the incidence pattern among endpoints and branchpoints. It does not preserve the number or identities of internal cells unless those are stored as segment metadata. Nor does it automatically preserve a geometric curve between cells: a segment weight gives an aggregate, not the detailed positions or shape of the path.
To justify the result, consider replacing one degree-2 vertex \(u\), adjacent to \(a\) and \(b\), by an edge between \(a\) and \(b\). Any route that formerly passed through \(u\) can now use the replacement edge, so connectivity among the remaining vertices is unchanged. A cycle in the new graph would correspond to a cycle in the original graph by expanding the replacement edge back to the path \(a-u-b\); this is impossible because the original graph is acyclic. Repeating this operation along each maximal chain gives the skeleton. No leaf or branchpoint is removed, so their incidences remain represented.
For a tree with at least two vertices, let \(L\) be its number of leaves and \(B\) its number of branchpoints. The skeleton has \(L+B\) vertices and therefore \(L+B-1\) edges, because every finite tree with \(q\) vertices has \(q-1\) edges. This is a useful bookkeeping check. A one-vertex tree is a special case: it has one retained vertex and no segments.
Worked Example: Compressing a Tree With Two Branchpoints
Consider a hypothetical cell MST with vertices \(A,B,C,D,E,F,G,H\) and edges \(AB,BC,CD,CE,EF,EG,GH\). Their weights, in the same order, are \(1,1,1,2,1,1,1\) arbitrary distance units. Assume these weights are nonnegative and additive along paths.
The degrees are \(\deg(A)=\deg(D)=\deg(F)=\deg(H)=1\), \(\deg(B)=\deg(G)=2\), and \(\deg(C)=\deg(E)=3\). Therefore \(A,D,F,H\) are leaves, \(C,E\) are branchpoints, and \(B,G\) are the only vertices to suppress.
The maximal paths and their segment weights are:
- \(A-B-C\): \(1+1=2\) distance units;
- \(C-D\): \(1\) distance unit;
- \(C-E\): \(2\) distance units;
- \(E-F\): \(1\) distance unit;
- \(E-G-H\): \(1+1=2\) distance units.
The skeleton consequently has retained vertices \(A,C,D,E,F,H\) and five segments. Its branchpoint degrees are still 3 at both \(C\) and \(E\), and its four leaves are unchanged. The total segment weight is \(2+1+2+1+2=8\), matching the total original edge weight \(1+1+1+2+1+1+1=8\). This agreement is expected because every original edge appears in exactly one segment.
The drawing can omit \(B\) and \(G\), but the segment records should retain the paths \(A-B-C\) and \(E-G-H\) if cell-level interpretation or later inspection is needed. The skeleton has fewer displayed vertices; it does not imply those cells were absent from the original tree.
Constructing and Checking the Skeleton
A practical procedure is to compute degrees from the fixed MST, mark all vertices of degree other than 2, then trace each edge out of a marked vertex through degree-2 vertices until another marked vertex is reached. Mark each original edge as visited so it belongs to exactly one segment. For every segment, retain its endpoints, ordered path, edge count, and chosen weight summary. These records make it possible to inspect or reconstruct the original path.
Confirm that the graph is connected and acyclic, as a minimum spanning tree should be. A disconnected graph or a cycle requires resolving the input representation before applying this tree-compression rule.
Retain degree-1 leaves and all vertices of degree at least 3. Degree-2 vertices are candidates for suppression because they do not create or terminate a branch.
From each retained vertex, follow an unvisited edge through degree-2 vertices until the next retained vertex. Store the full path and summarize its edges.
Check that every original edge was assigned once, the skeleton is connected and acyclic, and retained degrees and segment counts agree with the input tree.
A branchpoint in a tree may have degree 4 or higher; it should remain one vertex with that degree. Replacing it with a sequence of degree-3 vertices would invent a branching order not present in the input. Likewise, do not collapse two branchpoints into one merely because they are close in the embedding: their connection may contain a short segment, but the distinct branch incidences are part of the topology.
Worked Example: A Long Unbranched Route
Suppose a hypothetical MST is the path \(P-Q-R-S-T\), with edge weights \(0.5,1.5,2.0,1.0\) distance units, respectively. The endpoint degrees are \(\deg(P)=\deg(T)=1\), and the internal degrees are \(\deg(Q)=\deg(R)=\deg(S)=2\). There are no branchpoints.
The maximal path from \(P\) to \(T\) becomes one segment. Its aggregate weight is \(0.5+1.5+2.0+1.0=5.0\) distance units; it represents four original edges and five cells. The skeleton has two vertices and one edge, which satisfies the tree check \(q-1=2-1=1\).
This compression is appropriate for displaying the route as a single unbranched segment. It would be insufficient if the analysis needed to identify which cell lies at a particular distance along the route unless the ordered cell path and edge-level weights were retained. A single total of 5.0 does not reveal how that distance is distributed among the four edges.
Weight Summaries and Meaning
Topology does not depend on the numerical values of the edge weights once the MST has been fixed. The degree rule identifies the same vertices whether the weights are Euclidean distances, another nonnegative dissimilarity, or omitted from the drawing. Weight summaries matter for the metric information attached to segments, however. If edge weights measure additive path distance, summing them gives the path length. If weights are similarities, probabilities, or another non-additive quantity, their sum may have no meaningful interpretation; retain the edge-level values or define a justified alternative summary instead.
Worked Example: A Degree-Four Junction
In a hypothetical tree, a central cell \(J\) connects directly to four leaves \(K,L,M,N\), with edge weights \(0.8,1.1,0.9,1.2\) distance units. The degrees are \(\deg(J)=4\) and \(\deg(K)=\deg(L)=\deg(M)=\deg(N)=1\). Every vertex is retained, so the skeleton has the same five vertices and four edges as this small input tree.
There are no degree-2 vertices to suppress. The central degree-four junction remains degree 4, and the four incident segment weights remain \(0.8,1.1,0.9,1.2\) distance units. The skeleton has \(L=4\) leaves and \(B=1\) branchpoint, so the segment-count check gives \(L+B-1=4+1-1=4\), as observed.
The example illustrates an important boundary of the method: compression shortens degree-2 chains; it does not simplify every tree. A junction’s degree is not evidence that it should be split into several sequential branchpoints. Such a split would alter the input topology rather than summarize it.
Diagnostics, Alternatives, and Limitations
Several checks can reveal a faulty compression. If the skeleton has fewer or more leaves than the input, an endpoint may have been removed or misclassified. If a branchpoint’s degree changes, a segment may have been traced incorrectly or multiple junctions may have been merged. If any input edge is missing or counted in two segments, path tracing is incomplete. For a nontrivial tree, the number of segments should equal the number of retained vertices minus one, and each segment should expand to a unique path in the original tree.
Compression also cannot repair a questionable MST. A spurious branch remains a branchpoint if its degree is at least 3; deciding whether to remove such a branch is a separate modeling choice. Similarly, a disconnected input is not made into a single trajectory by drawing its components close together. The tree assumption must be checked before interpreting the skeleton.
The full MST is preferable when cell identities, local edge lengths, or short-scale irregularities are central to the question. A skeleton is preferable for a compact account of branch incidence and long routes, provided its segments retain sufficient metadata. A principal curve instead represents a smooth geometric path and is not simply a compressed graph; it may be unsuitable for representing genuine branching. These representations answer related but distinct questions, and none of them by itself establishes a biological lineage or causal direction.
A common mistake is to say, “Degree-2 cells contain no information, so delete them.” Degree 2 means only that a vertex does not change the tree’s branching pattern. The cells can still carry expression states, annotations, or local geometry relevant to interpretation. The correction is to suppress them only in the skeleton display or data structure while keeping a mapping from every segment to its original cells and edges whenever those details may matter.
Check Your Understanding
Answer each question, then compare your reasoning with the solutions.
- A tree has 7 leaves and 2 branchpoints. How many segments should its skeleton contain?
- Can a degree-2 vertex be removed from the drawing without losing the cell’s identity from the underlying data? Explain.
- A segment has three original edge weights of 2, 0.5, and 1.5 distance units. What is its additive path length?
- Why should a degree-4 vertex not automatically be replaced by two degree-3 branchpoints?
- A proposed skeleton has 8 retained vertices but 8 segments and is claimed to be a tree. What check fails?
Solutions. (1) It has \(L+B-1=7+2-1=8\) segments. (2) Yes. Suppression changes the compact representation, not necessarily the stored data; preserve a mapping from the segment to the original cell and edge sequence. (3) The additive path length is \(2+0.5+1.5=4.0\) distance units. (4) That would invent an ordering or grouping of branches that is not encoded in the original tree and would change its topology. (5) A tree with 8 vertices must have \(8-1=7\) edges, so 8 segments cannot form the claimed connected acyclic skeleton; check the graph or the segment tracing.