Bird
0
0

What will be the output of this code?

medium📝 Predict Output Q5 of 15
LangChain - LangGraph for Stateful Agents
What will be the output of this code?
node1 = Node('X')
node2 = Node('Y')
edge = Edge(node1, node2)
print(edge.end.name)
AX
BNone
Cnode2
DY
Step-by-Step Solution
Solution:
  1. Step 1: Identify the end node in the edge

    Edge(node1, node2) means node2 is the end node.
  2. Step 2: Access the end node's name

    edge.end.name returns 'Y' from node2.
  3. Final Answer:

    Y -> Option D
  4. Quick Check:

    edge.end.name = 'Y' [OK]
Quick Trick: edge.end.name gives the target node's name [OK]
Common Mistakes:
MISTAKES
  • Mixing start and end nodes
  • Printing node object instead of name
  • Assuming edge has no end property

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LangChain Quizzes