Generate WORKING Manim code for Scene 1.

IMPLEMENTATION: Here is a detailed plan for implementing the scene with strict positioning and constraints:

---

### Layout Plan:

1. **Title**:  
   - Object: `Text("Understanding the Shortest Path Problem")`  
   - Position: `.to_edge(UP, buff=0.5)`  
   - Purpose: Scene title at the top edge.

2. **Weighted Graph Visualization**:  
   - Objects: `Circle` (nodes), `Line` or `Arrow` (edges), `MathTex` (edge weights), `Dot` (nodes)  
   - Position: Centered with slight left shift `.shift(LEFT * 2.5)` (left side, not too far)  
   - Purpose: Visual focus on a simple weighted graph illustrating nodes and weighted edges.

3. **Main Equation (Shortest Path Problem Statement)**:  
   - Object: `MathTex(r"\text{Find } \min \sum \text{weights from start node to others}")`  
   - Position: `.shift(UP * 1.5)` (upper center)  
   - Purpose: Formalize the shortest path problem.

4. **Secondary Text (Real-world importance)**:  
   - Object: `Text("Applications: Navigation, Network Routing")`  
   - Position: `.shift(DOWN * 1.5)` (lower center)  
   - Purpose: Explain why shortest path matters.

5. **Transition Text (Lead-in to Dijkstra’s Algorithm)**:  
   - Object: `Text("Need an efficient method to find shortest paths")`  
   - Position: `.shift(RIGHT * 2.5)` (right side, not too far)  
   - Purpose: Transition to introducing Dijkstra’s algorithm.

---

### Animation Sequence:

**Step 1: Introduce Title and Weighted Graph**  
- Action: `Write` the title at top edge  
- Action: `Create` the weighted graph (nodes, edges, weights) on left side  
- Duration: 3 seconds  
- Cleanup: None (keep title and graph visible)

---

**Step 2: Introduce Main Equation (Shortest Path Problem)**  
- Action: `Write` main equation `.shift(UP * 1.5)` (upper center)  
- Duration: 2.5 seconds  
- Cleanup: None (keep title, graph, and main equation visible)

---

**Step 3: Show Secondary Text (Real-world importance)**  
- Action: `Write` secondary text `.shift(DOWN * 1.5)` (lower center)  
- Duration: 2.5 seconds  
- Cleanup: FadeOut secondary text after showing it (keep title, graph, main equation)

---

**Step 4: Transition Text (Lead-in to Dijkstra’s Algorithm)**  
- Action: `Write` transition text `.shift(RIGHT * 2.5)` (right side)  
- Duration: 3 seconds  
- Cleanup: FadeOut transition text, FadeOut graph, FadeOut main equation, FadeOut title (final cleanup)

---

### Additional Notes:

- Use only allowed colors:  
  - Title: WHITE  
  - Nodes (Circles/Dots): BLUE  
  - Edges (Lines/Arrows): GREEN  
  - Edge weights (MathTex): YELLOW  
  - Main equation and texts: WHITE or RED for emphasis if needed

- Keep all elements within screen bounds (-6 to +6 horizontal, -3.5 to +3.5 vertical).

- No shifts beyond +/-3 in any direction.

- No other Manim objects or animations used.

---

If you want, I can also provide the exact Manim code snippet following this plan.
PATTERN: function_graph

CRITICAL CONSTRAINTS:
1. Use ONLY these objects: Text, MathTex, Axes, Circle, Rectangle, Line, Arrow, Dot, SurroundingRectangle, VGroup
2. Use ONLY these animations: Write, Create, FadeIn, FadeOut 
3. Use ONLY these colors (no quotes): BLUE, RED, GREEN, YELLOW, WHITE, ORANGE, PURPLE
4. NO undefined objects like VideoFile, Slider, ImageMobject
5. NO Unicode characters - use LaTeX: \sqrt{} not √, \pm not ±

POSITIONING REQUIREMENTS (CRITICAL):
- Each element MUST have unique position within screen bounds
- SAFE positions only: .to_edge(UP), .shift(UP*1.5), .shift(DOWN*1.5), .shift(LEFT*2.5), .shift(RIGHT*2.5)
- NO extreme shifts: avoid UP*3, DOWN*3, LEFT*4, RIGHT*4 (goes off-screen)
- NO overlapping: if one element uses .shift(UP*1.5), others must use different positions
- Test positions: Title=top, Main=upper center, Secondary=lower center, Sides=left/right

TEMPLATE TO ADAPT:

        # Title at top
        title = Text("{title}").scale(0.8).to_edge(UP, buff=0.5)
        
        # Axes positioned in lower area
        axes = Axes(
            x_range=[-3, 3, 1],
            y_range=[-2, 4, 1], 
            x_length=6,
            y_length=4,
            axis_config={{"color": BLUE}}
        ).shift(DOWN * 0.5)
        
        # Function plot
        function = axes.plot(lambda x: {function_expr}, color=RED)
        
        # Equation display
        equation = MathTex(r"{equation}").shift(UP * 1.5)
        
        # Animation sequence
        self.play(Write(title))
        self.wait(1)
        self.play(Write(equation))
        self.wait(1)
        self.play(Create(axes))
        self.wait(1)
        self.play(Create(function))
        self.wait(2)
                

Replace placeholders with scene-specific values and ensure working Manim code.

Generate complete Python code: