-
Notifications
You must be signed in to change notification settings - Fork 0
/
juniper.py
97 lines (88 loc) · 2.74 KB
/
juniper.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
# Copyright (C) 2016 Hans Yu <[email protected]>
#
# This file is part of MathDjinn.
#
# MathDjinn is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# MathDjinn is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with MathDjinn. If not, see <http://www.gnu.org/licenses/>.
import sys
from stammbaum import *
# settings
max_level = 30
# parent
student_ident = 149678
student_name = 'Matthew P. Juniper'
student_node = Node(student_ident, student_name)
# Generate genealogy.
g = Stammbaum(max_level)
g.set_advisors(student_node, 1)
g.cut_tree(student_node, 1)
g.cut_tree(student_node, 1) # Run for a second time (see stammbaum).
# Cut leafs.
leafs = []
leafs.append('Johannes von Gmunden')
leafs.append('Heinrich von Langenstein')
leafs.append('Nicole Oresme')
leafs.append('Johannes von Gmunden')
leafs.append('Leo Outers')
keys = []
for key_it in g.mathematicians:
if g.mathematicians[key_it].name in leafs:
keys.append(key_it)
print("{} cut.".format(g.mathematicians[key_it].name))
for key_it in keys:
del g.mathematicians[key_it]
g.cut_tree(student_node, 1)
# NPJ.
root_names = []
root_years = []
root_names.append("Simon Rees")
root_years.append(2009)
root_names.append("Gary Chandler")
root_years.append(2010)
root_names.append("Larry Li")
root_years.append(2011)
root_names.append("Iain Waugh")
root_years.append(2013)
root_names.append("Ubaid Qadri")
root_years.append(2013)
root_names.append("Karthik Kashinath")
root_years.append(2013)
root_names.append("Vikrant Gupta")
root_years.append(2014)
root_names.append("Giulio Ghirardo")
root_years.append(2015)
root_names.append("Luca Magri")
root_years.append(2015)
root_names.append("Alessandro Orchini")
root_years.append(2016)
root_names.append("Nicholas Jamieson")
root_years.append(2018)
root_names.append("José Aguilar Perez")
root_years.append(2019)
root_names.append("Jack Brewster")
root_years.append(2019)
root_nodes = []
for root_ct in range(len(root_names)):
name_it = root_names[root_ct]
node_it = Node(-root_ct, name_it)
node_it.year = root_years[root_ct]
node_it.advisors.append(student_ident)
g.mathematicians[node_it.ident] = node_it
root_nodes.append(node_it)
# Source code for dot.
if len(sys.argv) > 1:
g.print_dot(root_nodes, sys.argv[1])
else:
g.print_dot(root_nodes)