From 07205f37c02805fd7f1a010a76d9ffa1ad0c2cca Mon Sep 17 00:00:00 2001 From: Dominik Roth Date: Wed, 16 Jun 2021 18:01:28 +0200 Subject: [PATCH] Tweaking to the visual apperance --- caliGraph.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/caliGraph.py b/caliGraph.py index bab3fb1..f1ecf04 100755 --- a/caliGraph.py +++ b/caliGraph.py @@ -388,7 +388,7 @@ def graphAddTopLists(G, books): def graphAddSeries(G, books): for series in getAllSeries(books): - G.add_node('s/'+series, color='red', t='series', label=series) + G.add_node('s/'+series, color='red', t='series', label=series, shape='triangle') for book in books: if 'series' in book: G.add_edge('s/'+book['series'], book['id'], color=readColor(book)) @@ -397,7 +397,7 @@ def graphAddSeries(G, books): def graphAddTags(G, books): for tag in getAllTags(books): - G.add_node('t/'+tag, color='gray', t='tag', label=tag) + G.add_node('t/'+tag, color='lightGray', t='tag', label=tag, shape='box') for book in books: for tag in getTags(book): G.add_edge('t/'+tag, book['id'], color=readColor(book)) @@ -540,8 +540,8 @@ def analyze(G, type_name, name, dist=2.7): ratio = fuzz.ratio(node['label'], name) if ratio > bestRatio: bestRatio, match, n = ratio, node, ni - if not match: - raise Exception("No such "+type_name+" could be found.") + if bestRatio < 70: + print("Best Match: "+match['label']) menge = set() pruneDist(G, match, n, dist, menge) @@ -554,7 +554,9 @@ def analyze(G, type_name, name, dist=2.7): scaleBooksByRating(G) scaleOpinionsByRating(G) - match['value'] += 100 + match['value'] = 100 + if not 'shape' in match: + match['shape'] = 'star' addScoreToLabels(G) def pruneDist(G, node, n, dist, menge, firstEdge=False):