Bird
0
0

You want to create a graph with nodes 'A', 'B', and 'C' where 'A' connects to 'B' and 'B' connects to 'C'. Which code correctly sets this up?

hard📝 Application Q8 of 15
LangChain - LangGraph for Stateful Agents
You want to create a graph with nodes 'A', 'B', and 'C' where 'A' connects to 'B' and 'B' connects to 'C'. Which code correctly sets this up?
AnodeA = Node('A') nodeB = Node('B') nodeC = Node('C') edge1 = Edge(nodeA, nodeB) edge2 = Edge(nodeB, nodeC)
BnodeA = Node('A') nodeB = Node('B') nodeC = Node('C') edge1 = Edge(nodeB, nodeA) edge2 = Edge(nodeC, nodeB)
CnodeA = Node('A') nodeB = Node('B') nodeC = Node('C') edge1 = Edge(nodeC, nodeB) edge2 = Edge(nodeB, nodeA)
DnodeA = Node('A') nodeB = Node('B') nodeC = Node('C') edge1 = Edge(nodeA, nodeC) edge2 = Edge(nodeC, nodeB)
Step-by-Step Solution
Solution:
  1. Step 1: Identify the required connections

    'A' connects to 'B' and 'B' connects to 'C' means edges from A to B and B to C.
  2. Step 2: Match code that creates these edges

    nodeA = Node('A') nodeB = Node('B') nodeC = Node('C') edge1 = Edge(nodeA, nodeB) edge2 = Edge(nodeB, nodeC) creates edges Edge(nodeA, nodeB) and Edge(nodeB, nodeC) correctly.
  3. Final Answer:

    nodeA = Node('A') nodeB = Node('B') nodeC = Node('C') edge1 = Edge(nodeA, nodeB) edge2 = Edge(nodeB, nodeC) -> Option A
  4. Quick Check:

    Edges match connections [OK]
Quick Trick: Edge(start, end) follows connection direction [OK]
Common Mistakes:
MISTAKES
  • Reversing edge directions
  • Connecting wrong nodes
  • Skipping node creation

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LangChain Quizzes