We can imagine a graph as a bunch of different cities which are connected to each other with roads.
The picture above is a simple graph. Here we have cities A,B,E,G,H,F,K,M and the roads which are connecting them. The cities are called nodes (sometimes vertexes) and the roads are called edges. So if we want to get from the city G to the city K as fast as possible We can go to the city H then go to K or we can go to the city M and then go to K. We treat all the roads equally. There is a type of a graph when the roads have , let's say length. The lengths of cities are sometimes called weights.
The graph above is the same as the previous one but the roads of this graph have wights (lengths). So if we want to get from the city G to the city k as fast as possible we better go to the city M and then to K (by doing so we will pass 13+34=47 distance not 4+47 (If we went to H then to K) )..
Examples of graphs from our daily life
1. The cities and roads.
2. Airport network
3. Firneds of friends network
You have a friend. And your friend has another friend whom you don't know so you are connected to your friend and you friend is connected to his friend.
4. Internet network
Your computer is connected to a modem. The modem is connected to the ISP (internet service provider).ISP is connected to the different sattelites which connect the whole internet together and so...
...
....
....
No comments:
Post a Comment