Displaying conditional edges in Mermaid diagram

Original question from JayS:

Hi, in the course interrupt_handler_node uses Command(goto=…) for routing.
Since no explicit conditional edge is needed between interrupt_handler_node and llm_call how draw_mermaid_png knows how to display all implicit conditional edges properly?
in the course notebooks, the graph png is accurate but I have seen some cases where the mermaid does not take into account some non explicit conditional edges, is there a way to have a complete view of the graph when using Command(goto=..) ?

Answer:

When the graph compiles, it analyzes the entire graph structure. Not just explicit edges. So for the Command operation in the interrupt_handler, these implicit edges are created:

  • interrupt_handlerllm_call (when goto="llm_call")

  • interrupt_handlerEND (when goto=END)