#Kayla Gibson #Assignment 23 #OK to Post #FAMILY TREE # I had a lot of fun researching my family tree. This tree is 7 generations and includes 173 of my family members. FamilyNames:=["Julia Anna Heisler", "Charles B Eltrich","Leeila E Rutherford", "William Charles Gleason", "Clyde William Gleason", "Dorothy Eltrich Gleason", "Earl Martin", "Suzanne Martin", "Greg Campbell", "Elizabeth Campbell", "Andrew C Campbell", "Michael Campbell", "Jessica Campbell", "Fred Bickel", "Earl Martin", "Joseph Irwin", "Tex Randal Helton", "Donna C Irwin", "Virginia Helton", "Michael Sutton", "Suzette Sutton", "Roger Dale Doss", "Debra E Doss", "Annie Doss", "Brian Doss", "Roger Doss Jr.", "William M Irwin", "Kim Irwin", "Thomas Irwin", "Arabella Spiers", "John Miller", "Martha E Green", "G. W. Ferguson", "Margaret Ferguson", "Pleasant Clowers", "Sarah Spangler", "Ida Clowers Ferguson", "John W Ferguson", "Mary Miller", "William Irwin", "William Irwin Jr.", "Dorris E Ferguson", "Volna Ann Bailey", "Leslie Ray Irwin", "Joseph L Irwin", "Mary Ellen Irwin", "Calvin May Jones", "Peter J Janney", "Gilley J Maxey", "Wesley Light", "Florence M Light", "Alvin Janney", "Delta Light", "Joseph B Irwin", "Florence Janney", "Thomas Campbell", "Alice Trainer", "Noble Clements", "Bridget Carlin", "William Ferguson", "Margaret J Campbell", "Robert Eaton", "Mary Jane McCallister", "James L Campbell", "Jane F Clements", "James Ferguson", "Sarah Eaton", "Clement Campbell", "Robert Campbell", "William J Campbell", "Martha J Ferguson", "Doris Irwin", "James R Campbell", "Rick Gibson", "Shiela Gibson", "Andrew Gibson", "Raquela Sgro", "Jacob Gibson", "Cade Gibson", "Erin Wilwert", "Luke Wilwert", "Sawyer Wilwert", "Eliza Wilwert", "Penelope Wilwert", "Erica Gibson", "Matthew Gibson", "Angela Hunter", "William Campbell-Irwin", "Michael Gibson", "Mikael Gibson", "Kayla Gibson", "Adam Gibson", "Nickolas Gibson", "Maya Gibson", "Elmer Light", "Opue Light", "Dicie Light", "Isaac Light", "Luther Jannay", "Vesta Jannay", "Lacy E. Aliff", "Dorothy Lyle Aliff", "Mildred C Irwin", "Henry Irwin", "Irva U Ferguson", "Pansy Opal Ferguson", "Amanda Clowers", "Charlie T Ferguson", "Selena Ferguson", "Kathleen Sand", "Patricia Gleason", "Anton Eltrich", "Mary Fischer", "Bernard Eltrich", "Martin Eltrich", "Joseph M Eltrich", "Mary Antonia Eltrich Steffes", "Clara C Eltrich Waldorf", "Fred Eltrich", "Martin L Heisler", "Catherine Meyer", "Josephine Heisler Brick", "Mary J Heisler Hess", "Jacob Heisler", "Johanna M Heisler Gau", "Elnora Heisler Garding", "Henry Leo Heisler", "Alma Heisler","Marcella Eltrich Burrows", "Julietta Roth", "Francis Eltrich", "Martin Eltrich", "Raymond B Eltrich", "Helen Marie Eltrich", "Edward W Rutherford", "Maria Eccles", "Justus E Rutherford", "Maria Belle Rutherford", "Gertrude Rutherford Morris", "Edward W Rutherford", "John Coyle", "Mary Coylen", "Margaret Coyle Rutherford Collins", "Elizabeth Coyle Murphy", "Thomas Collins", "Thomas L Collins", "John Gleason", "Mary Johnston", "Gertrude Gleason Anderson", "John Gleason", "Thomas J Gleason", "Grace Gleason Dooley", "Charles Vincent Gleason", "Anna Marie Gleason Nelson", "Robert (Bill) Gleason", "Hilary Sand", "Hedwig S. Eltrich Waldorf", "Jeanne Mary Eltrich", "Catherine Heisler Zackowski","Noah W Gibson", "Adaline Butcher", "George H Gibson", "Amanda McCray", "George Gibson Jr.", "Thomas Ed Gibson", "Dorothy Marie Gibson Young", "Chester Gibson", "Monica Joanne Clark", "Chester Clark", "Vicki Gibson", "Tonya Gibson", "Daniel Webster Gibson", "Anna Donae Mullinax"]: # The way this directed graph is read is that Family member i is named FamilyNames[i] and has children FamilyTree[i], whose names can also # be found using FamilyNames[j] for each j in FamilyTree[i] FamilyTree:=[{6,129,130,131,132,133,134,158},{6,129,130,131,132,133,134,158},{5},{5},{75,110,111},{75,110,111},{14,15},{14,15},{11,12},{11,12}, {},{},{},{},{},{},{19},{19},{},{},{},{24,25,26},{24,25,26},{},{},{},{},{},{40},{40},{39},{39},{38,108},{38,108},{37,107},{37,107},{42,105,106}, {42,105,106},{41,44,45,104},{41,44,45,104},{54,103},{54,103},{46},{46},{},{},{},{52,99,100},{52,99,100},{53,95,96,97,98},{53,95,96,97,98},{55}, {55},{16,18,21,23,27,72},{16,18,21,23,27,72},{64},{64},{65},{65},{66},{66},{67},{67},{68,69,70},{68,69,70},{71,109},{71,109},{},{},{8,9,73}, {8,9,73},{88,90},{88,90},{76,80,85,86,89},{76,80,85,86,89},{78,79},{78,79},{},{},{82,83,84},{82,83,84},{},{},{},{},{},{},{},{91,92,93,94}, {91,92,93,94},{},{},{},{},{},{},{},{},{},{102},{102},{},{},{},{},{},{},{},{},{156},{},{114,115,116,117,118,119,2,157}, {114,115,116,117,118,119,2,157},{},{},{},{},{},{},{122,123,124,1,125,126,127,128,159},{122,123,1,124,125,126,127,128,159},{},{},{},{},{},{},{}, {},{},{},{},{},{},{137,138,139,140},{137,138,139,140},{3},{},{},{},{143,144},{143,144},{3,146},{},{146},{},{5,149,150,151,152,153,154,155}, {5,149,150,151,152,153,154,155},{},{},{},{},{},{},{},{},{},{},{},{162},{160},{164,165,166,167},{164,165,166,167},{},{74,170,171},{},{}, {74,170,171},{168},{},{},{160},{162}]: # Here is code that spits out in words for a given i "Family member i has children ... " # WhoAreMyKids takes in a list N of names associated to a Family Tree and a list of sets T which is a directed graph or "family tree" as above # as well as an index 0< i <= nops(N) and spits out in words which family member this is and who their children are. WhoAreMyKids:=proc(N,T,i) local children,numChildren,k: if i<=0 or i>nops(N) then printf("input is invalid, %g is not a member of the family", i); RETURN(FAIL); fi: numChildren:=nops(T[i]); if numChildren=0 then print(cat(N[i]," has no children")); else: children:=[seq(N[k], k in T[i])]; print(cat(N[i]," has children ",children)); fi: end: #Examples: WhoAreMyKids(FamilyNames,FamilyTree, 91); #Outputs: #Kayla Gibson has no children #I have no children, so this is a good output. WhoAreMyKids(FamilyNames,FamilyTree, 90); #Outputs: #Mikael Gibson has children [Kayla Gibson, Adam Gibson, Nickolas Gibson, Maya Gibson] #My mother Mikael Gibson has 4 children, me and my 3 siblibings. WhoAreMyKids(FamilyNames,FamilyTree, 175); #Outputs: #input is invalid, 175 is not a member of the family # FAIL #This makes sense because there is not a 175th family member #Playing with some of the In-Class Functions: GenS(FamilyTree); #Outputs: # [{11, 12, 13, 14, 15, 16, 19, 20, 21, 24, 25, 26, 27, 28, 45, 46, 47, 68, 69, 78, 79, 82, 83, 84, 85, 86, 87, 88, 91, 92, 93, 94, 95, 96, 97, 98, 99, 102, 103, 104, 105, 106, 107, 108, 109, 111, 114, 115, 116, 117, 118, 119, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 138, 139, 140, 144, 146, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 164, 166, 167, 170, 171}, {7, 8, 9, 10, 17, 18, 22, 23, 43, 44, 76, 77, 80, 81, 89, 90, 100, 101, 110, 145}, {72, 73, 74, 75}, {5, 6, 54, 55, 70, 71, 165, 168}, {1, 2, 3, 4, 41, 42, 52, 53, 64, 65, 66, 67, 147, 148, 162, 163, 169}, {37, 38, 39, 40, 48, 49, 50, 51, 56, 57, 58, 59, 60, 61, 62, 63, 112, 113, 120, 121, 137, 143, 160, 173}, {29, 30, 31, 32, 33, 34, 35, 36, 135, 136, 141, 142, 161, 172}] nops(%); # Should output the number of generations in my family # Outputs: 7 (This is correct!) G:=LaG(FamilyTree); #Outputs: #G := [1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0] # I want to check that I (index 91) lose (because I have no children) and that my # grandpa (index 74) wins since he does have children #CHECK: G[91]; #Outputs 0 this is correct! G[74]; #Outputs 1 this is also correct!