Diameter of a Graph Diameter of a Graph can be calculated like this: diam(G)=max{d(u,v)∣u,v∈V(G)}\operatorname{diam}(G)=\max \{d(u, v) \mid u, v \in V(G)\}diam(G)=max{d(u,v)∣u,v∈V(G)}