Skip to content

Commit 484c275

Browse files
author
Yuriy Peshkichev
committed
interactive graph coloring
1 parent 4861c06 commit 484c275

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

dialog2graph/pipelines/core/graph.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,14 +297,14 @@ def visualise_interactive(self, *args, **kwargs) -> gv._internal.plotting.data_s
297297
"""
298298
graph = {"graph": {}}
299299
if "frequency" in self.graph_dict["nodes"][0]:
300-
node_rgb = [colorsys.hsv_to_rgb(node["frequency"]/30, 1.0, 1.0) for node in self.graph_dict["nodes"]]
300+
node_rgb = [colorsys.hsv_to_rgb(1/node["frequency"]/2, 1.0, 1.0) for node in self.graph_dict["nodes"]]
301301
node_colors = ["#%02x%02x%02x" % tuple([round(255*x) for x in rgb]) for rgb in node_rgb]
302302
node_frequency = [node["frequency"] for node in self.graph_dict["nodes"]]
303303
else:
304304
node_colors = ["#000000"]*len(self.graph_dict["nodes"])
305305
node_frequency = [0]*len(self.graph_dict["nodes"])
306306
if "frequency" in self.graph_dict["edges"][0]:
307-
edge_rgb = [colorsys.hsv_to_rgb(node["frequency"]/30, 1.0, 1.0) for node in self.graph_dict["edges"]]
307+
edge_rgb = [colorsys.hsv_to_rgb(1/node["frequency"]/2, 1.0, 1.0) for node in self.graph_dict["edges"]]
308308
edge_colors = ["#%02x%02x%02x" % tuple([round(255*x) for x in rgb]) for rgb in edge_rgb]
309309
edge_frequency = [edge["frequency"] for edge in self.graph_dict["edges"]]
310310
else:

0 commit comments

Comments
 (0)