Skip to content

Allow callable for node positioning model in graph plot

Utopia Developers requested to merge graph-drawing-improvements into master

This MR extends the .dag.graph plot such that it allows to define a callable for the node positioning model. This way, custom node positions can be computed by defining or linking to a callable via the DAG result placeholders.

Example:

my_plot_with_custom_node_positions:
  # ...
  transform:
    # Define a callable that computes node positions
    - lambda: "lambda g: {n: (i, i) for i, n in enumerate(g.nodes)}"
      tag: node_positioning_model

  graph_drawing:
    positions:
      model: !dag_result node_positioning_model

Is there something that needs to be double checked?

Interface ok?

Can this MR be accepted?

  • Implemented the changes
  • Added or extended tests
  • Checked test code coverage on new and adjusted code
  • Added or updated documentation
  • Reasonably up-to-date with current master
  • Pipeline passing without warnings
  • Squash option set
  • Approved by @jeremiastraub
Edited by Utopia Developers

Merge request reports