UFDC Home  Search all Groups  UF Institutional Repository  UF Institutional Repository  UF Theses & Dissertations  Vendor Digitized Files   Help 
Material Information
Subjects
Notes
Record Information

Full Text 
A CLASSIFICATION OF TREES AND APPLICATIONS OF TOPOLOGY AND GRAPH THEORY TO NEUROSURGERY By TAEIL YI A DISSERTATION PRESENTED TO THE GRADUATE SCHOOL OF THE UNIVERSITY OF FLORIDA IN PARTIAL FULFILLMENT OF THE REQUIREMENTS FOR THE DEGREE OF DOCTOR OF PHILOSOPHY UNIVERSITY OF FLORIDA 2000 Copyright 2000 by TAEIL YI TO My parents, BeomYoung & BongWol, who show me how to love, My wife, MoonSil, who shows me what is love, and My children, David & Peter, who are the reasons why I love ACKNOWLEDGEMENTS I would like to express my sincere appreciation to the members of my supervi sory committee, Dr. Beverly Brechner, Dr. Philip Boyland, Dr. James Keesling, Dr. LiChien Shen, and Dr. Mary Kantowski, for their patience, knowledge, concern, and especially for showing me how to study and teach. I would especially like to thank my advisor, Dr. Beverly Brechner, who accepted me and gave me a chance to work with her. I also want to express my appreciation for all her effort and all that she has done for me, not only in my major field, but also in my life. I would like to thank Matthew Harvey who brought me some wonderful ideas and wrote the Mathematica programs. I would like to thank Dr. Francis Bova who brought me these questions which were 'new world' to me. I would like to thank Dr. Meeks for helpful conver sations, and Dr. Thomas Wagner who gave me the information about neurosurgery that I did not know before. I would like to thank Dr. Yunmei Chen who gave me inspiration. I would like to thank Dr. Miklos Bona who showed me some insights of combinatorics. Finally, I would like to thank the Department of Mathematics that allowed me to be here and meet all these wonderful people. TABLE OF CONTENTS ACKNOWLEDGEMENTS ............................ iv ABSTRACT ... . .. .. .. ... .. .. .. .. .. .. . .. .. ... vii CHAPTERS 1 INTRODUCTION .............................. 1 2 AN AUTOMATED SPHERE PACKING PLAN FOR BRAIN TL'UMORS 5 2.1 Introduction . . . . .. . . . . . . . . . 5 2.2 Linac . . . . . . . . . . . . . . . . .. 5 2.3 Procedure of Radiosurgery ........................ 6 2.4 Making a Sphere by Arcs of Beams .................... 10 2.5 Sphere Packing Plan ......................... 10 2.6 Shelling Algorithm .......................... 15 3 A CLASSIFICATION OF UNLABELED TREES ............ 25 3.1 Introduction .. . . . . . . . . . . . . .. 25 3.2 Definitions .. .. .. .. .. .. .. ... .. .. .. .. ... 26 3.3 Vertex Sequence ........................... 28 3.4 Degree Sequence ........................... 36 3.5 Perfect Sequence and Main Theorem .................. 44 3.6 Obtaining Perfect Sequences . . . . . . . . ... .. 45 3.7 Extended Partitions and the Algorithm . . . . . .... ..53 4 TREES AS INVARIANTS FOR BRAIN TUMOR SHAPES ...... 59 4.1 Introduction . . . . . . . . . . . . . ... .. 59 4.2 Definitions and Some Properties . . . . . . . ... .. 60 4.3 Graphs for Sphere Packing Plans . . . . . . . ... .. 64 4.4 Order in the Vertex Set . . . . . . . . . . ... .. 65 4.5 Maximal Tree from a Graph . . . . . . . . ... .. 71 4.6 Graph from a Maximal Tree . . . . . . . . ... .. 81 4.7 Algorithm for Our Maximal Tree . . . . . . . ... .. 81 APPENDICES A SHELLING PROGRAM FOR SPHERE PACKING .......... 82 A.1 Program for Data Reading ....................... 82 A.2 Program for Center Searching ...................... 83 B PROGRAM FOR THE MAXIMAL TREE OF A GRAPH ...... 91 C PROGRAM FOR CLASSIFYING TREES BY SEQUENCES ..... 93 C.1 Program .. .. .. ... .. .. .. ... .. .. . .... 93 C.2 Some Program Results ....................... 97 D LABELED GRAPHS AND TREES ...................... 102 D.1 Number of Labeled Graphs and Labeled Trees ......... 102 D.2 Sketch of the Construction of a Priifercode ............. 102 D.3 Reconstruction of a Tree from a Priifercode ........... 103 REFERENCES ................................... 105 BIOGRAPHICAL SKETCH ............................ 105 Abstract of Dissertation Presented to the Graduate School of the University of Florida in Partial Fulfillment of the Requirements for the Degree of Doctor of Philosophy A CLASSIFICATION OF TREES AND APPLICATIONS OF TOPOLOGY AND GRAPH THEORY TO NEUROSURGERY By TaeIl Yi August 2000 Chairman: Dr. Beverly L. Brechner Major Department: Mathematics The work of this dissertation was motivated by our work with a medical group at the Brain Institute at the University of Florida. This group was led by Dr. Francis Bova, who raised the following questions: (1) Can you automate the timeconsuming sphere packing process for our "multiple isocenters method of stereographic radiosurgery" for brain tumors? (This surgery is noninvasive, radiation surgery to destroy brain tumors.) (2) Can you classify the shapes of brain tumors? In this dissertation, we construct some algorithms and programs to (partially) answer these questions. Our major (joint) results are described below. Our first result is an algorithm and a program that produce a unique sphere packing plan for any given brain tumor shape, filling the shape with different size spheres in a unique way. This process automates the 'sphere packing' part of the surgery plan. Additional code by the medical group was necessary to allow for physi cian input in certain critical cases. It was then possible for the medical group to incorporate this into their surgery plan, semiautomating it, and significantly reduc ing the surgeons' surgery planning time. Our second result is a complete classification of unlabeled ntrees. We assign to each ntree, a sequence of n nonnegative integers satisfying certain properties; and from each such sequence, we can recover the ntree assigned to it. In fact, we present both an algorithm and code to produce not only the sequences, but also pictures of the corresponding trees. Our final result is a first attempt at a topological classification of tumor shapes. We first use our sphere packing plan to construct a graph representing the tumor. We then have an algorithm and program which uniquely select a maximal tree in the graph. Thus we can assign a unique tree to each tumor shape. However, different graphs may produce the same tree. Our tree classification allows us to compare two tumor shapes very easily, by just looking at their corresponding sequences. In particular, different sequences come from different sphere packing plans, but the converse does not hold. CHAPTER 1 INTRODUCTION The work of this dissertation was motivated by two questions raised by Dr. Francis Bova, of the Brain Institute, Shands Hospital, and the Department of Neuro surgery, all at the University of Florida. It turns out the differentsounding questions are very much related and are tied together naturally in this thesis. In fact, our results for the second question depend upon our results for the first question. Dr. Bova led a medical group, which joined with our mathematics group, for a number of discussions over a two year period. This resulted, for us, in both a joint medical paper [11] and in this dissertation. We also want to reference the dissertation [10] of Thomas Wagner, Dr. Bova's medical physics student, who worked with us. We expect to have three mathematics publications from this dissertationfrom Chapters 2, 3, and 4, respectively. The paper resulting from Chapter 2 will be joint with Professor Beverly Brechner, Professor Yunmei Chen, and Dr. Thomas Wagner. The papers resulting from Chapters 3 and 4 will be joint with Matthew Harvey, an undergraduate student working with Professor James Keesling on his honors thesis. Further, we anticipate an additional paper, to be joint with Yunmei Chen and her student, Dr. Stacey Chastain. This anticipated work will be an analysis of the tumor shapes of approximately 1000 interesting tumor radiation surgeries done by Bova and his colleagues at the University of Florida. Dr. Bova's questions were the following: 1. Is it possible to automate the medical group's "multiple isocenters method of stereographic radiosurgery" to destroy brain tumors? 2. Is it possible to classify brain tumor shapes? In this dissertation, we develop some algorithms and programs related to these questions. In stereographic radiosurgery, which is noninvasive surgery, radiation is de livered by means of collimatorscylindrical metal tubes, with cylindrical holes through them, through which the radiation flows. The goal of stereotactic radiosurgery for a brain tumor is to deliver the desired dosage to the target, and only the target. This is not possible in reality. So they do the next best thing, which is to deliver enough dosage to the target, to avoid as much normal tissue as possible, and to deliver as little radiation as possible to whatever normal tissue must be affected. There are two additional important criteriadose homogeneity and dose conformality. That is, we do not want 'hot spots,' which have been experimentally determined to cause com plications; and we do want rapid falloff of dose levels outside the actual tumor. One of several such radiation surgery methods is called the 'Multiple Isocenter Method.' This involves filling the tumor image with spheres of different sizes, until the image is best filled up. In this dissertation, we call such a plan, a 'Sphere Packing Treatment Plan.' In Chapter 2, we develop both an algorithm, which is called a 'shelling process' (or grassfiree process' in medical terminology), and a CH+ program to identify the centers and sizes of spheres for this sphere packing treatment plan. For any given brain tumor, our program gives us a unique sphere packing plan. This sphere packing plan can be represented numerically as a list of parameters of the spheres, namely the centers and radii of the spheres. Based on this algorithm, the medical group developed a proprietary program for an automated sphere packing treatment plan, including dosage distribution, and other things (see Wagner et al.[ll]). Since this program always produces the same plan for the same tumor, it can be used as a 'benchmark' against which to compare other treatment plans. In Chapter 3, we obtain a code to denote an unlabeled tree by a unique, ordered, nonnegative integer sequence satisfying certain properties. We call such sequences, perfect sequences. That is, we obtain a complete classification of unlabeled ntrees by means of the perfect sequences of n nonnegative integers. Thus we have our main theorem of this chapter, the Tree Classification Theorem, (Theorem 3.5.5): For any positive integer n, let T(n) be the set of unlabeled ntrees and P(n) the set of perfect sequences of ntrees. Then there is a onetoone correspondence between T(n) and P(n). We show how to assign a perfect sequence to a given tree, and conversely, how to reconstruct a tree from a given perfect sequence. We also include an algorithm and a Mathematica program to produce not only all the perfect nsequences, for any given positive integer n > 3, but also pictures of the corresponding trees. By means of this program, we get our classification of unlabeled ntrees and also the total number of ntrees. In Chapter 4, we make a first attempt at a topological shape classification of tumorsactually of the sphere packing plan associated with the tumor shape. We first assign to each tumor a unique graph, and from that, we determine a unique tree. We obtain the graph by assigning a vertex for each sphere, and an edge between each pair of vertices representing adjacent spheres. This produces a unique connected graph corresponding to each sphere packing plan. Then, by using the notion of cutvertex, we give an order to the vertex set. We then use this order to build a unique maximal tree contained in the graph. Next, we develop an algorithm and a Mathematica program to assign a unique tree to each sphere packing plan. This program produces a list of edges of the tree, making it clear which edges are incident. Using our results of Chapter 3, we can now assign exactly one perfect sequence to each tumor. However, it may happen that more than one tumor shape (or graph) gives rise to the same tree, and therefore to the same perfect sequence. Thus, we do not yet have a real classification of tumor shapes. However, if two perfect sequences are distinct, then their corresponding trees, and therefore their respective correspond ing graphs and sphere packing plans, are also distinct. Therefore we may consider 4 their shapes to be distinct. Thus, we have our main result of Chapter 4, Theorem 4.5.6: The perfect sequences are invariants of the shapes of arbitrary brain tumors. That is, if two brain tumors are represented by distinct perfect sequences, then their corresponding trees are not isomorphic, and therefore their respective graphs and sphere packing plans are not isomorphic. Thus, we may consider their shapes to be distinct. We refer the reader to Douglas[l], Gross[3], and Harary[5] for graph theory. We also refer the reader to Hall[4], Riordan[7] and Stanley[9] for combinatorics. CHAPTER 2 AN AUTOMATED SPHERE PACKING PLAN FOR BRAIN TUMORS 2.1 Introduction The goal of stereotactic radiosurgery for a brain tumor is to deliver the desired dosage to the target, and only the target. This is not possible in reality. So they do the next best thing, which is to deliver enough dosage to the target, to avoid as much normal tissue as possible, and to deliver as little radiation as possible to whatever normal tissue must be affected. There are two additional important criteriadose homogeneity and dose conformality. That is, we do not want 'hot spots,' which have been experimentally determined to cause complications; and we do want rapid falloff of dose levels outside the actual tumor. One of several such radiation surgery methods is called the 'Multiple Isocenter Method.' This involves filling the tumor image with spheres of different sizes, until the image is best filled up. This noninvasive method of surgery, namely by using radiation, relies on a piece of equipment called the Linear Accelerator (or simply, Linac). In this chapter, we show how to automate the construction of a sphere packing plan for the tumor image. Most of the information in this chapter about treatment of a brain tumor is taken from Friedman et al.[2]. See [2] for further reference. 2.2 Linac According to Friedman et al.[2], the linear accelerator is a complex machine capable of producing Xrays. A large amount of energy is generated by the power supply, which then powers the filament shown. This causes electrons to be emitted by the filament, which are in turn accelerated to higher energies using a (microwave) wave guide. The electrons are then changed in direction by the magnet so that they impact on a heavy metal alloy target. This results in Xray production that can then be collimated or shaped by both primary and secondary collimators within the linear accelerator head. This beam is further collimated for radiosurgery by the tertiary radiosurgery collimator. (See Figure 21 and Figure 22.) The Linac is mounted on a rotating gantry such that the beam has a center of rotation about 1.5m above the floor. Usually, the isocenter accuracy is defined within a 2mm sphere. Because stereotactic radiosurgery depends on optimized accuracy, an improved system was designed at the University of Florida, by adding a set of bearings to the stereotactic collimator system and under the patient table. As a result, this new system achieves mechanical accuracy within 0.2mm0.1mm for defining the treatment isocenter of beam delivery. The tertiary collimators are generally circular and allow improved centering of the treatment beam. The sizes of these collimators are from 5 to 40mm in 2 to 5mm increments. 2.3 Procedure of Radiosurgery The procedure of radiosurgery is separated into 5 steps as follows. (1) Head ring attachment (2) CT scan (3) Image Processing (4) Planning (5) Treatment delivery For more detailed information, refer to Friedman et al.[2]. (1) Head ring attachment The stereotactic radiosurgery treatment requires attachment of a stereotactic head ring. This ring provides accurate information about the position and the shape Heavy alloy target Primary (Internal) collimators Flattening filter Secondary (Adjustable) colimators Tertiary (Radiosurgery) collimators Photon beam for radiourgery Floor stand with treatment arm above Figure 21. System of Linac (Friedman et al.[2]) Figure 22. Operation of Linac (Friedman et al.[2]) of brain tumors from the computer tomography (CT). This ring also helps to insure that the treatment target is accurately placed at the precise isocenter of the Linac. (2) CT scan After attaching the head ring, a series of cut filming is taken. Eighty to 150 CT slices are taken per patient. For radiosurgical treatment planning, getting the accurate size and shape of the target is very important. Underestimation of the target size may result in treatment failure. Overestimation of size results in the inclusion of normal brain tissue within the treatment volume. Misrepresentation of an irregular target shape may lead to radiation damage of normal brain tissue. The accuracy of CT scanning depends on the size of the pixels that make up the scan image. The lateral and AP accuracy of scanning is approximately 0.6mm. But the axial dimension is determined by slice thickness of the CT scan, which is 1mm in general. The physicians use the socalled BrownRobertsWells coordinatesor, simply BRW coordinateswhich are called lateral (Lat), anteriorposterior (AP), and axial (Ax) coordinates. These are the x, y, and z coordinates, respectively. The direction of the lateral coordinate is from the left hand side ear to the right hand side ear of the patient. So the lateral view (or sagittal) is similar to the side view of the head, that is, views of slices along the lateral axis. This is the same as yzplane views. The direction of the AP coordinate is from the back side of the head to the face. So the AP view (or coronal) is similar with the front view of the head, that is, views of slices along the AP axis. This is the same as xzplane views. The direction of the axial (or vertical) coordinate is from the neck to the top of the head. So the axial view (or transaxial) is similar to the sky view of the head, that is, views of slices along the axial axis. This is the same as xyplane views. (See Figure 24.) (3) Image Processing An MRI scan has been done the day before surgery. Using a mouselike device, the CT and MRI images are transferred to the computer screen and fused. Then, using geometric equations, the computer determines the lateral, AP, and vertical stereotactic coordinates of each point in each CT slice. (4) Planning Physicians use a mouse and their own judgment to 'eyeball' the location and the size of spheres for the treatment plan. (5) Treatment delivery The geometric sphere packing plan, developed as in (4), is combined with a proprietary dose planning program, and the resulting treatment plan is delivered by the Linac. 2.4 Making a Sphere by Arcs of Beams By varying the angle of the gantry and the angle of the table, one can deliver a radiation beam to the target from any angle within the range of the rotation. The shape of the common intersection of an arc of beams passing through one isocenter is a sphere. The neurosurgeons deliver a series of arcs (usually 5 or 9 arcs) to produce a single isocentered sphere shape. For an ellipsoidal target, they use fewer numbers of arcs to make a single isocentered ellipsoid shape. (See Figure 23, 24 and 25.) So, if the target shape is very close to a sphere or an ellipsoid, then the treatment plan is relatively easy compared to an irregularly shaped target. In that case, we need to create a geometric treatment plan. 2.5 Sphere Packing Plan As seen in the previous section, the physicians know how to irradiateto (eventually)destroy tumors which are shaped like spheres or ellipsoids. For a non spherical shape of tumor, they try to fill the target with several spheres of different sizes. This is called the 'sphere packing' treatment plan. After finding a sphere packing plan, they treat each sphere separately as de scribed in the previous section. So, multiple isocenter radiosurgery planning includes Figure 23. One isocenter plan with five arcs of radiation (Wagner et al.[ll]) (270') (310*) (330") (350) I (501 (30') A (lo) I H G FED C BA Figure 24. One isocenter plan with nine arcs of radiation (Friedman et al.[2]) 13 A F ,,.. ,,"" : ,_ _._ .... **\ '*,f %1% Ii% l II I .' ./ .,,,, i, ,,, > /" ' "l '. *./, .,TARGET : _ I, B No TARGET ., Figure 25. Plan for a sphere shape and an ellipsoidal shape (Friedman et al.[2]) "' i \ ': "' "* "" ' "* "','  ..., 2::_'V :2 * / ..' : "* Figure 25. Plan for a sphere shape and an ellipsoidal shape (Friedman et al.[2]) the problem of determining the best sphere packing arrangement with which to fill the target volume. General methods for this treatment plan are iteratively based, dosimetrically driven algorithms. But these methods require many computations in order to compute a radiosurgical plan dose distribution, and then to evaluate the quality of the dose distribution. So geometrically based radiosurgery optimization has been suggested as a possible alternative means. However the method the physicians choose relies on human decisions and experience. Thus, for the same target, different surgeons may produce different plans. Even the same surgeon, doing the plan twice for the same target, may produce different plans. And the planning takes a long time, especially for a complicated target which needs more than 10 spheres. It might take as much as two hours of planning for a difficult case which needs about 20 spheres. During that time, the patient has to wait with the head ring attached to his or her head. And most importantly, even after spending the time to make a plan, many physicians without sufficient experience, are not sure if the plan is a 'good' one. Therefore, we provide an automated sphere packing method for the treatment plan (see Wagner et al.[11]). This method shows potential to significantly aid the planning of difficult multiple isocenter cases. Based on tests with irregularly shaped phantom targets and with a representative sampling of clinical example cases, the method demonstrates the ability to generate radiosurgery plans comparable to, or of better quality than, multiple isocenter Linac radiosurgery plans found in other literature. At the same time, this program always produces the same treatment plan for the same tumor shape. So it can be used as a 'benchmark' to compare with other plans for the given tumor shape. Moreover, this program provides the treatment plan in a relatively short time. For a very difficult case which needed more than 18 spheres, this program took less than 3 minutes instead of more than the 1.5 hours which were needed when the physicians created the plan using traditional methods. The algorithm of this program is shown in Figure 26. In the following section, we explain the 'shelling algorithm' which we used in this program to get the centers and sizes of spheres for the sphere packing plan. 2.6 Shelling Algorithm The shelling procedure is best illustrated in Figure 27 to 216. The major steps of this shelling procedure are as follows. (1) Transferring the data of the boundary of the target From the CT scan, each point which is identified from the target contour data file can be mapped into a three dimensional array, since each CT scan shows the transaxial view for a specific axial coordinate value. In the three dimensional array, we assign the lateral, AP and axialcoordinates to be x, y and zaxes, respectively. For each individual case, there are minimum and maximum values for x, y and z axes. We assume the minimum value is always one. We get this information from the Program for Data Reading. (See Appendix A.1.) Let the target be minimally enclosed in an xrange beginning with one and ending with M,, a yrange beginning with one and ending with My, and a zrange beginning with one and ending with M,. Now we put 'safe bumper' layers sur rounding the target. That is, we enlarge the box containing the target to ET = [0, M, + 1] x [0, My + 1] x [0, M, + 1]. ET stands for 'enlarged target box.' We assume that the dimension of each voxel is 1 x 1 x 1. Then we will number the voxels in a lexi cographic manner, beginning with 0 and ending with (M.++l)x(My+l)x(M2+1)1, giving us a total of (M, + 1) x (My + 1) x (M, + 1) voxels with which we will work. Now we want to identify the voxels in ET in two different ways: first, by a set of coordinates (a, b, c), and second, by an integer representing a counting procedure. Here, a is the left hand endpoint of the xvalue of that voxel, b is the left hand endpoint of the yvalue of that voxel, and c is the left hand endpoint of the z value of that voxel. The second notation for the voxel (a, b, c) is by some integer n. The voxels are counted, using a lexicographic ordering beginning with 0 and ending with (M, + 1) x (My + 1) x (M, + 1) 1 which is denoted by nofdata in the program (see Appendix A.2). Then the voxel denoted by (a, b, c) is numbered as c x (M. + 1) x (My + 1) + a x (M. + 1) + b. And it is clear that, for every 0 < i < nofdata, there are unique nonnegative integers, a,b,c, such that i = c x (M, + 1) x (M. + 1) + a x (My + 1) + b. That is, for every 0 < i < nofdata, one and only one voxel is assigned. Note that Figure 27 to Figure 214 show the same transaxial view at different stages of the algorithm. Thus these figures show the data of a fixed axialcoordinate value. (2) Assign a status value for each voxel For every 0 < i < nofdata, the status value for the ith voxel is denoted by cc[i]. That is, we denote the status value for the voxel with coordinates (a, b, c), by cc[i] where i = c x (M, + 1) x (M. + 1) + a x (M. + 1) + b. The following is the procedure to assign status values. First of all, let cc[i] = 3 for every 0 < i < nofdata. Then we assign the number, 1, as the status value for each voxel corresponding to any of the target contour data. Next, for every 0 < j < M,, we assign cc[j x (M, + 1) x (My + 1)] = 0, because the j x (M, + 1) x (My + 1)th voxel is the voxel at the left lower corner for every jth transaxial view; that is, the voxel belongs to the healthy tissue. (See Figure 28.) For each voxel with cc[i] = 3, we define cc[i] = 0 if any of cc[i 1], cc[i + 1], cc[i (My + 1)], cc[i + (My + 1)] is 0. Note that this method produces zeros for every voxel in the safe bumper layers. (See Figure 29.) (3) Shelling the target voxels We proceed by mathematical induction on j, for 0 < j < x min{Mn My, Mz} . 12 For i = 0 to (M, + 1) x (My + 1) x (Mz + 1) 1, if the ith voxel is assigned 1 or 3 for its status value, and if any of cc[i 1], cc[i + 1], cc[i (M, + 1)], cc[i + (My + 1)], cc[i (M, + 1) x (My + 1)], cc[i + (M. + 1) x (My + 1)] is equal to j, then we assign a new status value for the ith voxel as c[i] = j + 1. Note that Figure 27 to Figure 214 show only a twodimensional figure. But this procedure is held in a threedimensional array. This process is repeated until the deepest lying voxels have been identified. The deepest lying voxel in the entire target volume would be the best location for an isocenter. And at the same time, the status value assigned to the deepest voxel indicates the radius of the sphere, which is one less than the status value of the voxel. This completes our induction. (See Figure 210.) (4) Removing the largest sphere At this moment, we might have several different voxels which have the same largest status value. So we choose the smallest numbered voxel as the center of the first largest sphere to be removed from the target. But in the program in Wagner et al.[11], we choose the most effective voxel to be the center of the first largest sphere, by using the 'score function' which was developed by Tom Wagner. We think of the resulting sphere in the tumor as 'removed,' and therefore we can assign the new status value zero for these voxels in the sphere. To determine which voxels form the sphere that is removed, we do the following: Let R = voxel at the center of sphere to be removed. Let r = status value of R. Then we remove all voxels S with the property that distance(center of R, center of S) < r 1. (See Figures 211 and 212.) Now, we proceed by mathematical induction on j, for 0 < j K x min{Mn My, Mz} . For i = 0 to (Mr + 1) x (My + 1) x (M, + 1) 1, if the ith voxel has status value > j, we reassign a new status value as follows: if any of cc[i 1], cc[i + 1], cc[i  (My+ 1)], cc[i+(My+l)], cc[i(M+l)x(My+l 1)], cc[i+(M.+1)x(My+l)] is equal to j, then we assign a new status value for the ith voxel as c[i] = j + 1. This process is repeated until the deepest lying voxels have been identified. (See Figures 213 to 215.) And we repeat step (4) until we get either 0 or 1 for the status value of each voxel in ET, the enlarged target box. Because the smallest size of the diameter of collimators is 5mm, we finish our program when the status values of all the voxels are zeros and/or ones. (See Figure 216.) The remaining part will be taken care of by the 'score function' (see Wagner et al.[11]). After finishing this procedure, we have the spheres filling the target. In Figure 217, we see the sphere packing plan within a target by this method. For further detailed information about the score function and the automated sphere packing plan, we refer the reader to Wagner et al.[11] and Wagner[10]. STOP Figure 26. Sphere packing algorithm block diagram (Wagner et al.[ll]) 0 *0 0 00 .0 0 0 0 0 0 5 10 15 20  Figure 27. Transferring the data of the boundary of the target 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 33 3 3 1 1 1 1 1 1 1 3 3 3 313 3 3 3 3 3 3 3 1 1 1 1 1 3 3 33 3 1 11 1 1 1 33 3 3 3 3331,3 3 33 3 3 3333 31 1 3 11 3 3 3 3. 3 1 1 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 1 3 3 3 3 1 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 1 1 3 3 3 1 3 3 33 3 3 3 3 3 3 3 3 33 3 33 33 1 1 3 3 1 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 1 1 3 3 1 1 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 1 3 3 3 3 1 3 3 33 3 3333 3 3 3 3 3 3 1 1 1 3 3 3 3 1 1 1 1 3 3 3 1 1 3 3 3 3 3 3 1 1 3 3 3 3 3 3 3 33 3 3 1 11 1 3 11 1 1 1 1 3 3 3 3 3 3 3 3 3 3 3 33 3 3 3 3 3 3 3 1 1 3 3 3 3 3 3 3 3 3 033 31313 3 3 3 3333 3 3 3 33 3 3 3 3 Figure 28. Status values for the boundary and the initial voxel 0 0 0 1 0 0 0 0 0 0v 0 1 0 0 0 1 0 o o o o o o olololo/o/o/olo/o olo o o o o o o o )1o o o o o10ai o o o 01o o o o o o 001 0 0., 000000000 00 0 0 0 0 0 00 0 0 JO 0000 o tooolololololo ofolojololo 010 0 0 Figure 29. Status values for the normal voxels Figure 210. Shelling the target voxels I 0 0 0 0 0 0 0 0 0 0 0 0 0 1 000 0 0 0 0 0 0 0 U 0 0 0 0 1 1 1 1 1 1] 1 0 0 J 0 0 0 l0 u S0 1 2 2 2 3 3 3 3 3 11 1 1 1 0 0 0 0 1i 3 3 3 13 4 4 4 4 4 .1 4 4 4 4 5 5 5 5 4 0i1 4 5 5 5 4 4 5 5 A 1 0. 0 1 1 'l33 4 4 4 3 3 4 4 '1 0 t 0 0 1 1. 2 2 3 3 3 2 2 3 31 1 0 ) I,.) 1 2 21 2 1 1 2 0 0 () oo ) 0 0 0 0 0 11 11 1 0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0I 0 o0 0 0 0 0 0 0 0 0 0 0 0 00 0 0 0 0 0 0 0 0 0 Figure 211. Choosing the largest sphere 0 0 0 0 0 0 0 0 0 0 ) 0 000 0 0 0 0o III1 0 0 0 0 o I 1 0 1) 0 1) 0 0 0 0 0 1 I 0 'i O 0 1 .2 l0 0 0 0 0 0 0 0 "2..,0 0 () 0 0 0 0 .. 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 oi I .. 1 0 o )u0 0,, 0 o1o c) i"... 0 01 0 o 0) 0 0 0 0 0 1 ,i 1 1 o 0_ 1 1 0 0 0 0 0 0 02 1 0 0 . () 0 0 (.2. 0 0 111 0 10 t) 0 1 1 1 11 0 ) 0 0 1) 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 () 1 0 00 00 000 000 0 0 0 0 0 0 0 0 Figure 212. Removing the largest sphere 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 u 0 0 1 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 1 1 1 11 1 0 0 0 0 j r0 0 1 1 0 the1 0 r T I I 0 11 0 0 0 u 0 U1) 00 1 1 0 10 U .. .~ I0U~U lT 0 1 1 0 0 0 0 0 0 0 0 0 0 0 1 ) To o 1 o o o ( o o o o I T 11 0 1 LT o 1 0 0 0 o .) 0 0 0 0 1 O 2 .. 42 1 0 0) 0 1~ 11O0O O O U 1 1 1) 1 1 1 ( U 0 1 1 1 0 o o o o 01 10 00 0 2 41 1OU 1 U 0 1 00o 0 0 1 1 0 0 01 0 0 0 0 0 1 2 1 0000 000 0 0 1 1 01 0 10 0 0 0 0 0 1 0 lo 0 01, o 0 0 0 0 0 0 000 0 0 0 0 01010 0 0 01 0 0 0 0 0 0 0 Figure 213. Shelling the remaining target voxels 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 1 1 1 1 1 1 1 0 0 0 0 0 0 1.&.1(J 00000_0 U1 '.)11 0 1 23 3 0.Z 1 0 0 0 0 0 0 0 ) 0 1 1 0 1 1 1 0 0 0 0 oI 1ooooooo ,0 o1O0ooO Fi ur o o o o o o o o o s ofo t r emini o a o I 1 0 0 0 0 0 0 0 0 o 0 0 142 3arge 1 1t Q I : 1 0 0 0 0 0 0 0(' ) 0 1l 4 A A 1 1 1,0 I 1 0 0 0 0 0 0 u 1.) 0 1l 3 2 1. 0 0 0 0 1 1 0 0 0 10 0 0 0 0 0 1 2 3 3 212 1 1 1 0 0 0 0 1 1 1 0 0 10 0 0 0 0 1 2. 2 1 0 10 0 0 0 0 00 0 0 0 0 0 0 0 0 0 0 1 1 0'L 0] 10 i 0 ) 0 10 0 o 0 0 0 0 0 0 0 0 0 0 0 0 0 0~ 0 0 0 0 00 0 Figure 214. Choosing the largest sphere of the remaining target 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 00000 0 0 0 0( 0 0 0 0 0 0 1 0 1 1 1 1 0 0 0 0 0 0 o 0 0 ( 0 0 0 1 1 0 0 0 0 0 o I I IJI I 1 JJ01 0 0 0 (1 0 0 0 ) 1 1 0 C0 0 0 0 0 0 1 1 1 1 1 1 1 0 0 0 ' 0 1 1 1 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 1 1 0 0 0 0 00 0 O l0 o1 1 01 o 0 1 1 0 0 0 0 0 0 0 0) 0 0 0 0 00 0 01 1 1 0 0 1 1: 0 0 0 0 0 ( 0 0 1 0 0 0 0 1 2 1 1 0 I 1 .2 u 0 0 o 0 0 0 C ) 0 0 0 0 0 0 0 0 0 1 1 ) 0 0 0 1 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 1 1 0 0 0 0 1 1 1 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0o 0 0 o0 0 0 0 0 0 0 0 1 1 0 1 0 1 1 1 1 0 0 0 0 0 0 o 0 0 0 0 0 0 0 0 01 0 1 l 0 0 o 00 1) 0 iJ) 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 Figure 215. Removing the second sphere 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 00 0 0 0 0 0 0 0 0 0 1 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 1 1 1 1 1 1 1 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 (.) 0 1 0 1 1 0 1 1 0 0 0)() 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 010 0 0 0 0 0 1 1 0 0 1 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 1 1 0 0 0 0 1 1 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 1 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 00 0 0 0 00 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 000 0 0 0 0 0 Figure 216. Removing all the spheres patB.wol .35 40. i ' c 1"" ,.^ ' .... ," ...,, 20 2 100 20 Lot AP Patient A. 12 8cc mengloma .3)5 306 i 0i ^ ..... .40 " .30 2 20 10 0 10 .1 2D Lat AP Figure 217. A sphere packing plan for a brain tumor (Wagner et al.[ll]) CHAPTER 3 A CLASSIFICATION OF UNLABELED TREES 3.1 Introduction In this chapter, we obtain a code to denote an unlabeled tree. By means of this code, we classify unlabeled ntrees. One may take an unlabeled ntree to be the geometric realization of a connected, finite, simplicial complex without any simple closed curves. In particular, we call a tree an ntree if and only if it is a tree with n vertices (that is, (n 1) edges). Our code assigns a unique, ordered, 'perfect sequence', pf(T) = (di, d2,. ., dn), to each unlabeled ntree, T. And, conversely, given an ordered sequence of n integers satisfying certain properties, it is the perfect sequence of exactly one unlabeled ntree. Thus, we have our main theorem, the Tree Classification Theorem (Theorem 3.5.5). We then show how to reconstruct the tree shape from a given perfect sequence, by hand. Our work includes an algorithm and a Mathematica program (see Appendix C.1) that produce a list of all the perfect sequences for all possible ntrees, thus also producing the number of ntrees, for any given n. For some examples, see Appendix C.2. Since our algorithm and program are based upon our main theorem, we know that all possible unlabeled ntrees are produced by the program. Thus the program gives us, for each positive integer n, a complete list of all unlabeled ntrees. Given n > 0, with sufficient computer power and time, our program will list all the unlabeled ntrees, thus telling us how many unlabeled ntrees there are. However, we do not have a simple formula that tells us how many unlabeled ntrees there are. This remains an open problem. The Literature contains work regarding the classification of labeled graphs and labeled trees. In Lovasz[6], the Priifercode is used to determine the number of labeled ntrees (see the Appendix D.2 and D.3). In Sloane[8], Sloane shows a table for n < 26. However, Sloane references Harary for the method he uses. In Harary[5], there is a simple formula for the total number of labeled graphs with n vertices (see the Appendix D.1). There is also a formula for the total number of unlabeled ntrees, but it requires knowing the number of rooted ntrees, which is calculated inductively. And, even though Harary[5] contains ntree shapes up to n = 10, there is no explanation of how to get the shapes of these trees, while our work does show how to get these tree shapes from our code. This chapter is organized as follows: Section 1: Introduction Section 2: Definitions Section 3: Vertex Sequence Section 4: Degree Sequence Section 5: Perfect Sequence and Main Theorem Section 6: Obtaining Perfect Sequences Section 7: Extended Partition and the Algorithm 3.2 Definitions Most of the necessary definitions in this section are from Harary[5]. We refer the reader to Harary[5] for easy reference. Definition 3.2.1 A graph G = (V(G),E(G)) consists of a vertex set V(G) = {vi,...,vn} and an edge set E(G) = {el,..., em} C {{fu,v}u, v E V(G)} in which each edge is an unordered pair of two distinct vertices u and v, and the edge {u, v} is said to join u and v. For an edge {u,v} we say that u and v are adjacent vertices and the vertex u and the edge {u, v} are incident with each other, as are v and {u,v}. From now on, V(G)I denotes the number of vertices and IE(G)I denotes the number of edges. For a vertex u E V(G), the vertex set A(u) = {v E GIv is an adjacent vertex of u} is called the adjacent set of u. Note that u A(u). Definition 3.2.2 A walk is an alternating sequence (vo0, ei, v1, e2,... ,ek, Vk) of vertices and edges s.t. vi,1 vi for i = 1,2,...,k, and ei = {vii,vi} for i = 1,2,..., k. If there is no confusion, a walk can be denoted by a sequence of vertices only in the path like (Vi, V2,..., Vk) A cycle is a walk (vo, el, vi, e2,...,ek, Vk) with k > 3 in which v0 = vk is the only vertex repeated. A path is a walk with no repeated vertex. A (u, v)path is a path with the first vertex u and the last vertex v. The length of the (u, v)path, l(u,v), in a graph is the number of edges in the (u, v)path. The distance d(u,v) between two vertices u and v is the length of a shortest path joining them, if any; otherwise d(u, v) = oo. Note that d(u, u) = 0. A graph G is connected iff every pair of vertices are joined by a path. A graph having no cycle is acyclic. Note that an acyclic graph can be disconnected. A forest is an acyclic graph. A tree is a connected acyclic graph. An ntree is a tree with n vertices. Definition 3.2.3 We say that a graph G is isomorphic to a graph H if and only if there exists a bijection f : V(G) + V(H) such that {u, v} E E(G) if and only if {f(u),f(v)} E E(H). Definition 3.2.4 An unlabeled tree is an isomorphism class of trees. We are interested in the total number of unlabeled ntrees and their shapes. For example, T1 = ({1,2,3},{{1,2},{2,3}}) and T2 = ({1,2,3},{{2,1},{1,3}}) are different trees, but there is an isomorphism f : V(T1) 4 V(T2) by f(1) = 2, f(2) = 1, f(3) = 3. Thus they are the same unlabeled tree, so we want to count them as one unlabeled 3tree. From now on, a tree implies an unlabeled tree unless otherwise specified. Definition 3.2.5 The degree of a vertex v, defined by d(v), is the sum of the number of edges incident with v. A vertex v is called an endvertex if d(v) = 1. We will use the geometric, that is, topological realization of a graph inter changeably with 'graph' as defined above. Proposition 3.2.6 [5] The following statements are equivalent for a graph T: (1) T is a tree. (2) Every two vertices of T are joined by a unique path. (3) T is connected and IV(T)I = IE(T)I + 1. (4) T is acyclic and IV(T)I = \E(T)I + 1. Note that there are exactly n vertices and n1 edges in an ntree. Proposition 3.2.7 (Degree sum formula) [5] If G is a graph with the vertex degrees di,...,dn,, then ZvEv(G) di = 21E(G)I. Corollary 3.2.8 For an nTree T we have i=1 d(v,) = 2(n 1) = 2E(T)\ = 2(IV(T)I 1) where vi is a vertex of T for i = 1,2,..., n. Because a nontrivial tree satisfies EEV(T)d(v) = 21E(T)I = 2(IV(T)I 1), there are at least two vertices with degree 1. Thus we have the following theorem as a corollary. Theorem 3.2.9 [5] Every nontrivial tree has at least two endvertices. 3.3 Vertex Sequence In this section, we define the vertex sequence of a given ntree. Definition 3.3.1 Let T = (V,E) be an ntree. If d(v) = m, then there are m components of T {v}. A branch of v (or simply a vbranch) is a subtree which is the closure of a component of T {v}. We call the set of vertices in a vbranch a vbranch vertex set. If u E A(v), then the vbranch vertex set containing u is called the (v,u)branch vertex set and denoted by B(v,u) (or B(u)). We call the set B'(v,u) = B(v,u) {v} the (v,u)subbranch vertex set, which is denoted by B'(u) if there is no confusion. The subtree consisting of B'(v, u) as the vertex set and {{s,t} E B'(v,u) x B'(v,u) {s,t} E E(T)} as the edge set is called the (v,u) subbranch. Example 3.3.2 Let T be the 10tree shown below. s t u p q r v w x Y 'y Figure 31 Since d(v) = 4, there are 4 components of T{v}. Since A(v)= {r, t,w,y}, we have that B(v,r) = {v,r,s,q,p}, B'(v,r) = {r,s,q,p} B(v,t) = {v,t}, B'(v,t) = {t} B(v,w)= {v,w,u,x}, B'(v,w)= {Iw,u,x} B(v,y) {v,y}, B(v,y) {y}. On the other hand, we have that B(r,v) = {r,v,t,u,w,x,y}. That is, B(v, r) $ B(r, v). And this is true for any tree except the 2tree. In fact, for every ntree with n > 2, there are at least 3 vertices, namely u, v, and w. Without loss of generality, let u and v be vertices adjacent to each other, and let the (w, v) path contain the vertex u. Then w E B(v,u) and w B(u,v). Definition 3.3.3 A section of a sequence is a subsequence consisting of consecutive terms of the sequence. Definition 3.3.4 Let T = (V, E) be an ntree with V = {x, x2, ... x}. We define the set, S, of sequences of the form s = (vI, v2,... v, n), where s is a permutation of the xi's in V(T), to be those sequences satisfying: (*) forany vj with 1 Then S is called the vertex sequence set of T and each element, s, in S is called a vertex sequence of T. Definition 3.3.5 For any v E V, we call S, = { E Svi = v} C S the vvertex sequence set. Definition 3.3.4 requires that the vertices in a sequence be listed in a particular way. The condition (*) ensures that all vertices are listed and that each is listed exactly once. We can choose any vertex for the first term, vi. Then the condition (*) says that, for the (i+l)th term, we have to choose an unlisted adjacent vertex of vi, if possible. If every adjacent vertex of vi is already used, then look backward along the sequence until we come to the first vertex which has an unused adjacent vertex. Then, for the (i+l)th term, we assign one of the unused adjacent vertices of that vertex. To get a vertex sequence, we continue this procedure inductively. Note that every vertex sequence of an ntree has n entries. Example 3.3.6 We show how to construct a vertex sequence of a given tree. Let T be the 7tree shown below. f g a b c d e Figure 32 Since we have freedom to choose the first term, let v, = b. Then v2 E A(vi) {vl} = A(b){b} = {a,c,f}{b} = {a,c,f} = A(b) = A(vi). So v2 must beoneof the elements of A(vi) = A(b) = {a, c, f}. Let v2 = c. Since v3 E A(v2) {v1, v2} = A(c) {b,c} = {b,d,g} {b,c} = {fd,g}, v3 must be either d or g. Let v3 = g. Then v4 A(v3) {v,v2, v3}, since A(v3) {v1,v2, v3} = {c} {b,c,g} = 0. On the other hand, we have that A(v2) {v1,v2, V3} = {b,d,g} {b,c,g} = {d} 5 0. Therefore we have to choose d as v4. Then v5 = e since A(v4) {v, v2, v3,v4} = {c, e} {b, c,g,d} = {e}. Since we have A(v5) {Vi, V2, V3, V4, V5} = {d} {b,c,g,d,e} = 0, A(v4) {v1,v2,v3, v4, v5} = {c,e}{ b,c,g,d,e} =0, A(v3) {vi, v2, V3, v4, v5} = {c} {b,c,g,d,e} = 0, A(v2) {v1,v2,v3,v4,v5} = {b,g,d} {b,c,g,d,e} = 0, and A(vi) {v,,v2, v3, v4, v5} = {a,c,f} {b,c,g,d,e} = {a,f }, v6 must be either a or f. Let v6 = f. Then we have that A(v6) {vi,v2,v3,v4,V5,V6} = {b} {b,c,g,d,e,f} =0, A(v5){v1,v2, v3,v4, v5,v6} = {d} {b,c,g,d,e,f} = 0, A(v4) {vi,v2,v3,v4,v5,v6} = {c,e} {b,c,g,d,e,f} =0, A(v3) {v1,v2,v3,v4,v5,v6} = {c} {b,c,g,d,e,f} = 0, A(v2){ fV1,v2, v3,v4, v5, v6} = {b,gd} {b,c,g,d,e,f} = 0, and A(vi) {v1,v2, v3, v4,v5, v6} = {a,c,f}{b,c,g,d,e,f} = {a}. Therefore v7 must be a; that is, we construct a vertex sequence (V1, V2,...,V7) = (b,c,g,d,e, f,a). For a given tree we will get different vertex sequences if we choose different vertices whenever we have two or more choices. But the sequence t = (b, c, d, e, f, a, g) cannot be a vertex sequence of T above. In fact, we have v5 = f. But we have that A(v4) {vi,v2, v3, v4} = {d} {b,c,d,e} = 0, A(v3) {Vi, V2, V3, V4} = {c, e} {b, c, d, e} =0, A(v2) {Vi,V2, V3, V4} = {b,d,g} {b,c,d,e} = {g}, and A(vi){V1,V2,V3,V4} = {a,c,f}{ b,c,d,e} = {a,f}. That is, the sequence t has f, one of the elements of A(vi) {v1, v2, v3, v4}, for v5 instead of g which is an element of A(v2) {v1, v2, v3, v4}. It is a contradiction to the maximality of k in the definition of vertex sequence. Proposition 3.3.7 Let (v1, V2,..., V,) be a vertex sequence of an ntree T. For any vj with j > 1 there is unique 1 < k < j such that vj E A(vk) {v1,v2,... vj}. Proof First of all, for any j > 1, we have vj 5 vi for i = 1,2,... ,j 1 from the Definition 3.3.4. Assume that there is j > 1 such that {vj, vj+I,...,vn} n ((Ujl'A(vi)) u {Vl, v2,..., vj1}) = 0. Then, for any u E {vj,,vj+i,.. .,vn} and any w E (U=IA(v,)) U {v1,v2, ..,vj}, there is no (u,w)path in T. That is, T is not connected. It is a contradiction to the connectedness of a tree. Therefore there is 1 < k < j such that vj E A(vk) {Vi,V2,...,vji}. If there are 1 < ki < k2 < j such that vj E A(vk,)  {v1i,v2, ...,vjl} and vj E A(vk2) {Vi, V2,.. .,vji}, then the two edges, {vj, vk} and {vj, vk2}, are elements of E(T). There is a path between vk, and vk2 in the subtree {{vl, v2,... vj}, E'} where E' = {{u,v} E E(T)j u,v v {V1, V2, .. ,Vj}}. The tree T contains a cycle consisting of {vj, Vk,}, {vj, Vk2} and the (Vkl, Vk2)path. This contradicts the fact that a tree is acyclic. Therefore there is only one 1 < k < j such that vj E A(vk) {vi,V2,... ,vj_}. I From the Definition 3.3.4 and the previous lemma we get the following corol lary immediately. Corollary 3.3.8 Let (v, v2,... v,n) be a vertex sequence of an ntree. Then (1) v2 E A(vi) (2) If d(vj) > 2 for any j = 2,3,..., n 1, then Vj+l E A(vj). (3) For any j = 2,3,... ,n 1 if d(vj) = 1 and there is i < j such that d(vi) >_ 3 and d(vk) = 2 for every k = i + 1, i + 2,... ,j 1, then vj+l E A(vi) and Vj+l . A(vp), for every p= 1,2,...,i 1,i + 1,...,j. Proposition 3.3.9 Let (Vi, v2,... Vn) be a vertex sequence of an ntree and A(vi) = {vli,vI,12...,vli} with 1 <11 < 12 <...< lm. Then {V, V2, . Vn} = UhlB(vi, vi,). Proposition 3.3.10 Let = (1, v2,..., v,.n) be a vertex sequence of a given ntree T. If d(vj) = m for some j > 1, then there exist m vertices, vi, vj,,vj2,...,viji such that A(vj) = {vi, vj,,vj2,...,vimi} with i by Proposition 3.3.7; that is, vi e A(vj). So, for any vk A(vj) {vi}, j < k. Since d(vj) = m, there are m 1 vertices, Vj Vj2... ,vj_,, such that A(vj) = {vi, Vjl, Vj2 ,..., vj.I} with < j < j < j2< ... < jm. J Proposition 3.3.11 Let = (V1, v2,..., v,,} be a vertex sequence of a given ntree T. Let d(vi) = m and A(vi) = {V11,V12,. ,Vi} be the adjacent set of v1, named so that 1 <11 < 12< ... < 1m. Then, for any i = 1,2,... ,m, the set of vertices in the subbranch, B'(vi,vii), forms a section in s starting with vii,. Proof Clearly, the section containing vi, starts with v1, = v2. Let B'(vi,v11) = {VI,V11,+i,. .. ,Vl+1m}. Assume that there is a vertex u E V(T) B'(vi,vi,) such that (v11,v11+1,...,v11+j,u,...) is a sectionof 5. Since u V B'(vi,vi,), A(vll+k) B'(vi,vl,) = 0 for any k = 0,1,2,... ,j from the definition. Thus U=0A(vl1+k)  B'(vi, vl) = 0. That is, Uk=oA(vl,+k) D B'(vi,vi,). On theother hand, A(vll+k) C B'(vi,vl,) forever k = 0,1,2,... ,j. Thus wehavethat U=o=A(vl+k) C B'(vi,vi). Therefore U =A(vi+k) = B'(vi,vl,). That is, j = mi. Hence B'(vl,vl) forms a section in s. Since B'(vi,vi) is a subbranch of vI, Vli+mi+l V A(u) for any u E B'(vi,vl). Thus vll+mi+l E A(vi). That is, Vll+mi+1 = v12. For any i = 1,2,... ,m 1, let B'(vi, vi,) form a section in s and vl,+m+i = v1i+1. By a simi lar method, B'(vi,vli+,) forms a section in s and Vi;+,i+m +l1 = Vii+2. I The section formed by a subbranch B'(vi,vi) is denoted by (B'(vi,vl,)). From the previous proposition, we have the following corollaries. Corollary 3.3.12 Let A = (v1, V2, ... Vn) be a vertex sequence of a given ntree T. Let d(vi) = mn and A(vi) = {vi,v12,...,vin} be the adjacent set of vi, named so that 1 < 11 < 12 < ... < 1m. The section (B'(vi,vi,)) precedes the section (B'(vi,vi,+,)) in A for i = 1,2,...,m 1, and there is no other vertex between these two sections. Corollary 3.3.13 Let (vi,V2,... , V) be a vertex sequence of a given ntree T. For any j > 1 with d(vj) = m > 2 let A(vj) = {vi,v,,v12,..., ,,_i} where i < j < Ji < J2 < ... < jm1. Then (B'(vj,vj,)) = Vi,vji+ ...,vj(i,+l)1) for any i = 1,2,..., m 1. In particular, we have that ji = j + 1. Note that B(vj, vjm ,) = {vj, Vjm_, Vj.,i+i,..., Vj.i } is the (vj, vj,,_ )branch vertex set for some jm > jm1. Corollary 3.3.14 Let (vl,v2, ... vn) be a vertex sequence of a given ntree. If i < j with vj A(vi) and vj 3 A(vk) for every k = i + 1,i + 2,...,j 1, then vp A(vk) for every p > j and k = i+ 1,i + 2,...,j 1. For any given vertex sequence s = (Vi, v2,..., vn) and any vertex vj 7$ vi, Vi belongs to a branch of vj. We want to give a special name to this branch. Definition 3.3.15 Let = (vi, V2, vn) be a vertex sequence of a given ntree T. For any j > 1 the root branch of vj in is the branch of vj containing vU. Note that there is no root branch for vj. Proposition 3.3.16 Let (vi, v2,. .. v,) E S be the vertex sequence set of a given ntree T. For any 1 < j < n, if vj+i A(vj), then vj is an end vertex. Proof If vj+l V A(vj) for some 1 < j < n, then vj has a unique edge with a vertex, vi, with i < j by Proposition 3.3.7. That is, d(vj) = 1. Therefore vj is an end vertex. L Proposition 3.3.17 Let (vi,v2,. . ,vn) S be a vertex sequence set of a given ntree T. For any 1 < j < n there is an integer jm such that {Vl,U2, ...,vj} U {Vjm,vjm+i,...,vn} is the vertex set of the root branch of vj. Proof Let 1 < j < n and d(vj) = m. Then, by Proposition 3.3.10, there exist m different vertices, vi,vj,,vj2,... ,vjm_ such that A(vj) = {vi,vjl,vj2,.... vii} with i < < < j (u=l B(vj, vj,)) = (,vjl ,..., ). That is, the union of all the subbranches of vj except the root branch is a section from vj, to Vji. Therefore the set of vertices in the root branch is {v1, v2,... vj}U {VJm,Vj.m+l, ..,vn}. IL Note that, if jm > n, then the root branch is {V1, v,..., vj}. Corollary 3.3.18 Let = (V1, v2,. . vn) E S be the vertex sequence set of a given ntree T. Let j 54 1. Then d(vj) = 1, that is, vj is an end vertex of T, if and only if the set of vertices of the root branch of vj is V(T) = {v1, v2, ... Vn} Proposition 3.3.19 Let = (v1, v2,... ,vn) be a vertex sequence of a given n tree T. For any vertex vj with j > 1 the (vi,vj)path in T is a subsequence of (Vi, V2, .. vj) . Proof For any vertex vj with j > 1 there is a unique vertex Vkp with kp < j such that vj E A(vkp). For the vertex vkp there is another unique vertex vkp_, with kp1 < kp such that Vkp C A(vkpi). Then we will have that v, is the unique adjacent vertex of a previous vertex Vk,. Therefore the (vi, vj)path is a subsequence (vi,vkI,...,vk_,vkfp,vj) of (vl,v2,...,Vj). L Proposition 3.3.20 For any two vertex sequences S, and s2 in the vvertex se quence set S, = {s E SIV1 = v} the root branch vertex sets of a vertex x :A v, = v in s1 and in s2 are same. Proof Let S1 = (vi, v2, . ,v,n) and g2 = (ui,u2,..., Un) be two different vertex sequences of a given tree T with v, = ul. Let x be an arbitrary vertex in T with x =A v1. Then there are two integers k and I such that Vk = x = ul. Let A(x) = {xi,x2,... ,xm1,y}. Since T is a tree, there is a unique (vi,x)path in T. Then one of the elements of A(x) is in the (vi, x)path. Without loss of generality, let y be in the (vi, x)path. From the proof of Proposition 3.3.17 we have that (U j'=B'(x,x,)) = (u 'B'(vk,xp)) = (Vk+l, Vk+2,. . ,Vk+r} and (U=1 B'(x,xp)) = (Um='B'(ul,xp)) = (U+i,UL+2,. . ,UI+r) for some r. Therefore we have that {Vl,V 2,...,Vk} U {Vk+r+l,..., Vn} = {u1,U2,..., U} U {Iu+r+l,..., n}. That is, the root branch vertex sets of x in g, and in 2 are same. _ Example 3.3.21 Let T be an 8tree as shown below. v w p q r s t U Figure 33 Clearly, s = (q,r,s,t,u,w,v,p), S2 = (q,p,r,s,w,t,u,v) 5r = {f E Siv1 = q}. Let (vi,v2,...,v8) = Then the root branch vertex set of s is {p,q,r,v}. That is, {p, q,r, v} = {q,r} U {v,p} = {vi,v2} U {v7,v8} and {p,q,r,v} = {q,p,r} U {v} = {u1,u2,u3} U {us}. Therefore the root branch vertex sets are same but the position might be different. On the other hand, d(w) = 1 and the unique adjacent vertex of w = V6 is s = v3. Thus s = V3 is in the root branch of w = v6. Therefore the root branch vertex set of w = v6 is {vi,v2,v3,v4,V5, v6} U {v, v8} = {vi, v2,..., V8s} = {q,r,s,t,u,w,v,p}. That is, the root branch vertex set of an end vertex is V(T) itself. 3.4 Degree Sequence In this section, we define the degree sequence of a vertex sequence. Definition 3.4.1 Let S be the vertex sequence set of an ntree T. For any ver tex sequence = (V1,V2,. .,V n) E S, we call Di = (dl,d2,.. .,dn) the degree se quence of where d, = d(vi) and di = d(vi) 1 for i > 2. We call the set D = {Djl. E S} the degree sequence set of S. And, for any vertex v E V, we call DV = {DjsA E S,} C D the vdegree sequence set of S,. For any section (B(vj, vj,)) = (vj, vj,,vj,,+,...,vj,+_i) of A, formed by the (vj,vj,)branch vertex set B(vj,vj,), we define Bd(vj,vj,) = {dj,djdj,+i,...,dj,+1_i} as the (vj,vj,) branch degree setwhere dk = d(vk) 1 for k = j, ji, j +1, .. ,ji+ 1. And we define the (vj, vj.)branch degree section by (Bd(vj, vj,)) = (dj, dj,, dj,+1, . dj,+ I) which is denoted by (Bd(vj,)) if there is no confusion. In the same way as in Definition 3.3.1, we define (Bd'(vj,)) = (Bd'(vj,vj,)) = (djdj,+...,dj+i1) Example 3.4.2 Occasionally, it may happen that there are two or more vertex se quences of a given tree with the same degree sequence. In the following example, there are several pairs of vertex sequences with the same degree sequences, respectively. q p r .5 Figure 34 Since there are 5 vertices in V(T), there are exactly 5! different sequences of vertices of T having length 5 and using each vertex only once. But only 16 of them satisfy the condition (*) in Definition 3.3.4. Therefore the vertex sequence set, S, of the given tree, T, consists of the following sequences i = (p,r,q,s,t), s = (r,p,q,s,t), 813 = (s,r,p,q,t) , 2 = (p,r,s,t,q), s8 = (r,p,s,t,q), s4 = (s,r,q,p,t), S3= (q,r,p,s,t), 9 = (r,q,p,s,t), s15 = (s,t,r,p,q), S4 = (q,r,s,t,p), Sio= (r,q,s,t,p), s6 = (s,t,r,q,p), i5 = (t,s,r,p,q), S3i = (r,s,t,p,q), 46 = (t,s,r,q,p), s32 = (r,s,t,q,p). Then the degree sequences of these vertex sequences are D, = (1,2,0,1,0), D, = (3,0,0,1,0), D.i3 = (2,2,0,0,0), Dj = (1,2,1,0,0), D, = (3,0,1,0,0), Dsj, = (2,2,0,0,0), D3 =(1,2,0,1,0), D9 =(3,0,0,1,0), Dsj5 =(2,0,2,0,0), = (1,2,1,0,0), D,,0 = (3,0,1,0,0), D,6 = (2,0,2,0,0), S=(1,1,2,0,0), Dh =(3,1,0,0,0), D =(1,1,2,0,0), D,2 =(3,1,0,0,0). Now we have that Dj = D3, D, = Di4, D5, = D4, D,, = Ds, Di, = D8l0, Dqs = D82, Dsi3 = Di4, Ds15 = Dai6. That is, for some different vertex sequences, the degree sequences might be same. And, if the degree sequences are same, then the trees denoted by these degree se quences are isomorphic. Remark: The sum of the terms in any degree sequence of a given ntree is the same, namely, n 1. It is 4 in the above example, and it is same as the number of edges in the tree. See Theorem 3.4.6 below. Since d, = d(vi) and d, = d(vi) 1 for i = 2, 3,..., n, we have the following proposition. Proposition 3.4.3 Let Di = (d,d2,. . ,dn) be a degree sequence of a vertex se quence s of an ntree T. Then 0 < di < n1, and 0 < di < n1 for i= 2,..., n. Proposition 3.4.4 If dj 5 0 for any 1 < j < n, then vj+l is an adjacent vertex of vj. Proposition 3.4.5 Let = (v1,v2,..., Vn) be a vertex sequence of an ntree T and Ds = (di,d2,. ..,dn) the degree sequence of A. For any j E {1,2,...,n 1} with dj = m > 1, if the set {vj+1, Vj+2,..., Vk} is the collection of all the vjsubbranches except the root subbranch, then k > j + m. Proof Since dj = m = d(vj) 1, from Proposition 3.3.10, the vertex vj has m subbranches besides the root subbranch. Thus there are at least mrn endvertices in the collection of those subbranches other than the root branch. Therefore at least m terms in (dj,dj+1,...,dk) are 0. Hence k > j + m. . Theorem 3.4.6 (First Reduced Degree Sum Formula) For any degree sequence Di = (dl,d2,..., dn) of a vertex sequence A E S of a given ntree T we have Z1 di = n l = \E and d + E2(d 1)= 0. Proof d, is the degree of a vertex, and the remaining n 1 terms are each one less than the degree of a vertex. By the degree sum formula (Proposition 3.2.7), it is n true that Ei=1 d(vi) = 2\E\. So nn j=1 di = d + Ei=2 di = d(vi) i Z,=2 (d(vi) 1) ^+ En En = d(vi) + Ei=2 d(v) Ei=2 1 =(d(vi) + =2 d(v)) ( 1) = d(vi) (n ) = 21E (n 1) =2(n 1) (n 1) =n 1= E. Then we have that d, + En2(d 1) d, + En2 E=21 iE=(l =d+ i=2d i=21 =Eni=1 di (n 1) =(ni)(ni) 0. Corollary 3.4.7 For any degree sequence, Dj = (d1d2, ...,dn) of a vertex sequence A E S of a given ntree T, we have d + ,=2, dO(di 1) = E 2, d,=0 1. Proof From the first reduced degree sum formula we have that d1+Ei=2(d1) = 0. Then 0 = d + E=2(d 1) = d1 + Ei=2, do(di 1) + E=2, d,=0(d 1) = d + Ei=2, do(di 1) + Ei=2, d,=O(1) = d + Ei=2, d,0(di 1) Ei=2, d=o 1. Thus we get the result. I Note that di > 0 for any i = 1,2,...,n. So di 1 < 0 if and only if di = 0. Corollary 3.4.7 shows that, in a degree sequence D (di, d2,..., dn), the total number of 0 terms is the same as di + S"=2 (di 1). Therefore there are exactly di:O di + En=2 d,0(di 1) endvertices in the given tree. Because of this, we have the following proposition. Proposition 3.4.8 For any degree sequence Ds = (dl,d2,...,dn) of a vertex se quence A E S of a given ntree T, we have dj + Ez=2(d 1) # o for every 1 < q < n. Proof Assume that there is q < n such that di + EZ 2(d 1) = 0. Since D = (dl,d2, ...,dn) is a degree sequence of a vertex sequence s E S of the given ntree T, we have that vq+1 A(vp) for some p < q. Thus at least one of the endvertices counted by Vp is one of Vq+l,Vq+2,... ,Vn. That is, in the section (d1, d2,. . dq), q (i 1), that is, we have at least one less 0 terms than di + Ei=2, dO(di ) a is d + q (i_1) _ =2 1 q1 d + Ei=2, dO(dj i) 2 d,=O  Then 0 =d+E?=2(d 1) d q+Z (di )+Z2 =O(d? 1) = d + EL:2, d0i ( d 1) + E?2, d,=o( 1) = d + EL2, d4o(di 1) + E d=o() i=2, di i=2, d,=O(' >1. This is a contradiction. Therefore we have di + E2(di 1) 5 0 for every 1 < q < n.  Theorem 3.4.9 (Second Reduced Degree Sum Formula) Let T = (V,E) be an ntree. Let Ds = (d1,d2,...,dn) be the degree sequence of a vertex sequence A E S of the given ntree T. For any jk > 1, let B'(vj,) = {Vj,Vjk+I,...,Vjk+11} be a (vj, vjk)subbranch vertex set. Then we have dj + (di 1)=0 dk+..i=jk+l  and djk + EZ=+l(di 1) 5 0 for every jk < q < jk+I. Proof Let E(B'(vjk)) = {{u,v} E E(T)ju, v E B'(v,k)}. Then T(vj,) = (B'(vjk),E(B'(vjk))) c T is also a tree, and (B'(vjk)) = (VjkVjk+l,... ,Vj+,l_) is a vertex sequence of the tree T(vjk). Note that d(vjk) = dj +1 in T. Since vj B'(vjk), the edge {V, Vjk} is not in the edge set E(B'(vjk)). Thus we have that d(vjk) = dj, in the subtree T(vJk). Then the result comes from the first reduced degree sum formula (Theorem 3.4.6) and Proposition 3.4.8. 1l Corollary 3.4.10 Let A = (V1,V2,...,v,,) be a vertex sequence of an ntree T and Ds = (d,d2,. . ,d,d) the degree sequence of s. For any dj > 0, if the subsequence (vj, v+l,... vp) is the collection of all the vjbranches except the root subbranch of vj, then dj + E +(d 1)= 0 and d3 +E=j,+l(di 1) 0 for every j < q < p. Proof For j = 1, they are true by the first reduced degree sum formula (Theorem 3.4.6) and Proposition 3.4.8. Let j > 1 and vj E A(vt) for some t Thus the root branch is the whole tree by Corollary 3.3.18. Therefore (vj) is the collection of all the vjbranches except the root subbranch and dj + EZ=j+ (d 1) = dj = 0. (ii) If dj > 0, then the subsequence (vj, vj+l,..., vp) which is the collection of all the vjbranches except the root subbranch, is the (vt, vj)subbranch, since vj E A(vt). By the previous theorem, we get dj + E=j+l (di 1) = 0. Thus the collection of all the vjbranches except the root subbranch of vj is the (vt, vj)subbranch. Therefore, by the second reduced degree sum formula, we get dj + Eq+( 1) 0 or every +~ +1 d 1) jf 0 for every j < q < p. Not all of the nonnegative integer sequences with n entries can be a vertex sequence of an ntree. There is a condition to being a degree sequence of an ntree. Definition 3.4.11 Let D = (dl,d2,..,d, ) be a nonnegative integer sequence. We say that D satisfies the degree sequence condition, briefly DSC, if and only if it satisfies all of the following: (a) di > 0. (b) E', di = n 1. (c) For any j < n with dj = m > 0, there are exactly m + 1 integers, j < ji = J+l (d) For any jk with dj = I > 0, there are exactly + 1 integers, jk < JkA = ik +1< k2 < ... < Jk, < Jk(,+1) = Jk+1 such that d ,P+ Ej+)l(d 1) 0 for p = 1,2,..., 1. Theorem 3.4.12 Let D = (,dl ,..., dn) be a nonnegative integer sequence. Then D is a degree sequence of a vertex sequence of an ntree if and only if D satisfies DSC. Proof [=] This follows from Proposition 3.4.3, Theorem 3.4.6 and Theorem 3.4.9. [=] Let V = {v1,v2,... ,v,} be a set of n different vertices. Let D = (di, d2,.. .,dn) be a nonnegative integer sequence satisfying the above conditions. Since d, > 0 and di > 0 for any i = 2,3,..., n, we can assign the degree of each vertex vi E V by d(vi) = d, and d(vu) = di + 1 for i = 2,3,...,n. Let j < n and dj = m > 0. From (c), there are exactly m + 1 integers, j < j1 < J2 < ... < jm < jm+i, such that ji = j + 1, and dj, + EZij+(di 1) = 0 for k = 1,2,...,m. Now we assign an edge between vj and vj, for k = 1,2,...,m. That is, vjk E A(vj) for i = 1,2, ...,m. (i) If djk = > 0, we assign an edge between vjk and vjk for p = 1,2,...,1 by (d). We do a similar procedure for each vertex, vj, assigned to dj > 0. Therefore vj, C A(vj) and vjP EA(vj,) for k= 1,2,...,m, j= 1,2,...,l. (ii) If dj, = 0, then we do not assign any new edge for the vertex vi,. But it is already joined to the vertex vj by an edge. Let s = (vi, v2,..., vn). Then all the vertices in s are connected. Since each vertex vi is assigned di new edges and >F>' di = n 1 from (b), we have n vertices and n 1 edges. Then the set of all the edges assigned above, together with the vertex set V, forms an ntree by Proposition 3.2.6. 1 Remark: The proof of Theorem 3.4.12 shows how to construct a tree that corre spond to the given degree sequence satisfying DSC. Example 3.4.13 Let D = (3,2,3,1,0,0,0,1,0,2,0,0, 0) be a nonnegative integer sequence having 13 entries. Let V = {V1, v2,..., vn,} be a set of n different vertices. V9 Y12 V13 V8 V7 VlO V1 V2 V3 V4 V5 Vl1 V6 Figure 35 (a) Clearly, Ei31 di = 12 and d, = 3 > 0. So we expect a 13tree. (b) Since d(vi) = 3, there are 4 different integers, 1 < 11 = 2 < 12 = 10 < 13 = 13 < 14 = 14, such that d2+Ei=3(j1) = 2+(2+0111+01) = 0, d0io + E =11(di 1) = 2 + (1 1) = 0, and d13 = 0. We assign edges between v, and each of v2, V10, v13. (c) (i) Since v2 = 2, there 3 different integers, 2 < 3 < 8 < 10, such that d3 + Si=4(d i1) = 3+(01 1 1)=0, and d8+(d91) = 11 =0. Weassign edges between v2 and each of v3 and vs. (ii) Since v0io = 2, there are 3 different integers, 10 < 11 < 12 < 13, such that dll = 0 and d12 = 0. We assign edges between vl0 and each of vll and v12. (iii) Since v13 = 0, we do not assign any new edge for v13. But the vertex v13 is connected to vi by an edge. In a similar way, we get {v3, v4}, {v3, v6}, {v3, V7}, {Vs, vg}, and {v4, v5}. Let E be the collection of all the edges above, that is, E = {{vi, V2}, {Vi, V0io}, {Vi, V13}, {V2, V3}, {vJ2, V8}, {Vio0, V1}, {v10, V12}, {v3, v4}, {v3, v6}, {v3, v7}, {v8, v9}, {v4, v5}}. Since the edge set E contains 12 elements, the set T = {V, E} is a 13tree. 3.5 Perfect Sequence and Main Theorem In the previous section, we showed that, for a given ntree T, there exist many vertex sequences depending on the starting vertex and choice among the adjacent vertices for each successive vertex. Therefore the degree sequence set D for the given tree T contains many different degree sequences which denote the same tree T. We need a way to choose one degree sequence representing the tree T. First of all we want to define an order on the set of all finite, nonnegative, integer sequences. Definition 3.5.1 For any two finite nonnegative integer sequences D = (Pl, P2, ..., IPk) and E = (ql, q2,..., qi), D < E if and only if either there is m < min{k, l} such that pm Proposition 3.5.2 Let D be the set of all degree sequences of an ntree. The degree sequence set, (D, <), is a totally ordered finite set. Proof For any two different degree sequences the order defined above is well defined. Since each term di of a degree sequence is nonnegative and less than n and the length of each degree sequence is n, the degree sequence set D is a finite set. Thus (D, <) is a totally ordered finite set. I Definition 3.5.3 For a given ntree T, let S be the vertex sequence set of T and D the degree sequence set of T. Then the maximum degree sequence in D is called the perfect sequence of the given tree T, and it is denoted by pf(T). For the perfect sequence, pf(T), of a given tree, T, there is a vertex sequence s = (V1i, v2, ..., Vn) E S such that the degree sequence of A is pf(T). We call A a perfect vertex sequence of the tree and v, a perfect vertex of the tree. In the Example 3.4.2, the perfect sequence is (3,1,0,0, 0) and there are two different perfect vertex sequences, s\ = (r, s, t, p, q) and 412 = (r,s,t,q,p) for it. But the trees represented by snl and s12 are isomorphic. For any given tree the perfect sequence is unique by Proposition 3.5.2. But there may exist several different perfect vertex sequences. If the given tree is a labeled tree, then these perfect vertex sequences denote different labeled trees. But these labeled trees are isomorphic to each other; that is, there is a unique unlabeled tree. Therefore, for a given perfect sequence, there exists a unique unlabeled tree. Theorem 3.5.4 Let dj be the perfect sequence of a tree T. If T' is any other tree whose perfect sequence is also dj, then T' is isomorphic to T. Proof If T has more than one vertex sequence with the same degree sequence, then these vertex sequences all produce the isomorphic trees, by using the construction in the proof of Theorem 3.4.12. 1 Because of this theorem, we have our main theorem below. Theorem 3.5.5 (Tree Classification Theorem) For any positive integer n, let T(n) be the set of unlabeled ntrees and P(n) the set of perfect sequences of ntrees. Then there is a onetoone correspondence between T(n) and P(n). 3.6 Obtaining Perfect Sequences By Theorem 3.5.5, if we can construct the set of perfect sequences of ntrees, P(n), without being given any tree shape, then we can classify all the ntrees by this set. And, in the same way as in Example 3.4.13, we can get the different tree shapes from the elements of P(n). Proposition 3.6.1 For the perfect vertex vl of a perfect vertex sequence A = (vlV2,...,vn), we have d(vi) > d(vi) for i = 2,3,...,n. Proof If there is some k {2,3,...,n} such that d(vk) > d(vi), then D = (d(vi),...) < D, = (d(vk),...) for any vertex sequence = (Vk,...). This contra dicts the maximality of Dj. _ Proposition 3.6.2 If D = (dj, d2, ..., d) is the perfect sequence of a given ntree T, then n 1 > dl > di > dn = O forany i=2,3,...,n1. Proof Since T is an ntree and Ds is the perfect sequence, we have n 1 > dl. For any vertex u E V(T) we have d(vi) > d(u) by Proposition 3.6.1. Since di = d(vi) and di = d(vi) 1 for every 1 < i < n, we have d, > cdi for 1 < i Therefore we have di > dn = 0 for every 1 < i < n 1. l Definition 3.6.3 Let D = (di, d2,..., d) be a degree sequence. Then we say that D satisfies the ordered subbranch condition, denoted OSbC, if and only if D satisfies the following condition for all j> 1 : If d(vj) = m + 1 > 2, and B'(vj,), B'(vj2), ..., B'(vj) with j < ji < j2 < S m< JM are the subbranches of the vertex vj other than the root subbranch, then (Bd'(vjk,,)) > (Bd'(vjk+l)) for every k = 1,2,...,m 1. Recall that (Bd'(vj,)) is a section of the degree sequence D. (See Definition 3.3.3 and 3.4.1.) Remark : If j = 1, then there is no root branch of vi; instead, there is one more subbranch, Bd'(Vjm+,), such that jm < jm+1 and (B'(vjm)) > (Bd'(vj,,)). Theorem 3.6.4 Let D = (dj, d2,... dn) be a nonnegative integer sequence. If D is the perfect sequence of an ntree, then it satisfies the DSC and the OSbC. Proof It is clear from Theorem 3.4.12 and the maximality of D. I Proposition 3.6.5 Let T be a tree and v a vertex with the largest degree in T. Then there is exactly one degree sequence D, for T starting at v and satisfying both DSC and the OSbC. By the above proposition, the converse of Theorem 3.6.4 is not true. The following example is a counterexample. Example 3.6.6 Let A = (dj,d2,...,d12) = (3,2,2,1,0,0,2,0,0,1,0,0). Then Z'i di = 11 and d, = 3 > 0. And the sequence A can be separated into 4 sections like (3), (2,2,1,0,0,2,0,0), (1,0), (0). The second section can be sep arated into 3 sections, (2), (2,1,0,0), (2,0,0), and the second and third sec tion of these can be separated by (2), (1,0), (0) and (2), (0), (0), respec tively. All of these subsections satisfy the second and third conditions of DSC. Thus the sequence A satisfies the DSC. That is, the sequence A is a degree se quence of a vertex sequence (Vi, v2, ... v12) of a 12tree by Theorem 3.4.12. On the other hand, the sequence A satisfies the OSbC, since we have (2,2,1,0,0,2,0,0) > (1,0) > (0). But A is not the perfect sequence of the 12tree. In fact, we rearrange the sequence A to get B = (dr + 1,d2, d 1, dio, dn,d12,d3, d4, d5,d6, ds, d9) = (3,2,2,1,0,0,2,1,0,0,0,0). Note that d(vi) = d, and d(v7) = d7 + 1. Clearly the sequence B also satisfies the DSC and the OSbC. So B is also a degree sequence of another vertex sequence (V7, v2, v1, V10, v11, V12, v3, v4, v5, v6, V8, vg) of the 12tree. That is, A and B are degree sequences of the same 12tree (see Figure 36). And we have B= (3,2,2,1,0,0,2, 1,0,0,0,0) > (3,2,2, 1,0,0,2,0,0,1,0,0) = A. Thus A is not the perfect sequence. Furthermore A cannot be the perfect sequence of any tree, because A and B denote isomorphic trees, and B > A. V11 V10 V1 V12 V9 V2 V7 V8 V5 V4 V3 V6 Figure 36 In this example we have that d(vi) = 3 = d(v7) which is the largest degree in the tree. That is, the perfect sequence must start with the largest degree. We will see in Example 3.6.8 that the degree sequence B is the perfect sequence of this tree. Note that (1, 0) is the only possible degree sequence when d, = 1. Therefore we assume d, > 1 from now on. Now we show how to construct alternate degree sequences from A, similar to B. Assume that we have a nonnegative integer sequence A = (di,d2,... ,d.) satisfying the DSC and the OSbC. If there is 1 < i < n such that d, < di, then A cannot be the perfect sequence of any tree by Proposition 3.6.2. So we assume that d, > di for i = 2,3,... ,n, and there is at least one integer 1 < j < n such that dj = cd 1. That is, there is an ntree T = (V, E) such that A is a degree sequence of a vertex sequence A = (V1, V2,... V,v) of T, and T has at least two vertices of maximum degree dl. Clearly, dj > 0. Thus vj is not an end vertex in T. By Corollary 3.3.18, the set of the vertices of the root branch of vj is not the set of vertices in A itself. So, from Proposition 3.3.17 there is j < m < n such that RB(vj) = {Vi,V2,...,vj} U {Vm+i,Vm+2,. ..,Vn} is the set of the vertices of the root branch of vj. Clearly, (Vj+i,Vj+2,... ,Vm) is the section containing all of the subbranches of vj except the root branch. Therefore, if dj = p, then there are p subsections of A like (Bd'(vj,)) > (Bd'(vj,)) > ... > (Bd'(vj,)) with j < ji < j.2 <... < jp < m+1, since A satisfies OSbC. On the other hand, let E(RB'(vj)) = {{u,v} E E(T)ju,v E RB'(vj)} be the set of edges in the root subbranch of vj. Then T' = {RB'(vj),E(RB'(vj))} is a subtree of T. Let S(T') be the vertex sequence set of T'. By Proposition 3.3.7, there is a unique integer 1 < k < j such that Vk E A(v,). Clearly, vk E RB'(vj). Let Svk(T') be the vkvertex sequence set of S(T'), in which the first term of each vertex sequence is vk. Let Dvk(T') be the vkdegree sequence set of Svk(T') (see Definition 3.4.1). Since Dv,(T') is a finite set, there is a maximum sequence in Dk (T'). We denote the maximum sequence in Dvk (T') by mdR(vk). Note that d, must be changed to d, 1 in mdR(vk), since it is not going to be used for the first term anymore in the new degree sequence. Now we have that either mdR(vk) > (Bd'(vj,)), or there is an integer 1 < q < p such that (Bd'(vjq)) > mdR(vk) > (Bd'(vjq,+)). Note that mdR(vk) may be the smallest section, then vjq1 would not exist. We rearrange the given degree sequence A to a new sequence in which dj + 1 is the first term and the subbranch degree sequences of vj, mdR(vk), (Bd'(vj,)) (Bd'(vj2)) ..., (Bd'(vj)), are listed in descending order. Denote this new degree sequence by MA. Since the subbranch degree sequences of vj are listed in descending order in MA the new degree sequence MA satisfies the OSbC. Since MA is a rearrangement of A with di =d(vj) =dj+l1 >0, d, = d(vi) 1 = di 1 for some i> 1, and A satisfies the DSC, the new degree sequence MA satisfies the conditions (a) and (b) of the definition of the DSC. Since mdR(vk) is the perfect sequence of T', it satisfies the conditions (c) and (d) of the definition of the DSC. Clearly, each section, (Bd'(vj,)), satisfies the conditions (c) and (d) of the definition of the DSC. Therefore the new degree sequence MA satisfies the DSC. Thus the new degree sequence MA V) Vi satisfies both the DSC and the OSbC. For the given nonnegative integer sequence A = (dj, d2, ... ,dn), the set {M\Id(vj) = d(vi)} is a nonempty finite set, since A E {MAId(vj) = d(vl)}. Therefore there is a maximum element in this set. Let PA = max{ MA d(vj) = d(vi)}. Now A determines a unique tree T. Suppose B is another vertex sequence for T satisfying the DSC and the OSbC. Then {.1'Id(vq) = d(vi)} = {M d(v) = d(vI), where Vq is an analogue of vj, by Proposition 3.6.5. Therefore PA is the perfect sequence for T. By the above explanation together with Proposition 3.6.2 and Theorem 3.4.12, we have the following theorem. Theorem 3.6.7 Let A = (di, d2,. ., d,) be a nonnegative integer sequence satisfy ing the DSC and the OSbC with di > d, for i = 2,3,...,n. Then A = PA if and only if A is the perfect sequence of an ntree. In the following example, we show the degree sequence B in Example 3.6.6 is the perfect sequence of the tree. Example 3.6.8 In Example 3.6.6, A= (dl,d2,...,d12) =(3,2,2,1,0,0,2,0,0,1,0,0) satisfies the DSC and the OSbC and d2 = d3 = d7 = di 1. That is, d(v2) = d(v3) = d(v7) = d(vi). Thus max{MAIj = 2,3, 7} is the perfect sequence of the tree. For v7 we have that RB(v7) = {v1, v2, .. ,v7} U {vo10, V11, V12} and (Bd'(vs)) = (0) = (Bd'(v9g)). Thus T' = {RB'(v7),E(RB'(vr)} is the subtree produced by the root subbranch of Vy. (See Figure 37.) Since v7 C A(v2), we get the vrvertex sequence set Sv,(T') = { (v2,Vi,v1OV11,V12,v3,v4,v5, v6) (v2, Vl, v10, v11, v12, v3, v6, v4, v5) (v2, Vi, v12, Vlo, 11, v3, v4, V5s, v6) (v2, Vl, V12, Vlo, vii, V3, v6, v4, V5) (v2, v3, v4, V5, v6, V1, Vio, vii, v12) (v2, V3, V4, v5, v6, V1, V12, v10, vii) (v2, v3, V6, v4, v5, V1, vio, Vll, v12), (V2, v3, v6, V4, V5, Vl, V12, vo, V11) }. Then the v7degree sequence set of S,,(T') is D,7(T') ={ (2,2,1,0,0,2,1,0,0), (2,2,1,0,0,2,0,1,0), (2,2,0,1,0,2,1,0,0), (2,2,0,1,0,2,0,1,0) , (2,2,1,0,0,2,1,0,0), (2,2,1,0,0,2,0,1,0), (2,2,0,1,0,2,1,0,0), (2,2,0,1,0,2,0,1,0) } = { (2,2,1,0,0,2,1,0,0), (2,2,1,0,0,2,0,1,0), (2,2,0,1,0,2,1,0,0), (2,2,0,1,0,2,0,1,0) }. Therefore we have the maximum sequence mdR(v7) in D, (T') as mdR(v7) = (2,2,1,0,0,2,1,0,0). Since mdR(vr) = (2,2,1,0,0,2,1,0,0) > (0) = (Bd'(vs)) = (Bd'(v9)), we have MA = (3,2,2,1,0,0,2,1,0,0,0,0). In the same way, we get MA = (3,2,1,0,0,2,1,0,0,2,0,0) MV3 =(3,2,2,1,0,0,2,0,0,1,0,0). Therefore max{Mt,,j = 2,3,7} = M17. Since MA =(3,2,2,1,0,0,2,1,0,0,0,0) > (3,2,2,1,0,0,2,00,0,1,0,0) = A, M4, which is B in the Example 3.6.6, is the perfect sequence of the tree. VlI VIO V1 V12 V2 V5 V4 V3 V6 Figure 37 By the Tree Classification Theorem (Theorem 3.5.5) and the previous example, we have the following important corollary. Corollary 3.6.9 Let A = (d, d2,. .., dn) be a nonnegative integer sequence satis fying the DSC and the OSbC. If d, 1 > di for every i = 2,3,..., n, then A is the perfect sequence for an ntree. We will see in the following example how we construct a tree shape from a given maximal degree sequence. Example 3.6.10 Let D = (di, d2,..., d0io) = (3,2,1,2,0,0,1,0,0,0) be a maximal degree sequence. Then we expect a 10tree, T. Let s = (V1, v2,... vio) be the vertex sequence having D as the degree sequence. Then d(vi) = d, = 3, so the vertex v, has 3 edges. (See Figure 38.) Though there is no specific order for these edges, we label them as eC, e2, e3 for the convenience of explanation. e2 e3 V1 el Figure 38 From the definition of vertex sequence (Definition 3.3.4) v2 is one of the elements of the adjacent set of v1, A(vl). Without loss of generality, let el = {vI,v2}. Then v2 has 2 'new' edges, e4 and e5, since d2 = 2. Let e4 = {v2,v3}. By the same reasoning, v3 has 1 'new' edge, named e6. So e6 = {v3, v4}. Since d4 = 2, V4 has 2 'new' edges, named e7 and e8. (See Figure 39.) e2 e5 e8 e3 V1 el V2 e4 V3 e6 v4 e7 Figure 39 Since d5 = 0 and d6 = 0, neither v5 nor v6 has a 'new' edge; that is, V5 and V6 are end vertices. On the other hand, v5 and v6 are the adjacent vertices of v4, since d4 = 2. Thus V7 is an adjacent vertex of one of {vi,v2,v3}. Since d3 = 1 and v4 is the adjacent vertex of v3, v3 is not an adjacent vertex of v7. Since d2= 2 and we have only one adjacent vertex of v2, namely 1V3, we add an adjacent vertex, v7. (See Figure 310.) V7 V6 C2 C5 e8 e3 v, e1 V2 e4 v3 e6 V4 e7 V5 Figure 310 Since d7 = 1, v7 has 1 'new' edge which connects with v8. Since d8 = 0, there is no 'new' edge from V8. Since we covered up to d2, the remaining two vertices, v9 and v0io, are adjacent vertices of v, which has two 'unused' edges, e2 and e3. Let e2 = {v1, v9}, and e3 = {vi, vIo}. Since we are thinking about an unlabeled tree and we put the edge names for our convenience, there are no specific names for the vertices and edges. Thus we get the following 10tree. (See Figure 311.) (V8) (V9) ()(V6) (Vio) (V1) (V2) (V3) (V4) (V5) Figure 311 3.7 Extended Partitions and the Algorithm In Definition 3.5.3 and the following explanation, it was shown that any tree can be represented by a unique perfect sequence. So, in this section, we develop an algorithm to produce all the perfect sequences for the ntrees for any positive integer n. From these perfect sequences, we get the shape of each ntree as shown in the previous example, as well as the total number of ntrees. From Definition 3.4.1 and the First Reduced Degree Sum Formula (Theorem 3.4.6), we see that a degree sequence for an (n + 1)tree always has n + 1 nonnegative integers as entries and these integers always add up to n which is the number of the edges of the given (n + 1)tree. Thus, our first step in listing all possible degree sequences is to form ordered partitions of the integer n as sums of smaller positive integers. Definition 3.7.1 An ordered partition of the positive integer n is a sequence of positive integers, (pi,P2,... ,Pm) such that E=1 pi = n. Note that 1 < m < n in the definition above. Definition 3.7.2 An extended partition of an ordered partition (p1,p2,. ,Pm) of the positive integer n is a sequence of n + 1 nonnegative integers, (di, d2,..., ,n+) such that (i) di = pi, E+1 di = n, and (ii) there is a subsequence (dj, dj2,..., dim) such that djk = Pk for k = 1,...,m. Note that any entry di in the extended partition must be 0 unless it is a member of the ordered partition. It is important that different extended partitions are produced not only by the different ordered partitions but can also be produced by the same ordered partition. For example, let (di,d2,... dn+,i) and (di,d,.... ,dn+i) be two extended partitions of an ordered partition (pi,p2,. ..,Pm), and let (djl, dj2,... ,dj,,) and dl, d'2,... ,d'm) be subsequences, respectively, such that djl = d = =i = d\t and djk =Pk = dt, for k = 2,3,... ,m. Assume that j, $ ti for at least one i. Then there are sections of zeros with different lengths between d(kl) and dj, and d' and d' respectively. So the extended partitions are different. Thus the order is very important in an extended partition. Also note that the length of the extended partition of n must be n + 1. So, for any given ordered partition, (p, P2,... ,Pm), we need to add n m + 1 zeros to make an extended partition. Proposition 3.7.3 Let (dj, d2,... ,dn+,) be an extended partition of an ordered partition P = (djl,dj2,... ,djm) of the integer n. Then this extended partition sat isfies the First Reduced Degree Sum Formula (Theorem 3.4.6). Proof From the given extended partition (di, d2,... dn+i) of an ordered partition Ei"+l di dilJ, =n and (dj dj2,..., d.,) of the integer n, we have that Z 1i = = n and i + d ( n+1 ~ i+ l2(d 1) d + Ek=2(dik 1) + ELi=, di.P(di 1) since d1 5 0 d= d+ Ek=2(dJ 1) + E 1, dp(d, 1) + n+1 = EiM_ d3k + E + E+ 2+=1, d p(1) = n + (m 1)(l) + (n m + 1)(l), =nm+ln+m 1=0.I Even though we have a very large number of extended partitions of n, some of them can not be a maximal degree sequence for an (n + 1)tree. So we first eliminate some ordered partitions that could not possibly result in maximal degree sequences. To do so, we need to check some properties of perfect sequences. Proposition 3.7.4 Let Ds = (d1,d2,... ,dn+) be the perfect sequence of a given (n + 1)tree T. If di, 0 and di+1 = 0, then 0 = di+1 = di+2 = ... = di+d,. Proof Since di, 0, the vertex vi has di 'new' edges; that is, there are di adjacent vertices of vi and they are labeled by d, consecutive integers after i. Since Di is a perfect sequence, it satisfies the OSbC. That is, the vertex vi+1 is a vertex of the largest degree among the adjacent vertices of vi. But di+1 = 0. Therefore we have dj =0 for j = i + 2, i + 3,..., i + di. . This proposition gives us a method to make an extended partition from an ordered partition by adding zeros. That is, we know certain extended partitions cannot be perfect sequences just by checking this property. Proposition 3.7.5 Let Di = (dl, d2,. ., dn+) be the perfect sequence of a given (n + 1)tree T. If n > 2, then d > 2. Proof If d, = 1, then di = 0 for every i = 2,3,... ,n + 1 by Proposition 3.6.2. Since n > 2, there are at least 3 vertices in T. Thus we have that di+1.=(di1) = 1_+21(1) < 1+(11) = 1 0. This is a contradiction to the First Reduced Degree Sum Formula. Therefore d, > 2. 1_ According to the above proposition, the only trees whose perfect sequences start with 0 or 1 are the tree with zero edge and the tree with one edge. The only degree sequence representation of a tree with zero edge is (0), and the only degree sequence representation of a tree with one edge is (1,0). These are easy enough to visualize and count, so for the algorithm we work on the assumption that we are listing trees with at least two edges. Then the first term of the perfect sequence will be at least 2. The following proposition shows that we have an arc shape tree if the first term of the perfect sequence is 2. Proposition 3.7.6 If Di = (dia, d2,..., dn+) is the perfect sequence of an (n+ l1)tree T and d, =2, then di = 1 for i = 2,3,...,n 1 and d4 = dn+, =0. Proof By Proposition 3.6.2 we have that di, E {0, 1} for any i = 2,3,... ,n + 1, since di = 2. Then the possible highest degree in T is degree 2. So T is just a linear tree with n edges. That is, there are exactly two end vertices which cannot be v1. Therefore there are exactly two zeros in the sequence. Write a degree sequence for T, in the order of the vertices in the following figure.    .  Vn+l Vi V2 V3 Vn1 Vn Figure 312 That is, start at a vertex adjacent to an end vertex and move in the longer direction first. Clearly the degree sequence resulting from this method contains the two zeros for vn and Vn+l. Then we will get a degree sequence of the form D = (2, 1,1,..., 1,0,0). For the same tree, the numbers in a degree sequence cannot change, but only the order in which they occur can change by changing the position of zeros. And, clearly, the new ordered sequence < D. So the sequence D must be the perfect sequence of T. That is, Di = D. I Most of the extended partitions of n start with a 1 or a 2. Since the last two propositions classify trees whose degree sequences start with these values, we do not need to consider ordered partitions that start with 1 or 2. Proposition 3.7.6 shows that for any given number n of edges there is only one tree with n edges whose perfect sequence starts with a 2. In particular, it is a linear tree with n edges, since d, = 1 for i = 2, 3,..., n 1. We add this sequence at the end of the algorithm. By Proposition 3.6.2, we do not need the ordered partitions in which the largest summand appears more than once or is not the first term in the ordered partition. If an ordered partition has either one or two entries only, then we can produce only one extended partition for each case. See the following Proposition 3.7.7 and Corollary 3.7.8. Proposition 3.7.7 Let D = (dl, d2,..., dn+) be the perfect sequence of an (n+l) tree T with d2 = 0. Then d, =n and d, = 0 for all i > 1. Proof: Let A be a vertex sequence yielding a perfect sequence Ds of an (n + 1) tree T. Since Ds is a perfect sequence and 0 = d2 = d(v2) 1, all of the vertices in the tree other than vi have degree 1, so all the terms in D, other than d, must be zero. By the First Reduced Degree Sum Formula (Theorem 3.4.6), we have d, = n. 1_ Corollary 3.7.8 If an ordered partition P = (pl,p2) of n has only two entries, then the produced extended partition, (di, d2,... ,dn+1), from P is such that d, = p1, d2 =p2 and di = 0 for i = 3,4,...,n + 1. We demonstrated several necessary conditions which apply to a perfect se quence of a tree. Unfortunately, while these conditions are sufficient in almost all cases, there are certain sequences which, although they satisfy all the conditions, are not perfect sequences of the trees they represent. The problems usually arise when the tree has two or more vertices of the largest degree. We saw a counterexample in Example 3.6.6. Note that in the Example 3.6.6 the two degree sequences A and B have the same ordered partition, P = (3,2,2,1,2,1). That is, our algorithm produces the degree sequence B as one of the extended partitions of the ordered partition P. Therefore all we need to do is just drop the degree sequence A from the result of our algorithm. Each step described so far has involved checking each member of a list of possible degree sequences and removing those which could not be the perfect sequence of a tree. The last step is no exception. Given a degree sequence, we check if there is more than one vertex of maximal degree. If there are more than one (in Example 3.6.6, both vertices v, and v7 = u1 have the same degree, 3), we write degree sequences for the tree starting at each such vertex. If the largest of these with respect to the ordering < is the sequence we are checking, then it is a perfect sequence. If some other vertex gives a larger degree sequence, it is false that the sequence we are checking is a perfect sequence. This is a surefire approach in that, given a degree sequence, it checks for a perfect sequence by considering every possible alternative for the maximum and seeing if the sequence in hand is the largest. CHAPTER 4 TREES AS INVARIANTS FOR BRAIN TUMOR SHAPES 4.1 Introduction A sphere packing treatment plan for a given brain tumor is produced in the first chapter. This plan can be represented numerically as a list of parameters of the dose spheres. In particular, the list consists of the coordinates of the dose center in millimeters along the lateral (Lat), anteriorposterior (AP), and axial (Ax) axes together with the radius of the dose sphere in millimeters. From these data, we can assign a unique corresponding graph by matching a sphere with a vertex and matching the adjacency of two spheres with an edge. Then, by using the notion of cutvertex, we give an order to the vertex set. We use this order to decide which edges to choose in order to obtain a unique maximal tree contained in the graph. Our main theorem of this section is Theorem 4.5.6: The perfect sequences are invariants of the shapes of arbitrary brain tumors. We then develop a Mathematica program (see Appendix B) to get a maximal tree of the graph for a sphere packing plan for a given brain tumor. In the near future, we plan to use this program to classify all the treatment plans which have been done at the Brain Institute of the University of Florida. We hope that the classification gives some insight about brain tumor shapes. In this chapter, we assume that a brain tumor is connected, so the graph representation for any brain tumor is a connected graph. 4.2 Definitions and Some Properties Definition 4.2.1 A graph G = (V(G),E(G)) consists of a vertex set V(G) = {Vi,.. .,vn} and an edge set E(G) = {ei,...,em} C {{u,v}lu,v E V(G)} in which each edge is an unordered pair of two distinct vertices u and v, and the edge {u, v} is said to join u and v. For an edge {u, v} we say that u and v are adjacent vertices and the vertex u and the edge {u, v} are incident with each other, as are v and {u,v}. From now on, IV(G)I denotes the number of vertices and jE(G)j denotes the number of edges. For a vertex u V(G), the vertex set AG(u) = {v E Gjv is an adjacent vertex of u} is called the adjacent set of u in G. Since there is no loop represented by a single edge, in a graph in this article, no vertex is adjacent to itself. Definition 4.2.2 We say that a graph G is isomorphic to a graph H if and only if there exists a bijection f: V(G) * V(H) such that {u, v} C E(G) if and only if {f(u),f(v)} I (H). Definition 4.2.3 A walk is an alternating sequence (vo, el, vi, e2,..., ek, Vk) of ver tices and edges s.t. vi1 J vi for i = 1,2,... ,k, and ei = {vii,vi} for every i. A cycle is a walk (vo, el,v1, e2,..., ek, Vk) with k > 3 in which v0 = vk is the only vertex repeated. A path is a walk with no repeated vertex. A (u,v)path is a path with the first vertex u and the last vertex v. A (u,u)path is a vertex u. The length of the (u,v)path, l(u, v), is the number of edges in the (u,v)path. So the length of (u,u)path is 0. The distance d(u,v) between two vertices u and v is the length of a shortest path joining them, if any; otherwise d(u, v) = oo. Note that a path of length > 1 is of linear shape. Definition 4.2.4 Let G = (V, E) be a graph where V = {vi,v2,...,v"n}. Then, for any vertex v E V, we say that PG(v) = j if and only if j = min{i {1,2,..., n}I there is a (v, vi)path in G}. We call Pc(v) the pathvalue, or simply the Pvalue of the vertex v in G. Definition 4.2.5 Let G = (V, E) be a graph. For any nonempth subset V' C V, let F = { {u,v} E E I u,v E V } C E. For any subset F' of F, the graph G' = (V', F') is called a subgraph of G. A graph G is connected if and only if every pair of vertices are joined by a path. A graph having no cycle is acyclic. Note that an acyclic graph can be disconnected. A forest is an acyclic graph. A tree is a connected acyclic graph. An ntree is a tree with n vertices. Definition 4.2.6 The degree of a vertex v, denoted by d(v), is the sum of the number of edges incident with v. Definition 4.2.7 A cutvertex of a graph is a vertex of degree greater than 2, whose removal increases the number of components of the graph. Definition 4.2.8 A nonseparable graph is connected, nontrivial, and has no cutver tex. A block of a graph is a maximal nonseparable subgraph. Thus if v is a cutvertex of a connected graph G, then G v is disconnected. Note that the traditional definition of cutvertex (usually called cutpoint in graph theory) does not have the degree condition. But we do not want to separate any linear shape subgraph into several blocks because there is no difficulty in handling linear shape subgraphs in our algorithm. Thus we do not call a vertex with degree 2, a cutvertex in this chapter, even though it separates the graph. And if H is a block, then none of the vertices in H is a cutvertex of H. Note that if there is no cutvertex in G, then the graph G itself is a block. This definition differs from the definition of block in Harary [5], because we have a different definition of cutvertex. Because of this, we have Proposition 4.2.10 below. Proposition 4.2.9 If a graph G is of linear shape, then the maximal tree of G is G itself. Proposition 4.2.10 [5] Let v be a vertex of a connected graph G. The following statements are equivalent: (1) v separates G and d(v) > 2. (2) There exist vertices u and w distinct from v such that v is on every (u,w) path. (3) There exists a partition of the set of vertices V(G) {v} into subsets U and W such that for any vertices u E U and w W, the vertex v is on every (u, w)path. Definition 4.2.11 Let G = {V, E} be a graph. For any vertex v E V we define the edge subset IG(v) C E(G) by IaG(v) = {{v,u} E E(G)I u E AG(v)}. We call IG(v) the incident edge set of v in G. Clearly, Ia(v) contains all the incident edges of the vertex v in G. Definition 4.2.12 Let G = {V, E} be a graph. For any subset F of E we call the set V(F) = {v E V(G)I there is an edge e E F such that v and e are incident} the F vertex set. Proposition 4.2.13 [5] The following statements are equivalent for a graph T: (1) T is a tree. (2) Every two vertices of T are joined by a unique path. (3) T is connected and IV(T)I = IE(T)I + 1. (4) T is acyclic and JV(T)J = JE(T) + 1. Note that if a tree has n vertices, then there are exactly n 1 edges. Definition 4.2.14 Let G = {V, E} be a connected graph and E' a subset of E. A connected subgraph T = {V, E'} is called a maximal tree of G if and only if T'= {V, E'U {e}} contains a cycle for any edge e E E E'. Our work in this chapter produces a particular maximal tree for any given graph. So we have the following (wellknown) theorem. Theorem 4.2.15 Every connected graph has a maximal tree. 63 Example 4.2.16 Let G be a graph with 14 vertices and 18 edges as in the figure 41 below. a b c d e f Figure 41 There are 3 cutvertices, b, c, e. So the given graph G can be separated into 6 blocks as follows: G1 ={Vi,Ei}={{a,b }, {{a,b}}}, G2 = {V2, E2} = { { b,c, k, ,m,n }, { {b,c}, {c, k}, {k, {, m}, {mn}, {rn, b}, {b, k}, {k, m} } }, G3 ={V3,E3}={{c,d,e}, {{c,d},{d,e}}}, G4 = {V4, E4} = { { e,f,g }, { {e,f},{f,g},{g,e} } }, G5 = {V5,E5} = { { e,h,i }, { {e,h},{h,i} } }, and G6 ={V6, E6}={{e,j }, {{e,j}}}. a b b c d e G3 9 e f G4 Figure 42 4.3 Graphs for Sphere Packing Plans The sphere packing treatment plan S having n spheres for a given brain tu mor, from Chapter 1, consists of the centers, c1, c2,..., cn, and the radii, ri, r2,..., r., of the spheres with ci = (xi, yi, zi) for every i, where x, is for the AP coordinate, y, is for the Lat coordinate and zi is for the Ax coordinate of the center, ci. (Note that the physicians use diameters, rather than radii, in their data sets.) We consider the spheres to be the vertices of a graph, and we assign the vertex, vi, for the sphere centered at ci with radius ri. Now we can assign an edge between two vertices if the spheres assigned by these two vertices meet. In Chapter 1, we noted that the collimators do not deliver clear cut boundaries for spheresthere is some spillover. The neurosurgeons currently assume that the portion between two spheres gets enough dosage of radiation if the distance between the centers of the two spheres is less than or equal to eleven tenths of the sum of the radii of the two spheres. Thus for any two vertices assigned for two spheres satisfying this condition we assign an edge between them. Then we have the following proposition. Proposition 4.3.1 Let G = {V,E} be a graph for the sphere packing plan of a brain tumor. For any vertices vi and vj in V, d(ci,cj) < (ri + r) if and only if {vi, vj} E E. Thus we have the following edge set; E = {{i,j}Id(ci, cj) < (ll/10)(ri + rj) where i < j, i = 1,2,...,n 1}. Since any brain tumor is connected in this article, there is at least one (u, v) path in G for every two vertices, u and v in G. Thus we have the following propo sition. Proposition 4.3.2 The graph G = {V, E} produced by the above method for a given tumor is a connected graph. Since we are dealing with unlabeled graphs in this article, we have the following proposition. Proposition 4.3.3 For any sphere packing treatment plan for a given brain tumor, there exists a unique graph that we assign to the treatment plan. By means of the above method, we get a unique connected graph G = {V, E} for the sphere packing treatment plan for the tumor. This graph does not have the information about the positions of the dose spheres as an aspect of the structure and looks only at how the spheres are attached. It is clear that the graph G does not have a loop or multiple edges between two vertices, since every edge is assigned for two different vertices which are assigned for two attached spheres. 4.4 Order in the Vertex Set To get a maximal tree from a graph we may need to delete some edges in the graph. Thus we need to label each vertex in order to choose certain edges to delete, even though we are dealing with an unlabeled graph in this chapter. So there is no specific meaning for this labeling except that it is only used to choose a maximal tree for the graph. Example 4.4.1 Let P be the sphere packing treatment plan (see Figure 43) for a given brain tumor. Figure 43 Then, by Proposition 4.3.3, there is a unique graph G for the sphere packing plan. The graph is given below in Figure 44. p  s Figure 44 There are two different isomorphism classes, namely T1 and T2, of maximal trees for the graph G. That is, we could choose either of these for a maximal tree to assign the graph G. Since, in our algorithm, we want to get the same maximal tree for a given graph every time, we need certain rules to get the same tree. (See Figure 45.) T, T Figure 45 In this chapter, the graph comes from a sphere packing treatment plan. That is, the main shape of the brain tumor depends on the size of spheres and the connection between spheres. Even though we cannot keep the information about the size of spheres in the graph, it seems to us that the bigger the sphere is, the more it has a chance to get attached to more spheres. So we assume that the larger degree vertices play a more important role in classifying the tumor shapes into trees than the smaller degree vertices. That is, by choosing a largest degree vertex first, the shape of the tumor is apparently most closely preserved. Thus, in the previous example, we choose the vertex q or s as the starting vertex; then we pick all the incident edges. Then we get the tree T1. Therefore we want to choose the tree T1 for the maximal tree of G. Note that the tree T2 produces a linear graph which does not show the shape of the tumor as closely as T1. But there are some vertices which are more important than the bigger degree vertices. Recall the graph G in Example 4.2.16. Then, in the block G2, it is clear that the vertex k has the largest degree, 5. But the cutvertices, b and c, play a critical role in obtaining a maximal tree of G. So, to get a maximal tree for a graph G, we want to start at the cutvertices of G first, instead of the vertices with the largest degree. So we want to label the cutvertices first. On the other hand, there 67 are different kinds of 'cutvertices' in some graphs. The following example shows such a case. Example 4.4.2 Let G = {V, E} be the graph in Figure 46. U3 Figure 46 Then there are two cutvertices of the graph G, namely u2 and uj0. Us ing these two cutvertices, the graph G is separated into four subgraphs, namely G1, G2, G3 and G4. (See Figure 47.) 1 G2 "II*10 U3 G3 U1 U2 U2 U9 U10 UIO/ \ U U2 Figure 47 Then the subgraphs G1, G2, and G3 are blocks, but the subgraph G4 con tains its own cutvertices, u4 and u8, which are not cutvertices of the graph G. We separate the subgraph G4 into four subgraphs by using its cutvertices u4 and us. (See Figure 48.) Note that there is no specific order in labeling the subgraphs. So at this moment, we relabel the subgraphs of G by H1, H2, ..., H7. U9 H2 U10 U10 / \ UU0 U8 u3 //H 5 H1 / / H4 U2 U2 U2 U4 U8 U5 ___ u U7 H6 u6 H7  U5 U4 U4 Figure 48 Then, again, the subgraphs H1, H2, ..., H6 are blocks, but the subgraph H7 contains its own cutvertex, u6, which is neither a cutvertex of the graph G nor a cutvertex of the subgraph G4. We separate this subgraph H7 into two subgraphs by using U6. (See Figure 49.) And we relabel the subgraphs of G by B1, B2, ..., B8. Therefore {u2, u10} is the set of cutvertices of the graph G. But {u4, us} is the set of the cutvertices of a subgraph which is produced after the first separation using the cutvertices of the graph, and u6 is the cutvertex of a subgraph which is produced after the second separation. For the purpose of labeling the vertices in a graph, we separate these cutvertex sets for different levels, from each other. Definition 4.4.3 Let G be the graph assigned for a given sphere packing plan P. Then the vertex set V(G) of the graph G is the union of two disjoint subsets, namely CI(G) and Cc(G), where Ci(G) = {v V(G)I v is a cutvertex of G} 69 and Cc(G) = V(G) CI(G). We call C,(G) the first step cutvertex set of G. For every i = 2,3,..., IV(G)I, we define a subset Ci(G) of CcI(G) as the collection of the vertices of Cc I(G), which are cutvertices of a subgraph produced after the (i 1)th separation using the elements of Cii(G). Then we call C1(G) the ith step cutvertex set of G, and let C.(G) = Cic(G) Ci(G). We assume that there are finitely many vertices in a given graph. If there exists at least one cutvertex, then there exists an integer 1 < k < n such that Ci(G) 54 0 for every i < k, and Ci(G) = 0 for every i > k + 1. Then we call k the separation step constant of the graph G, and let Cc(G) = (Ck)c(G). If there is no cutvertex of G separation step constant of G is 0. B2 u10 U11 U3 U1 U2 U8 B6 then the graph is a block, and we say that the tU4 Figure 49. U9 U10 U8 B5 B4 U2 U4 U7 U6  U5 Proposition 4.4.4 Let JV(G)j = n and let the separation step constant of G be k > 0. Then there is a sequence of integers {ml,m2,...,mk} with 0 < mn1 < m2 < ... < rnk such that 1CI(G)I = mi, and \Ci(G)j = mi, min1, for i = 2,3,...,k. ^, Proof Since k > 0, the first step cutvertex set Ci(G) is not empty. Thus there is a positive integer, namely mi, such that ICi(G) = mi. For every i = 2,3,...,k, let mi = mi1 + C1(G). For every i = 2,3,... k, the ith step cutvertex set Ci(G) is not empty. So we have that mi > mi1, and ICi(G) = mi mi,. I Now we label the vertices as follows; (1) the vertices in Ci(G) are labeled by {1,2,...,mI}, (2) for every i = 2,3,..., k, the vertices in Ci(G) are labeled by {mii + 1, mii + 2,...,mi 1,mi}, and (3) the vertices in CC(G) are labeled by {mk + 1, mk + 2,..., n}. We arbitrarily name the vertices of Ci(G) and CC(G), and denote that CI(G) = {Ui,U2,...,Uml}, Ci(G) = {Um,_i+I,Um,_i+2,...,Um,} for i = 2,3,...,k, and CC(G) = {Umk+1,Umk+2, ... ,Un}. It is clear that for every vertex up E Ci(G) and every vertex Uq E Cj(G) with i $ j, we have that p < q if and only if i < j. And also, for every vertex up E Ci(G) for every i = 1,2,... k, and every vertex Uq E Cc(G), we have that p < q. Assume that, for every vertex ui, the center and the radius of the sphere which is assigned to that vertex ui, are ci = {xi, yi, zi} and ri, respectively. We now relabel the elements for each of the sets, C1(G), C2(G),..., Ck(G) and CC(G), in the following way: for every pair of vertices, ui, uj, in one of CI(G),C2(G),... ,Ck(G) and Cc(G), i < j if and only if (i) d(ui) > d(uj); or (ii) If d(ui) = d(uj), then r, > rj; or (ii) If d(ui) = d(uj) and r, = rj, then xi < xj; or (iii) If d(ui) = d(uj), ri = rj, and x, = xj, then yi < yj; or (iv) If d(ui) = d(uj), r = rj, x, = xj, and y = yj, then zi It is clear that for any two different spheres, at least one of the coordinates is different. Thus any two distinct spheres can always be compared by the above order. Therefore the above order for the vertices of the graph is well defined. 4.5 Maximal Tree from a Graph In this section, we develop an algorithm that will uniquely select a maximal tree from the graph which is produced for a given brain tumor. The choice is made so that the tree will most closely resemble, in our opinion, the shape of the tumor  that is, of the graph obtained for the tumor. Let G = (V, E) be the graph for a given sphere packing plan. Let V(G) = {u1, u2,..., uI. for some positive integer n, where all the vertices in V are labeled by the method in the previous section. Define a subgraph To = (V(G),Fo) with V(To) = V = V(G) and F0 = 0; that is, there is no edge in To. Then, for every i = 1, 2,... ,n, we have that PTo(ui) = i. (See Definition 4.2.4.) (1) For the vertex ul, let F1 = F0 U IG(ul). (See Definition 4.2.11.) Let T1 = (V(G), F1). The subgraph (V(F1), F1) C T1 is a tree. Thus, if V(F1) = V(G), then T, = (V(G), F1) = (V(F1), F1) is our maximal tree of G. Note that for every vertex v E V(F1) we have that PTi (v) = 1, and for every vertex u, V V(F1), we have that PT, (Uj) = J. (2) Assume that V(F1) 5 V(G). For the vertex u2, there are two cases, that is, PTi (u2) = 1 and PT1(U2) = 2. Now define the edge subset I'(u2) by I(u2) = IG(U2) {{u2,v} V E\ PT1(v) = 1)}. (a) If PT (u2) = 1, that is, there is a (ui,u2)path in the subgraph T1, then let F2 = FiUIG(u2). Each edge in these {{u2, v} El PT, (v) 1}= {{u2, v} E Ely E V(F1)} makes a cycle with {u1,u2} and {ui, V}, since PT, (U2) = 1. Thus there is no cycle in the subgraph (V(F2),F2), so it is a tree. Let T2 = (V(G),F2) C G. If V(F2) = V(G), then T2 = (V(G),F2) = (V(F2),F2) is our maximal tree of G. Note that for every vertex v E V(F2) we have that PT2(V) = 1, and for every vertex uj 3 V(F2) we have that PT2(Uj)= j. (b) If PTi(u2) = 2, then there is no (Ul,U2)path in the subgraph T1. (i) If there is a nonempty subset {u21,, U22,... U2} C V(IG(u2)) where PT1(U2,) =1 for i = 1,2,...,t and 2i <2j for l {{u2,u21}}. Then the subgraph (V(F2),F2) C G is a tree. Let T2 = (V(G),F2) C G. If V(F2) = V(G), then T2 = (V(G),F2) = (V(F2),F2) is our maximal tree of G. Note that for every vertex v E V(F2) we have that PT2(v) = 1, and for every vertex uj g V(F2) we have that PT2(Uj) = j. (ii) If none of the vertices in V(IG(u2)) has pvalue 1, that is, for every vertex v E V(IaG(u2)) there is no (ul,v)path, then let F2 = F1 U IG(u2). Since PT,(w) = 1 for every vertex w E F1 and PT, (v) = 2 for every vertex v E IG(U2), the subgraph (V(F2), F2) is a forest, but not a tree. Let T2 = (V(G),F2) C G. It is clear that the subgraph T2 cannot be our maximal tree, even if we have that V(F2) = V(G), because the subgraph T2 is disconnected. Note that for every vertex v E V(F2) = V(F1 U IG(U2)) = V(F1) U V(Io(u2)) we have that PT2(v) = 1 if v E V(F1), and PT2(v) = 2 if v E V(IG(u2)). And, for every vertex uj V(F2), we have that PT2(UJ) j. (3) By induction, at the jth step, the subgraph Tj_j = (V(G),Fji) has been defined. We want to define the subgraph Tj C G. For the vertex uj, there are two cases, that is, PT,_(uj) = j and PT,_I(uj) = q for some 1 < q < j. For every i = 1,2,..., n, define mj_(i) = min{l {1,2,... ,n}PT_,(ul) = i and ul E AG(u) }. If the set {l E {1,2,...,n}juj E V(IG(uj)) and PT,_(ui) = i } is empty, then the vertex u,_,,_(i) is not defined. So there is no edge {uj,Um,_(i)}. (a) Let PT, (uj) = ; that is, for every i = 1,2,... ,j 1,j + 1,...,n, there is no (uj,,ui)path in the subgraph Tji = (V(G), Fji). Let Fj = Fj, U (U={ {uj,um ,(i)} }) Then the subgraph (V(F,),Fj) is a forest. Let Tj = (V(G), F,) C G. If V(F,) = V(G) and IV(Fj)l = iFj + 1, then, by Proposition 4.2.13, the subgraph Tj = (V(G), F,) = (V(F,), F,) is our maximal tree of G. (b) Let PT,_(uj) = q for some 1 < q < j, that is, there is a (uq,Uj)path in the subgraph Tj, = (V(G), Fji). Now let Fj = Fj1 U (U'1, ,iq{ {U,,Uj _,(i)}}) Then the subgraph (V(Fj), F) is a forest. Let T, = (V(G),Fj) C G. If V(Fj) = V(G) and IV(Fj)t = IFj + 1, then by Proposition 4.2.13, the subgraph Tj = (V(G), Fj) = (V(F,), Fj) is our maximal tree of G. Note that if u is an ith step cutvertex, then d(u) in G is same as d(u) in Ti. Also note that, for every i = 1,2,...,n, {uiu2,...,ui} C V(Fi), that is, V(G) = V(Fn). We will see in Theorem 4.5.3 that Tn = (V(G), Fn) = (V(Fn),F") is our maximal tree of G. By the Tree Classification Theorem (Theorem 3.6.8), this tree Tn can be denoted by a unique perfect sequence. Example 4.5.1 Let G = (V,E) be a graph where V = {u,u2,.. .,u8}, which are ordered as in the previous subsection, and E = {eli e2, ,..., e13} as in the figure below. Clearly, the graph G does not have a cutvertex, so the order is decided by only the sizes of the spheres and the coordinates of the centers of the spheres. us e13 U?7 e2 "U1 U2 C5 U6 Figure 410 Let To = (V(G),Fo) be a subgraph of G = (V,E) where Fo = 0, as shown in Figure 411. U8 U7 U1 0 U U4 U3. **K * Z2 Z6 Figure 411 Since Ia(ul) = {e1,e2}, let F = FoUIG(ul) = {e1,e2}. Then Y(F) = {u1,u5,u7} Since V(Fi) = {u,u5,u7} 5 V(G), the tree (V(F1),F1) is not a maximal tree of G. Let T1 = (V(G), F1) which is shown in Figure 412. Us U7 e2 U1 e6l U30 U4 UU5 Z2 U6 Figure 412 We have that mi(i) = i for i = 1,2,3,4,6, and 8, but mi(5) and m1(7) do not exist. Since PT,(U2)= 2 and Aa(u2) = {u3,u4, u6}, let F2 = F U (U,=3,4,6{{u2,Ui}}) = F1 U IG(U2) = {e, e2} U {e3, e4, e5} = {fe1,e2, e3,e4,e5}. Then V(F2) = {ui,u5,U7,U2,uu 4,U6U} $ V(G) and the subgraph (V(F2),F2) is a forest, not a tree. Thus it cannot be a maximal tree of G. Let T2 = (V(G), F2). (See Figure 413.) U8 U7 62 U1 U4 /e U3\4 U5 e3 6e4 U2 65 U6 Figure 413 Note that PT(Ul) = PT2(U) = PT2(U)= 1, PT2(U2) = PT2(U3) = PT2(U4) = PT2(U6) = 2, and PT2(us) =8. Thus we have that m2(1) = 1,m2(2) = 2, m2(8) = 8. Note that m2(i) does not exist for i = 3,4,5,6, 7. Since ul 0 A(u3) and PT2(U3) = 2, weget F3 = F2U{{u3, us8}} = {el,e2,6 e3,6 e4, e5, e7}. Since the subgraph (V(F3),F3) is a forest, but not a tree, it is not a maximal tree of G. Define T3 = (V(G), F3). (See Figure 414.) U8 U7 2 U1 67 61 U3 63 64 U2 6e5 U6 Figure 414 Note that PT3(UI) PT3(US) = PT3(U7) = 1 and PT3(U2) = PT3(U3) = PT3(U4) = PT3(U6) = PT3(Us) = 2. Thus we have that m3(1) = 5 and m3(2) = 4. Note that mr3(i) does not exist for i = 3,4,..., 8. Since PT3(U4) = 2, we define F4 = F3 U {{U4, U5}} = {61,6e2,6 e3,6 e4,6 e5,6 e7, e68}. Since V(F4) = {v1,v2,...,vs} = V(G) and IV(F4) = 8 = IF41 + 1, the subgraph T = (V(F4), F4) is a maximal tree of G. (See Figure 415.) US U7 e2 U1 e7 el U4 U3 5 U2 e5 U6 Figure 415 At this moment, we have that PT(Ul) = PT( 2) = ...= PT(us) = 1. Then, for every ut V(G) with t > 4, we have that Ft = F4. Thus, for every t > 4, the subgraph (V(Ft), Ft) is same as T = (V(F4), F4). The next example shows how we get the maximal tree for a given graph containing some cutvertices. Example 4.5.2 Let G be the graph in Example 4.2.16. (See Figure 41.) Then CI(G) = {b,c,e} and Cc (G) = {a,d,f,g,h,i,j,k,l,m,n}. In Ci(G), we have that d(e) = 5, d(b) = 4 and d(c) = 3. On the other hand, in Cc(G), we have that d(k) = 5, d(m) = d(n) = 3, d(d) = d(f) = d(g) = d(h) = d(l) = 2, d(a) = d(i) = d(j) = 1. And C2 = 0. Thus we order the vertices as follows; vI = e, v2 = b, v3 = c and v4 = k, {v5s,v6} = {m,n}, {v7,v8,v9,Vo,vll} = {d,f,g,h,l}, {v12,v13, v14} = {a,i,j}. Assume that vs = m, v6 = n, v7 = d, V8 = f, v9 = g, vio = h, vi = 1, v12 = a, vi13 = i, v14 = j, which are decided by the sizes and centers of the corresponding spheres. (See Figure 416.) V5 V11 V13 V6" V4 Vl0 / V9 V12 V2 V3 V7 V1 V8 Figure 416 Since IG(v) = { {v= v}, {v1, vs}, {v1, v9}, {v1, vio}, {v1, v14} }, let F1 = IG(v1). Then V(F1) = {vI,v7, v8, V9, Vio, V14}. Since V(F1) V(G), the tree T1 = (V(G),F1) is not a maximal tree of G. Thus, for the cutvertex vi, we have the following sub graph which is T1 = (V(G),F1). (See Figure 417.) * V4l " V4 *12 V2 3 Vl2 V2> V3 V13 V7 V9 V1 V8 V14 Figure 417 Since PT,(v2) = 2, and, for every vertex v E AG(v2) = {v3, v4, V6, v12}, PTi(V) 7 1, let F2 = F1 U Ia(v2). The subgraph (V(F2), F2) is a forest, but not a tree. Thus it cannot be a maximal tree of G. Now, for the cutvertex v2, we have the following subgraph which is T2 = (V(G), F2). (See Figure 418.) * VUll 2 V6 V3 V12 V2 V3 V10 V7 Figure 418 V9 V1 V8 V14 Since AG(v3) = {v2, v4, v7}, PT (V2) = PT2(V4) = 2 = PT2(V3), and PT2(v7) = 1, let F3 = F2 U {{v3, V7}}. Then, for the cutvertex v3, we have the following subgraph which is (V(F3),F3). Then the subgraph (V(F3), F3) is a tree. But V(F3) 5 V(G). Thus it cannot be a maximal tree of G. We have the following subgraph which is T3= (V(G),F3). (See Figure 419.) . Vll V12 V2 V3 V7 Vi V8 Figure 419 Since AaG(v4) {v V2, v3,V5, v6, V11}, and PT3(V2) = PT,(V3) = PT 3(V6) 1 = PT3(V4),PT3(V) =5,PT3(vn) 11, we define F4 = F3 U {{v4, V5}} U {{V4, v11}}. Then the subgraph (V(F4), F4) is a tree. But V(F4) 5 V(G). Thus it cannot be a maximal tree of G. Then, for the cutvertex v4, we have that the following subgraph which is T4 = (V(G), F4). (See Figure 420.) V5 V11 V13. V6 V4 V10 V9 V12 V2 V3 V7 V1 V8 V14 Figure 420 For the vertices vs, v6, v7, vs, v9, there is no 'new' edge. Thus we get the same sub graph as above, that is, T4 = T5 = T6 = T7 = T = Tg. But, for the cutver tex vl0, we have that v13 e V(IG(vlo)) and PT,(V13) = 13 $ 1 = PT9(vio). Thus F10o = F9 U { {vIo,v 13 } and V(Flo) = V(G). Therefore we have the following sub graph which is T = (V(G), Flo) = (V(Flo), Flo). (See Figure 421.) V5 V11 V13 V6' V4 Vo1 V9 V12 V2 V3 V7 V1l V8 SV14 Figure 421 Clearly, the subgraph T = (V(F1o), Fo10) does not include a cycle. Thus it is a max imal tree of G. That is, for every t = 11, 12,13,14, we have that (V(Ft), Ft) = (V(Flo), Flo). Therefore, the subgraph T = (V(F1o),Flo) = (V(G), Fio) is the max imal tree of the graph G. For this resulting tree T = (V(F1o),Flo), choose a vertex sequence s by s = (V,V7,V3,v2,V4,V5, Vi,V6,v12,Vlo,V13,Vs,V9,V14). Then the sequence P = (5,1,1,3,2,0,0,0,0,1,0,0,0,0) is the degree sequence of A. By Theorem 3.4.12, P satisfies DSC. It is clear that P also satisfies DSbC. By Corollary 3.6.10, P is the perfect sequence for the tree T = (V(F1o), Fo). Theorem 4.5.3 Let G = {V, E} be a graph for a sphere packing plan where V = {u1, u2,..., un} with the order described in Section 4.4. Let the subgraph (V(Fn),F,) of G come from the above procedure. Then V(F,) = V(G). There fore (V(Fn), Fn) is a maximal tree of G and there is a unique perfect nsequence for the tree (V(F,), F,). Proof The subgraph (V(Fn), Fn) is connected. In fact, assume that the sub graph (V(Fn),Fn) contains two disjoint subtrees, namely T, and T2. Then the pathvalue for every vertex in T1 is different from the pathvalue for every ver tex in T2. Since the graph G is connected, there is at least one edge e E E(G) which connects the two subgraphs T1 and T2 and e V E(T1 U T2) = Fn. Let { {VJl, Vk }, {vj2, Vk2 },. .. {Vjq, Vkq} } be the collection of such edges where vj, E T1 and vkj C T2 for i = 1,2,. ., q. Without loss of generality, let j, < ji for every i = 2,3,..., q. Then it is clear that {vjj, Vk} I Fj1 by the procedure of getting the subgraph (V(Fn), F.). Then {vj,, vk } C F,. This is a contradiction. Therefore the subgraph (V(F,), Fn) is connected. The pathvalue in the procedure of getting the subgraph (V(Fn),Fn) guarantees that the subgraph (V(F,,),Fn) is acyclic. There fore (V(F,), Fn) is a tree. It is clear that, for every i = 1,2,... n, the vertex set V(Fi) contains the vertices u1, u2,...,i u. Thus V(Fn) contains all the vertices of G, since V(Fn) D {u,u2,...,un} =, V(G). That is, V(Fn) = V = V(G). Hence the subgraph (V(F,), F,) is a maximal tree of G. By the Tree Classification The orem (Theorem 3.6.8), it is clear that there is a perfect nsequence for the tree (V(F,), F). I Definition 4.5.4 The tree shape of a brain tumor is the tree corresponding to that tumor, or equivalently, its unique corresponding perfect sequence. Definition 4.5.5 Two tumors have the same shape if and only if their corresponding graphs obtained from their respective sphere packing plans are the same. As in Chapter 2, for any brain tumor, we have a unique sphere packing plan which can be denoted by a graph. From the previous theorem, we have a unique perfect sequence for the graph. That is, we can assign exactly one perfect sequence to each brain tumor. So, if two perfect sequences are distinct, then their corresponding trees, and therefore their respective corresponding graphs and sphere packing, are also distinct. That is, if two tumors are represented by distinct perfect sequences, then their corresponding trees are not isomorphic. And their respective graphs and sphere packing plans are not isomorphic. Thus, we may consider their shapes to be distinct. Therefore we have the following as our main theorem of this section. Theorem 4.5.6 The perfect sequences are invariants of the shapes of arbitrary brain tumors. 4.6 Graph from a Maximal Tree Let T = {V, E'} be a maximal tree for a graph G = {V, E} which is obtained from the sphere packing plan of a given tumor or solid shape. We observe that we can recover the original graph, G, from T. Since V(T) = V = V(G) and E(T) = E' C E = E(G), we need to add the remaining edges to the edge set of the maximal tree to get the graph G. Since the graph G comes from the sphere packing treatment plan, each vertex v in G denotes a sphere of the sphere packing plan. Thus, for every vertex vi E G, let c, = (xi, y1i, zi) and r, be the center and the radius of the sphere. By Proposition 4.3.1, for any two vertices vi and vj in V if d(ci, cj) < (r, + r), then the edge {vi, vj} is in the edge set, E(G), of the graph G. Thus E'U {{vi,vs} E V x VI d(c2,cj) < "(ri +rj)} = E. Therefore we get the graph G = {V, E}. 4.7 Algorithm for Our Maximal Tree Let G = (V, E) be the graph for a sphere packing plan with IV[I = n. STEP A Find all the ith step cutvertices of the graph G, for 1 < i < n. STEP B Label the vertices in the vertex set V by the order explained in Section 4.4. STEP C By induction, for each i = 1,2,...,n, get the subgraph (V(Fi),Fi) of G. Then T = (V(Fn),Fn) is our maximal tree. APPENDIX A SHELLING PROGRAM FOR SPHERE PACKING In this appendix, we provide the C++ program we developed to get the sphere packing plan for a given tumor shape. The first section shows the program translating the data from CT scan to the data of appropriate form for the main program, which is in the second section. Note that this program does not include the score function which was developed by Thomas Wagner. We refer the reader Appendix E for the complete article on the sphere packing treatment plan. A.1 Program for Data Reading // rewrite data file into x,y,z format // & produce the total # of data, x,y,z min & max #include #include #include #include #include main() { const int nofdata=3370; // comes from dataOOS.txt int xposition[nofdata], yposition[nofdata], zposition[nofdata]; int q; float a; float b; float c; int k=0; { ifstream inClientFile("data003.txt", ios::in); while (inClientFile >> a >> b >> c) { xposition[k] = int(floor(a)); // check the number yposition[k] = int(floor(b)); // check the number zposition[k] = int(floor(c)); // check the number k++; } } int xmin=xposition[O]; int xmax=xposition[O]; int ymin=yposition[O]; int ymax=yposition[O]; int zmin=zposition[O]; int zmax=zposition[O]; for (int i=O; i xmin = xposition[i]; 83 else if ( xposition[i] > xmax ) xmax = xposition[i]; else if ( yposition[i] < ymin ) ymin = yposition[i]; else if ( yposition[i] > ymax ) ymax = yposition[i]; else if ( zposition[i] < zmin ) zmin = zposition[i]; else if ( zposition[i] > zmax ) zmax = zposition[i]; } // output the result of centers { ofstream outClientFile("mM003.txt", ios::app); { outClientFile << nofdata << setw(10) << xmin << setw(5) << xmax << setw(5) << ymin << setw(5) << ymax << setw(5) << zmin << setw(5) << zmax << endl; } } cout << nofdata << setw(5) << xmin << setw(5) << xmax << setw(5) << ymin << setw(5) << ymax << setw(5) << zmin << setw(5) << zmax; cin >> q; } A.2 Program for Center Searching // searching the centers for pat 2 #include #include #include #include #include int square(int); // function prototype int MAX(int,int,int); // function prototype main() { const int nofdata=3370; // check the number from mM003.txt const int xmin = 32; // check the number const int xmax = 4; // check the number const int ymin = 29; // check the number const int ymax = 4; // check the number const int zmin = 57; // check the number const int zmax = 37; // check the number const int xfix = 1xmin; const int yfix = 1ymin; const int zfix = 1zmin; int xposition[nofdata], yposition[nofdata], zposition[nofdata]; 84 int q; float a; float b; float c; int k=0; { ifstream inClientFile("dataOO3.txt", los::in); while (inClientFile >> a >> b >> c) { xposition[k] = int(floor(a))+xfix; yposition[k] = int(floor(b))+yfix; zposition[k] = int(floor(c))+zfix; k++; } const int x = max xmin + 3; const int y = ymax ymin + 3; const int z = zmax zmin + 3; const int nc = x*y*z; // number of cells int cc[nc]; // status value for (int i=O; i int xc[nc]; // xcoord. of c[nc] int yc[nc]; // ycoord. of c[nc] int zc[nc]; // zcoord. of c[nc] // setting the x,y,zcoord. for each cell for (int i=O; i xc[i] = floor((izc[i]*y*x)/x); yc[i] = izc[i]*y*xxc[i]*x; } // setting the boundary of tumor by 1 for (int i=O; i } // setting the initial of normal by 0 cc[0] = 0; // setting the normal cell by 0 int h=0; for (int j=O; j { if (cc[i1]==Ol Icc[i+l]==Ol Icc[iy]==Ol Icc[i+y]==0) { cc[i] = 0; h++; } else; } else; if (h==0) break; else h=0; // setting the remaining tumor cell by 2 for (int i=0; i cc[i] = 2; // checking else; // checking } // checking // setting the boundary cells int maxrad; int nofmaxrad; for (int j=O; j<=MAX(x,y,z)/2+l; j++) { int k=0; for (int i=O; i { k++: if ( cc[i1] == j I I I cc[i+y]==j { cc[i] = j+1; nofmaxrad = k; I cc[i+l] ==j 1i cc[iy]==j II cc[iy*x]==j II cc[i+y*x]==j ) else; else; maxrad = j; if (k==0) break; else; Checking the no. of nofmaxrad Sif nofmaxrad > 100, then you have change the number S(nofmaxrad >100) cout << endl << endl << endl << endl << endl << << endl << endl << endl << endl; cin >> q; else; // pick the boxes with maxrad int suprad[100]; int TotalNofBox4[100]; int TotalNofMax=0; for (int i=O; i { suprad[TotalNofMax] =i; TotalNofMax++; } else; } cout << TotalNofMax << endl; cin >> q; // Count for the number of centers of each case for (int k=O; k for (int i=O; i<100; i++) { TotalNofBox4[i] = 0; } TotalNofBox4[maxrad] ++; int tcc[nc]; for (int i = 0; i // remove th< for (int p=O: { int dist if ( dist tcc[p] else; // temporary cell notion ++i) // reassign tcc[i] for 'for' loop a biggest sphere p + square (xc [suprad [k] ]xc [p] ) + square(zc[suprad[k]]zc[p]) )); < maxrad ) = 0; // setting the remaining tumor cell by 2 for (int i=O; i tcc[i] = 2; else; // setting the boundary cells for (int j=O; j<=MAX(x,y,z)/2+l; j++) { int 1=0; for (int i=O; i { if (tcc[i1] == j I I tcc[i+l] ==j II tcc[iy]==j II tcc[i+y]==j II tcc[iy*x]==j II tcc[i+y*x]==j ) { tcc[i] = j+1; ++I; } else; } else; (1==0) break; else; // check if there is more maxrad pixcel for (int i=0; i { cout << endl << endl << endl << WARNING!!! WE HAVE MORE 'MAXRAD' PIXCEL AT (" << xc[i] << "," << yc[i] "," << zc[i] << ")" << endl; cin >> q; break; else; //remove the smaller or = sphere for (int j=maxradl; j>1; j) { for (int i=0; i { TotalNofBox4[j]++; // remove the sphere for (int 1=0; l + square(xc[i] xc[1]) + square(zc[i]zc[l]) )); if ( dist < j ) tcc[l] = 0; else; } // setting the remaining tumor cell by 2 for (int i=0; i tcc[i] = 2; else; } // setting the boundary cells for (int j=0; j<=MAX(x,y,z)/2+l; j++) { int 1=0; for (int i=0; i { if ( tcc[i1] == j II tcc[i+1] ==j  tcc[iy]==j II tcc[i+y]==j II tcc[iy*x]==j II tcc[i+y*x]==j ) { tcc[i] = j+1; ++i; } else; } else; (1==0) break; else; else; output the result of centers ofstream outClientFile("patOO3NofCenters.txt", ios::app); { outClientFile << endl << endl << endl << endl << endl << (k+1) << setw(5) << "(" << (xc[suprad[k]]xfix) << "," << (yc[suprad[k]]yfix) << "," << (zc[suprad[k]]zfix) << ") with radius = << maxrad << endl; for (int j=maxrad; j>l; j) { ofstream outClientFile("patOO3NofCenters.txt", ios::app); { outClientFile << setw(4) << j << setw(4) << TotalNofBox4[j] << endl; // Search for centers for (int k=O; k for (int i = 0; i // output the result of centers { ofstream outClientFile("patOO3centers.txt", ios::app); { outClientFile << (k+1) << endl << setw(5) << "x" << setw(5) << "y" << setw(5) << "z" << setw(10) << "radius" << endl << setw(5) << (xc[suprad[k]]xfix) << setw(5) << (yc[suprad[k]]yfix) << setw(5) << (zc[suprad[k]]zfix) << setw(10) << maxrad << endl; } } // remove the biggest sphere for (int p=O; p + square(xc[suprad[k]]xc[p]) + square(zc[suprad[k]]zc[p]) )); if ( dist < maxrad ) tcc[p] = 0; else; // setting the remaining tumor cell by 2 for (int i=0; i tcc[i] = 2; else; // setting the boundary cells for (int j=O; j<=MAX(x,y,z)/2+l; j++) { int 1=0; for (int i=O; i { if ( tcc[i1] == j II tcc[i+l] ==j I II tcc[i+y]==j II tcc[iy*x]==j II { tcc[i] = j+1; ++i; I tcc[iy]==j tcc[i+y*x]==j ) else; else; } if (1==0) break; else; // check if there is more maxrad pixcel for (int i=O; i { cout << endl << endl << endl << WARNING!!! WE HAVE MORE 'MAXRAD' PIXCEL AT (" << xc[i] "," << yc[i] << "," << zc[i] << ")" << endl; cin >> q; break; } else; } //remove the smaller or = sphere for (int j=maxradl; j>1; j) { for (int i=0; i { TotalNofBox4[j]++; // output the result of centers { ofstream outClientFile("patOO3centers.txt", ios::app); { outClientFile << setw(5) << (xc[i]xfix) << setw(5) <<(yc[i]yfix) << setw(5) << (zc[i]zfix) << setw(10) << j << endl; } // remove the sphere for (int 1=0; l + square (xc [i] xc []l) + square (zc[i]zc[l]) )); if ( dist < j ) tcc[l] = 0; else; } // setting the remaining tumor cell by 2 for (int i=O; i tcc[i] = 2; else; } // setting the boundary cells for (int j=O; j<=MAX(x,y,z)/2+l; j++) { int 1=0; for (int i=O; i { if ( tcc[i1] == j I I tcc[i+1] ==j I I tcc[iy]==j II tcc[i+y]==j II tcc[iy*x]==j I I tcc[i+y*x]==j ) { tcc[i] = j+1; ++i; else; else; else; if (1==o) break; else; } else; } ofstream outClientFile("patOO3centers.txt", ios::app); { outClientFile << endl; int square(int a) { return a*a; } int MAX(int a, int b, int c) { int p=0; p = a; if (a<=b) p = b; else if (a<=c) p = c; else; return p; APPENDIX B PROGRAM FOR THE MAXIMAL TREE OF A GRAPH In this appendix, we provide the Mathematica program we developed in joint work with Matthew Harvey. The program below was written by Matthew Harvey to get the maximal tree for the graph which we assigned for a brain tumor. Note that this program does not use the method of ordering for the vertices as in Chapter 3. Instead this program uses some commands which are in the function package in the Mathematica program library. If anyone wants to develop a program like this using a different program language, we recommend the vertex ordering algorithm in Chapter 3. << DiscreteMath'Combinatorica' Off[General: :spell] LexPrecedes[a_, b_] := Module[{i}, For[i = 1, i <= Min[Length[a], Length[b]], i++, If[ a[[i]] != b[[i]], If[ a[[i]] > b[[i]], Return[True], Return[False] ] ] 1; If[ Length[b] > Length[a], Return[False] 1; Return [True]] DegreePoint[a_, k_] := Count[Flatten[ToUnorderedPairs[a]], k]; IndSubgraph[Graph[g_, v_], s._List] := Module[{i, j, newmat, sc}, newmat = g; sc = Complement[Range[Length[v]], s] ; For[i = 1, i <= Length[g], i++, For[j = I, j <= Length[g], j++, If[MemberQ[sc, i] II MemberQ[sc, j], newmat[[i, j]] = 0]]]; Graph[newmat, v]]; CutPoints[gr_] := Select[ArticulationVertices[gr], DegreePoint[gr, #] > 2 &] NonCutPartitions[gr_] := Module[{partitions, cpts, bccs, skeleton}, partitions = {}; bccs = Select[BiconnectedComponents[gr], Length[#] > 2 &] ; partitions = Union[partitions, bccs]; skeleton = IndSubgraph[gr, Union[ Complement[ Range[V[gr]], Flatten[bccs] ], CutPoints [gr] ] ]; partitions = Union [partitions, Select[ConnectedComponents [ FromUnorderedPairs[ Select[ToUnorderedPairs[ skeleton], # != Intersection[#, Flatten[ Select[BiconnectedComponents[skeleton], Length[#] > 2 &] ] &] ] ], Length[#] > 1 &I ] ; Table[ Select[ ToUnorderedPairs[gr], # == Intersection[ #, partitions[[i]] ] &], {i, Length[partitions]}]] 