Browse code

When highlighting a node, also highlight its edges

This makes it easy to determine the connectivity of a node in a complex graph.

Owen Stephens authored on 26/09/2014 15:43:02 • Jose Fonseca committed on 29/04/2016 23:27:10
Showing 1 changed files

  • xdot.py index 2a50dd1..04e2286 100755
... ...
@@ -510,7 +510,9 @@ class Graph(Shape):
510 510
         for shape in self.shapes:
511 511
             shape.draw(cr)
512 512
         for edge in self.edges:
513
-            edge.draw(cr, highlight=(edge in highlight_items))
513
+            should_highlight = any(e in highlight_items
514
+                                   for e in (edge, edge.src, edge.dst))
515
+            edge.draw(cr, highlight=should_highlight)
514 516
         for node in self.nodes:
515 517
             node.draw(cr, highlight=(node in highlight_items))
516 518