WIP: Explore parameters for gen_centered_graph.py
This commit is contained in:
parent
0003c80ad8
commit
43824cc013
@ -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("-", "_")
|
||||
|
Loading…
Reference in New Issue
Block a user