A weighted graph is a graph that has a numeric weight associated with the edges in the graph. It can be either a directed or an undirected graph. This numerical value can possibly be used to indicate distance or cost, depending upon the purpose of the graph. Let's consider an example. The following graph indicates different ways to get from the A node to the D node. You can either go straight from A to D, or choose to pass through B and C, considering that the associated weight with each edge is the amount of time, in minutes, for the journey to the next node:
In this example, AD and ABCD represent two different paths. A path is simply a sequence of edges that you pass through between two nodes. Following these paths, you see that the AD journey takes 40 minutes, whereas the ABCD journey takes 25 minutes. If the only concern is time, then it would be better...