From 43824cc013dd03b3933e485fc99921a9c72c94bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20Mart=C3=ADnez=20Portela?= Date: Mon, 18 Sep 2023 23:55:32 +0200 Subject: [PATCH] WIP: Explore parameters for gen_centered_graph.py --- scripts/gen_centered_graph.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/scripts/gen_centered_graph.py b/scripts/gen_centered_graph.py index 16d0abe..05692b1 100644 --- a/scripts/gen_centered_graph.py +++ b/scripts/gen_centered_graph.py @@ -8,6 +8,7 @@ import os @ops_cache.cache def gen(headline_id, graph, doc_to_headline_remapping): reference_node = headline_id + font_name = 'monospace' linked_from_internal = set() g = copy.deepcopy(graph) @@ -94,15 +95,17 @@ def gen(headline_id, graph, doc_to_headline_remapping): with tempfile.NamedTemporaryFile(suffix='.dot', mode='wt') as f: f.write('strict digraph {\n') - f.write('maxiter=1000\n') + f.write('maxiter=10000\n') f.write('splines=curved\n') # f.write('splines=spline\n') # Not supported with edges to cluster - f.write('node[shape=rect]\n') - + f.write('node[shape=rect, width=0.5, height=0.5]\n') + f.write('K=0.3\n') + f.write('edge[len = 1]\n') def draw_subgraph(node_id, depth): f.write("subgraph cluster_{} {{\n".format(node_id.replace("-", "_"))) f.write(' URL="./{}.node.html"\n'.format(node_id)) f.write(' class="{}"\n'.format('cluster-depth-' + str(depth - 1))) + f.write(" fontname=\"{}\"\n".format(font_name)) f.write(" label=\"{}\"\n".format(g[node_id]['title'].replace("\"", "'"))) f.write("\n") @@ -116,6 +119,7 @@ def gen(headline_id, graph, doc_to_headline_remapping): print(" _" + k.replace("-", "_") + "[label=\"" + v["title"].replace("\"", "'") + "\", " + "URL=\"" + k + ".node.html\", " + + "fontname=\"" + font_name + "\", " + "class=\"cluster-depth-" + str(depth) + "\"" + "];", file=f) @@ -126,7 +130,10 @@ def gen(headline_id, graph, doc_to_headline_remapping): for k, v in g.items(): if k not in in_emacs: - print("_" + k.replace("-", "_") + "[label=\"" + v["title"].replace("\"", "'") + "\", URL=\"" + k + ".node.html\"];", file=f) + print("_" + k.replace("-", "_") + + "[label=\"" + v["title"].replace("\"", "'") + "\", " + + "fontname=\"" + font_name + "\", " + + "URL=\"" + k + ".node.html\"];", file=f) for k, v in g.items(): link_src = '_' + k.replace("-", "_")