readabilite: easy option to highlight the nodes

master
pictuga 2017-07-17 00:11:49 +02:00
parent c52b47616d
commit a61b259792
1 changed files with 5 additions and 1 deletions

View File

@ -205,10 +205,14 @@ def rank_nodes(grades):
return sorted(grades.items(), key=lambda x: x[1], reverse=True) return sorted(grades.items(), key=lambda x: x[1], reverse=True)
def get_best_node(grades): def get_best_node(grades, highlight=False):
top = rank_nodes(grades) top = rank_nodes(grades)
lowest = lowest_common_ancestor(top[0][0], top[1][0], 3) lowest = lowest_common_ancestor(top[0][0], top[1][0], 3)
if highlight:
top[0][0].attrib['style'] = 'border: 2px solid blue'
top[1][0].attrib['style'] = 'border: 2px solid green'
lowest.attrib['style'] = 'outline: 2px solid red'
return lowest return lowest