How to Use
- Add Node: Enter a label and click "Add Node"
- Add Edge: Enter source, destination, and weight, then click "Add Edge"
- Random Weighted Graph: Click to instantly generate a weighted graph
- Remove Node/Edge: Enter node or edge and click remove
- Edge Count / Total Weight: Click to count edges or sum weights
- Reset: Click to clear the graph
Weighted Graph Concept
Weighted Graph is a graph where each edge has an associated numerical value (weight), representing cost, distance, or capacity.
Key Characteristics:
- Edges have weights (numbers)
- Used in shortest path, network flow, and optimization problems
- Common in transportation, networking, and logistics
Weighted Graph Setup
Weighted Graph Operations
Graph Visualization
Operation Steps
Purpose & Applications
- Shortest path algorithms (Dijkstra, Bellman-Ford)
- Network routing and flow
- Resource allocation
- Modeling costs/distances
Time & Space Complexity
Operation | Time Complexity | Space Complexity |
---|---|---|
Add Node | O(1) | O(V+E) |
Add Edge | O(1) | O(1) |
Remove Node | O(E) | O(V+E) |
Remove Edge | O(E) | O(1) |
Edge Count | O(1) | O(1) |
Total Weight | O(E) | O(1) |
Strengths & Limitations
Strengths:
- Models real-world costs and distances
- Enables advanced algorithms
Limitations:
- More complex than unweighted graphs
- Requires careful handling of weights