Tweaking to the visual apperance

This commit is contained in:
Dominik Moritz Roth 2021-06-16 18:01:28 +02:00
parent ff5c1ae139
commit 07205f37c0

View File

@ -388,7 +388,7 @@ def graphAddTopLists(G, books):
def graphAddSeries(G, books): def graphAddSeries(G, books):
for series in getAllSeries(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: for book in books:
if 'series' in book: if 'series' in book:
G.add_edge('s/'+book['series'], book['id'], color=readColor(book)) G.add_edge('s/'+book['series'], book['id'], color=readColor(book))
@ -397,7 +397,7 @@ def graphAddSeries(G, books):
def graphAddTags(G, books): def graphAddTags(G, books):
for tag in getAllTags(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 book in books:
for tag in getTags(book): for tag in getTags(book):
G.add_edge('t/'+tag, book['id'], color=readColor(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) ratio = fuzz.ratio(node['label'], name)
if ratio > bestRatio: if ratio > bestRatio:
bestRatio, match, n = ratio, node, ni bestRatio, match, n = ratio, node, ni
if not match: if bestRatio < 70:
raise Exception("No such "+type_name+" could be found.") print("Best Match: "+match['label'])
menge = set() menge = set()
pruneDist(G, match, n, dist, menge) pruneDist(G, match, n, dist, menge)
@ -554,7 +554,9 @@ def analyze(G, type_name, name, dist=2.7):
scaleBooksByRating(G) scaleBooksByRating(G)
scaleOpinionsByRating(G) scaleOpinionsByRating(G)
match['value'] += 100 match['value'] = 100
if not 'shape' in match:
match['shape'] = 'star'
addScoreToLabels(G) addScoreToLabels(G)
def pruneDist(G, node, n, dist, menge, firstEdge=False): def pruneDist(G, node, n, dist, menge, firstEdge=False):