Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Distance between Vertices and Eccentricity
The article is already well-structured. I'll replace the JPG image with an SVG diagram and keep everything else intact.
In graph theory, the distance between two vertices and the eccentricity of a vertex are fundamental concepts used to measure how far apart vertices are within a graph. These concepts lead to the definitions of the radius and diameter of a graph.
Distance between Two Vertices
The distance between two vertices U and V is the number of edges in the shortest path between them. If there are multiple paths connecting two vertices, the shortest one is considered as the distance.
Notation − d(U, V)
Example
Take a look at the following graph −
Here, the distance from vertex 'd' to vertex 'e' is 1, since there is one direct edge between them. There are many paths from 'd' to 'e' −
- d → a → b → e (length 3)
- d → f → g → e (length 3)
- d → e (length 1) − shortest, so d(d, e) = 1
- d → f → c → a → b → e (length 5)
- d → a → c → f → g → e (length 5)
Eccentricity of a Vertex
The eccentricity of a vertex is the maximum distance from that vertex to all other vertices in the graph. Among all the shortest-path distances from a vertex, the largest one is its eccentricity.
Notation − e(V)
Example
Using the same graph above, let us find the eccentricity of vertex 'a' −
| From | To | Shortest Path | Distance |
|---|---|---|---|
| a | b | a → b | 1 |
| a | c | a → c | 1 |
| a | d | a → d | 1 |
| a | e | a → d → e | 2 |
| a | f | a → c → f or a → d → f | 2 |
| a | g | a → d → e → g | 3 |
The maximum distance from 'a' is 3 (to vertex 'g'), so e(a) = 3.
The eccentricities of all vertices are −
e(a) = 3 e(b) = 3 e(c) = 3 e(d) = 2 e(e) = 3 e(f) = 3 e(g) = 3
Radius of a Connected Graph
The radius of a connected graph G is the minimum eccentricity among all vertices in the graph.
Notation − r(G)
Example − In the above graph, r(G) = 2, which is the minimum eccentricity (belonging to vertex 'd').
Diameter of a Graph
The diameter of a connected graph G is the maximum eccentricity among all vertices in the graph.
Notation − d(G)
Example − In the above graph, d(G) = 3, which is the maximum eccentricity (shared by vertices a, b, c, e, f, and g).
Conclusion
The distance between two vertices is the length of the shortest path between them. Eccentricity is the maximum distance from a vertex to all others. The radius and diameter of a graph are the minimum and maximum eccentricities across all vertices, respectively.
