#*****************************************************************************80 # ## genealogy_tree plots a binary tree for alphabetizing. # # Licensing: # # This code is distributed under the MIT license. # # Modified: # # 04 September 2020 # # Author: # # John Burkardt # cat ( date ( ), "\n" ) cat ( "\n" ) cat ( "genealogy_tree\n" ) cat ( " ", version$version.string, "\n" ) cat ( " Plot a tree illustrating a genealogy." ) library ( igraph ) filename = "genealogy_tree.png" png ( filename ) G <- graph.tree ( n = 1, children = 2 ) V(G)$name <- "George" V(G)$color <- "cyan" G <- G + vertices ( "Martha", color = "pink" ) G <- G + edge ( "George", "Martha" ) G <- G + vertices ( "Cecilie", color = "pink" ) G <- G + edge ( "George", "Cecilie" ) G <- G + vertices ( "Samantha", color = "pink" ) G <- G + edge ( "Martha", "Samantha" ) G <- G + vertices ( "Allen", color = "cyan" ) G <- G + edge ( "Martha", "Allen" ) G <- G + vertices ( "Naomi", color = "pink" ) G <- G + edge ( "Cecilie", "Naomi" ) G <- G + vertices ( "Aram", color = "cyan" ) G <- G + edge ( "Cecilie", "Aram" ) G <- G + vertices ( "Karen", color = "pink" ) G <- G + edge ( "Samantha", "Karen" ) G <- G + vertices ( "Dennis", color = "cyan" ) G <- G + edge ( "Samantha", "Dennis" ) G <- G + vertices ( "Mohit", color = "cyan" ) G <- G + edge ( "Samantha", "Mohit" ) G <- G + vertices ( "Otto", color = "cyan" ) G <- G + edge ( "Naomi", "Otto" ) G <- G + vertices ( "Francine", color = "pink" ) G <- G + edge ( "Naomi", "Francine" ) my_layout <- layout.reingold.tilford ( G, params = list ( root = "George" ) ) plot ( G, layout = my_layout, vertex.size = 30, main = "My genealogy tree" ) cat ( ' Graphics saved as "', filename, '"\n' ) # # Terminate. # cat ( "\n" ) cat ( "genealogy_tree:\n" ) cat ( " Normal end of execution.\n" ) quit ( )