Generate WORKING Manim code for Scene 1.

IMPLEMENTATION: Certainly! Below is a detailed **plan implementation** for the scene following your **STRICT positioning, object, animation, and color requirements**.

---

## Layout Plan

1. **Title**:  
   - Object: `Text("Dijkstra's Algorithm & Weighted Graphs")`  
   - Position: `.to_edge(UP, buff=0.5)`  
   - Purpose: Scene title at top edge

2. **Weighted Graph (nodes + edges + weights)**:  
   - Objects: `Circle` for nodes, `Line` or `Arrow` for edges, `Text` for weights  
   - Position: `.shift(LEFT * 2.5)` (left side, not too far)  
   - Purpose: Visual focus showing a simple weighted graph

3. **Main Equation / Definition**:  
   - Object: `MathTex` defining weighted graph and shortest path problem  
   - Position: `.shift(UP * 1.5)` (upper center)  
   - Purpose: Explain weighted graph, nodes, edges with weights, and problem statement

4. **Secondary Text (Applications + Transition)**:  
   - Object: `Text` describing real-world applications and transition to algorithm  
   - Position: `.shift(DOWN * 1.5)` (lower center)  
   - Purpose: Mention GPS, routing, and introduce need for efficient method

---

## Animation Sequence

### Step 1: Show Title  
- Action: `Write`  
- Element: Title  
- Duration: 2 seconds  
- Cleanup: None (keep title visible throughout)

---

### Step 2: Show Weighted Graph (nodes, edges, weights)  
- Action: `Create` nodes and edges, `Write` weights  
- Element: Weighted graph on left side  
- Duration: 3 seconds  
- Cleanup: None (keep graph visible for reference)

---

### Step 3: Show Main Equation / Definition  
- Action: `Write`  
- Element: MathTex (definition of weighted graph, shortest path problem) at upper center  
- Duration: 4 seconds  
- Cleanup: FadeOut any temporary highlights if used, keep main equation visible

---

### Step 4: Show Secondary Text (Applications + Transition)  
- Action: `Write`  
- Element: Text at lower center  
- Duration: 3 seconds  
- Cleanup: FadeOut secondary text and any temporary elements, keep title, graph, and main equation visible for next scene

---

## Detailed Element Descriptions

### Title  
```python
title = Text("Dijkstra's Algorithm & Weighted Graphs", color=WHITE).to_edge(UP, buff=0.5)
```

### Weighted Graph (example with 4 nodes)  
- Nodes: Circles labeled A, B, C, D  
- Edges: Lines with arrows and weights (numbers)  
- Position: shift left 2.5

Example positions for nodes (relative to center, shifted left 2.5):  
- A: ORIGIN + LEFT * 2.5 + UP * 0.5  
- B: ORIGIN + LEFT * 1.5 + DOWN * 1  
- C: ORIGIN + LEFT * 3.5 + DOWN * 1  
- D: ORIGIN + LEFT * 2.5 + DOWN * 2

Edges and weights connecting nodes accordingly.

### Main Equation / Definition  
Example MathTex content:  
```latex
\text{Weighted graph } G = (V, E, w) \\
\text{where } V = \text{nodes}, E = \text{edges}, w: E \to \mathbb{R}^+ \\
\text{Find shortest paths from start node to all others}
```

Position: `.shift(UP * 1.5)`

### Secondary Text  
Example content:  
```python
Text("Applications: GPS navigation, network routing\nNeed efficient method to find shortest paths", color=WHITE).shift(DOWN * 1.5)
```

---

## Summary of Positioning (all within screen bounds)

| Element          | Position Method           | Coordinates approx.       |
|------------------|---------------------------|--------------------------|
| Title            | `.to_edge(UP, buff=0.5)`  | y ~ 3.0                  |
| Weighted Graph   | `.shift(LEFT * 2.5)`      | x ~ -2.5, y ~ 0          |
| Main Equation    | `.shift(UP * 1.5)`        | y ~ 1.5                  |
| Secondary Text   | `.shift(DOWN * 1.5)`      | y ~ -1.5                 |

---

If you want, I can provide the exact Manim code implementing this plan next. Would you like me to proceed with that?
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:
SMART POSITIONING REQUIREMENTS:
- Analyze the content TYPE first: equation, diagram, comparison, process
- Position based on content meaning, not just arbitrary rules
- Main subject (equation/diagram) should be CENTER or slightly UP
- Supporting text should be BELOW the main subject
- Comparisons should use LEFT/RIGHT positioning
- Sequential content should use TOP-to-BOTTOM flow
- NEVER fade out main content - only temporary highlights

CAREFULLY IMPLEMENT THIS