Bird
0
0

Given this LangGraph snippet:

medium📝 component behavior Q13 of 15
LangChain - LangGraph for Stateful Agents
Given this LangGraph snippet:
nodeA.connect(nodeB)
nodeB.connect(nodeC, condition=lambda x: x == 'yes')
nodeB.connect(nodeD, condition=lambda x: x == 'no')

What happens if nodeB receives input 'no'?
AThe flow moves from nodeB to nodeD.
BThe flow moves from nodeB to nodeC.
CThe flow stops at nodeB with no next node.
DThe flow moves back to nodeA.
Step-by-Step Solution
Solution:
  1. Step 1: Analyze connections from nodeB

    nodeB connects to nodeC if input is 'yes', and to nodeD if input is 'no'.
  2. Step 2: Apply input 'no' to conditions

    Input 'no' matches the condition for nodeD, so flow moves to nodeD.
  3. Final Answer:

    The flow moves from nodeB to nodeD. -> Option A
  4. Quick Check:

    Input 'no' triggers nodeD path [OK]
Quick Trick: Match input to condition to find next node [OK]
Common Mistakes:
MISTAKES
  • Choosing nodeC for input 'no'
  • Assuming flow stops without explicit else
  • Thinking flow returns to previous node

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LangChain Quizzes