This post is completed by 1 user
|Add to List|
Weighted Graph Implementation – JAVA
What is Weighted Graph?
A Graph is called weighted graph when it has weighted edges which means there are some cost associated with each edge in graph.
- Each edge of a graph has an associated numerical value, called a weight.
- Usually, the edge weights are nonnegative integers.
- Weighted graphs may be either directed or undirected.
- The weight of an edge is often referred to as the "cost" of the edge.
- Will create an Edge class to put weight on each edge
vertex-0 is connected to 2 with weight 3 vertex-0 is connected to 1 with weight 4 vertex-1 is connected to 2 with weight 5 vertex-1 is connected to 3 with weight 2 vertex-2 is connected to 3 with weight 7 vertex-3 is connected to 4 with weight 2 vertex-4 is connected to 5 with weight 6 vertex-4 is connected to 1 with weight 4 vertex-4 is connected to 0 with weight 4
- Dijkstra’s – Shortest Path Algorithm (SPT) – Adjacency List and Priority Queue – Java Implementation Hard