Skip to content

Latest commit

 

History

History
252 lines (193 loc) · 5.24 KB

TROUBLESHOOTING.md

File metadata and controls

252 lines (193 loc) · 5.24 KB

TROUBLESHOOTING: Interface Not Updating

Issue: Changes Not Showing

Symptoms:

  • Interface looks the same as before
  • Distance labels not adaptive
  • Node A still yellow at rest
  • Weight boxes not centered

Root Cause:

Angular dev server needs to detect file changes and rebuild.


Solution Steps:

1. Verify Dev Server is Running

Check the terminal where you ran ng serve:

  • Should see: "Application bundle generation complete"
  • Should see: "Watch mode enabled. Watching for file changes..."
  • URL: http://localhost:53006/

2. Check for Compilation

After file changes, you should see:

✔ Browser application bundle generation complete.
Application bundle generation complete. [X.XXX seconds]

If you don't see this, the server didn't detect changes!

3. Force Rebuild (Do This Now!)

Option A: Save the file again

  1. Open daa/dijkstra.component.ts
  2. Add a space anywhere (like after a comment)
  3. Press Ctrl + S to save
  4. Watch terminal for rebuild message

Option B: Restart dev server

# In terminal:
Ctrl + C  (stop server)
ng serve --port 53006

4. Clear Browser Cache

After rebuild completes:

Ctrl + Shift + R (Hard refresh)

Or:

  1. Open DevTools (F12)
  2. Right-click refresh button
  3. Click "Empty Cache and Hard Reload"

Verification Checklist

After Rebuild + Hard Refresh:

Open Browser DevTools Console (F12): Should see:

🚀 DAA Dijkstra ngOnInit called
📊 Graph generated, nodes: 6 edges: 12
✅ buildSteps complete! Total steps: 50
⚙️ Initial speed: 6 delay: 1000
✅ DAA Dijkstra initialization complete

Check Visual Elements:

  1. Node A at rest:

    • Blue color (RGB: #1e40af)
    • Static (not glowing/pulsing)
    • Distance "0" above it
  2. Distance labels:

    • Node A, B (top): Distance ABOVE
    • Node E, F, D (bottom): Distance BELOW
    • No overlap with edges
  3. Weight boxes:

    • Dark rounded rectangles
    • Numbers centered inside
    • Positioned on edge midpoints

If you DON'T see these, the new code isn't loaded yet!


Debugging: Check Source Code in Browser

  1. Open DevTools (F12)
  2. Go to "Sources" tab
  3. Navigate to: main.js or find dijkstra.component
  4. Search for: "ADAPTIVE: above for top nodes"
  5. If NOT found → Old code still cached!

Nuclear Option: Complete Reset

If nothing works:

# Stop server
Ctrl + C

# Clear all caches
rm -r .angular
rm -r node_modules/.cache

# Rebuild
ng serve --port 53006

# In browser:
# 1. Open DevTools (F12)
# 2. Go to Application tab
# 3. Clear storage
# 4. Hard refresh (Ctrl + Shift + R)

About "Traversal Sequence" Issue

You mentioned: "make the traversal to follow the right sequence"

Current Dijkstra Implementation:

Algorithm is CORRECT:

  1. Start at source node A (distance = 0)
  2. Extract minimum distance node from priority queue
  3. Check all outgoing edges from that node
  4. Relax edges if shorter path found
  5. Repeat until all nodes processed

Expected Visit Order (depends on graph):

  • Typically: A → C → B → D → E → F → G
  • Order determined by shortest distances

If you're seeing wrong order:

  • This could be a graph structure issue
  • Or edge weights issue
  • Let me know WHICH nodes are visited in wrong order

To Check Visit Order:

  1. Click Play
  2. Watch the console for:
    📤 EXTRACT MIN: Selected Node A...
    📤 EXTRACT MIN: Selected Node C...
    📤 EXTRACT MIN: Selected Node B...
    
  3. This shows the actual visit order

Is the order wrong? Tell me:

  • What order do you see?
  • What order do you expect?
  • Which edges have which weights?

Quick Test Commands

1. Check if file has changes:

Select-String -Path "src/app/pages/daa/dijkstra.component.ts" -Pattern "ADAPTIVE"

Should return line with "ADAPTIVE: above for top nodes"

2. Check if server is watching:

Get-Process | Where-Object {$_.ProcessName -eq "node"}

Should show node process running

3. Force file touch (trigger rebuild):

(Get-Item "src/app/pages/daa/dijkstra.component.ts").LastWriteTime = Get-Date

Expected vs Current State

What You Should See After Fix:

Initial State (Before Play):

       0       ← Distance ABOVE
      🔵 A     ← BLUE and STATIC
     / | \
  [7] [3] [4]  ← Weights in boxes
   /   |   \
 🔴 B  |   🔴 C
 ∞    [2]   ∞  ← Distance BELOW
      |
     🔴 D
      9       ← Distance BELOW

After Play:

       0
      🟢 A
     / | \
  [7] [3] [4]
   /   |   \
 🟢 B  |   🟡 C ⭕ ← Yellow ring exploring
 4    [2]   2
      |
     🔴 D
      9

What You Might Be Seeing (Old Code):

      🟡 A ⭕  ← Yellow at rest (WRONG!)
     / | \
  [7] [3] [4]
   /   |   \
 🔴 B  |   🔴 C
 4    [2]   2
      |
     🔴 D
      ∞      ← Overlapping (WRONG!)
     [6]

Contact Info / Next Steps

If interface STILL doesn't update:

  1. Copy-paste what you see in browser console
  2. Screenshot of the current state
  3. Tell me which port the server is on (53006? 4201?)

If traversal order is wrong:

  1. Tell me the visit order you see
  2. Tell me what order you expect
  3. Show me the edge weights in the graph

I'll help debug! 🐛