vault backup: 2025-03-16 18:59:42
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
# Create an adjacency matrix for the following weighted undirected graph.
|
||||
# Create an Adjacency Matrix for the following Weighted Undirected Graph.
|
||||
|
||||
```
|
||||
A-3-B
|
||||
| |
|
||||
@@ -17,10 +18,10 @@ To create an **adjacency matrix** for the given **weighted undirected graph**, w
|
||||
|
||||
### **Graph Details**:
|
||||
|
||||
- **A -3- B**: There is an edge between A and B with weight 3.
|
||||
- **A -2- C**: There is an edge between A and C with weight 2.
|
||||
- **B -1- D**: There is an edge between B and D with weight 1.
|
||||
- **C -4- D**: There is an edge between C and D with weight 4.
|
||||
- **A -3B**: There is an edge between A and B with weight 3.
|
||||
- **A -2C**: There is an edge between A and C with weight 2.
|
||||
- **B -1D**: There is an edge between B and D with weight 1.
|
||||
- **C -4D**: There is an edge between C and D with weight 4.
|
||||
|
||||
---
|
||||
|
||||
@@ -49,4 +50,4 @@ Let's map the nodes to indices:
|
||||
- `B-D` has a weight of 1, so `matrix[1][3] = 1` and `matrix[3][1] = 1`.
|
||||
- `C-D` has a weight of 4, so `matrix[2][3] = 4` and `matrix[3][2] = 4`.
|
||||
|
||||
This adjacency matrix accurately represents the weighted undirected graph.
|
||||
This adjacency matrix accurately represents the weighted undirected graph.
|
||||
|
Reference in New Issue
Block a user