The tree is also a graph, therefore, we derive boundary vertex pairs (u, v) for each tree, and then combine these sets of edges and display the resulting graph.
The question arises of how to compare the vertices in one tree with the vertices in another (for example, we have a pair of edges (5,9) in tree 1 and a pair of edges (5,6) in tree 2, do these 5s correspond to the same top?).
Numbering vertices (it is possible that assigns numbers to each vertex in an incomplete binary tree, as if it were a complete binary tree, therefore, in other words, assigns vertices in any partial binary tree slots of a hypothetical full binary tree of which this tree is a subtree) that somehow provides the desired equivalence is what works.
user2530580
source share