From 6842020551cd6ec1baa2f2477f85555d5d1a2544 Mon Sep 17 00:00:00 2001 From: Pavel 'LEdoian' Turinsky Date: Wed, 19 Jul 2023 21:14:27 +0200 Subject: [PATCH] Better edge width --- birdvisu/annotations/layout.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/birdvisu/annotations/layout.py b/birdvisu/annotations/layout.py index db67533..213c985 100644 --- a/birdvisu/annotations/layout.py +++ b/birdvisu/annotations/layout.py @@ -225,9 +225,10 @@ class PlaceUnplacedVertices(StyleAnnotator): return result def _default_width_for_cost(cost): - from math import log2 - if cost <= 2: return 1 - return int(log2(cost)) + # Maybe use exponential decay? + if cost > 0: return 10/cost + # As thin as possible for no-weight edges (e.g. network → router) + return 0 class EdgeWidthByCost(StyleAnnotator): idempotent = True def __init__(self, param):