In the directed Graph Data structure with colors (Node with Colors), the weight of the adjacency or an Edge can be calculated by considering the path.
- If you are asked to find the shortest path from A to C, then look at the graph below [A|1] => [B|2] => [C|3] in this case, the weight of the Edge of A to C is 2 because if you are coming from A to C you will have to go through B which has a weight of 2.
The weight you see in the nodes can be IDs from the Database or could be the Machine location indicating how far the node is stored on disk based on the Data Center location.