ArticleslgStudy

computer science

Diameter (graph theory)

Diameter (graph theory) is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Diameter (graph theory) rather than just read about it. In short: In graph theory, the diameter of a connected undirected graph is the farthest distance between any two of its vertices. That is, it is the diameter of a set for the set of vertices of the graph, and for the shortest-path distance in the graph.

Diameter (graph theory) — main illustration
Diameter (graph theory) — illustration

Key takeaways

  • Diameter (graph theory) belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Diameter (graph theory) to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Diameter (graph theory) from memory before moving on to harder problems.

Reference excerpt

In graph theory, the diameter of a connected undirected graph is the farthest distance between any two of its vertices. That is, it is the diameter of a set for the set of vertices of the graph, and for the shortest-path distance in the graph. Diameter may be considered either for weighted or for unweighted graphs. Researchers have studied the problem of computing the diameter, both in arbitrary graphs and in special classes of graphs. The diameter of a disconnected graph may be defined to be infinite, or undefined.

Graphs of low diameter The degree diameter problem seeks tight relations between the diameter, number of vertices, and degree of a graph. One way of formulating it is to ask for the largest graph with given bounds on its degree and diameter. For any fixed degree, this maximum size is exponential in diameter, with the base of the exponent depending on the degree. The girth of a graph, the length of its shortest cycle, can be at most 2k+1 for a graph of diameter k. The regular graphs for which the girth is exactly 2k+1 are the Moore graphs. Only finitely many Moore graphs exist, but their exact number is unknown. They provide the solutions to the degree diameter problem for their degree and diameter. Small-world networks are a class of graphs with low diameter, modeling the real-world phenomenon of six degrees of separation in social networks.

Algorithms

In arbitrary graphs The diameter of a graph can be computed by using a shortest path algorithm to compute shortest paths between all pairs of vertices, and then taking the maximum of the distances that it computes. For instance, in a graph with positive edge weights, this can be done by repeatedly using Dijkstra's algorithm, once for each possible starting vertex. In a graph with n vertices and m edges, this takes time O(mn+n2log⁡n). Computing all-pairs shortest paths is the fastest known method for computing the diameter of a weighted graph exactly. In an unweighted graph, Dijkstra's algorithm may be replaced by a breadth-first search, giving time O(mn). Alternatively, the diameter may be computed using an algorithm based on fast matrix multiplication, in time proportional to the time for multiplying n×n matrices, approximately O(n2.37) using known matrix multiplication algorithms. For sparse graphs, with few edges, repeated breadth-first search is faster than matrix multiplication. Assuming the strong exponential time hypothesis, repeated breadth-first search is near-optimal: this hypothesis implies that no algorithm can achieve time O(m2−ε) for any ε>0. It is possible to approximate the diameter of a weighted graph to within an approximation ratio of 3/2, in time O~(min⁡(m3/2,mn2/3), where the O~ notation hides logarithmic factors in the time bound. Under the strong exponential time hypothesis, no substantially more accurate approximation, substantially faster than all pairs shortest paths, is possible.

In special classes of graphs The diameter can be computed in linear time for interval graphs, and in near-linear time for graphs of bounded treewidth. In median graphs, the diameter can be found in the subquadratic time bound O~(n1.6456). In any class of graphs closed under graph minors, such as the planar graphs, it is possible to compute the diameter in subquadratic time, with an exponent depending on the graph family.

See also Triameter (graph theory) Diameter (group theory), the diameter of a Cayley graph of the group, for generators chosen to make this diameter as large as possible Flip distance § Diameter of the flip graph, connecting pairs of triangulations by local moves

References

Illustrations

Diameter (graph theory): Graphs with diameters 5 and 28 respectively
Graphs with diameters 5 and 28 respectively

Worked examples

Example 1 — a first encounter with Diameter (graph theory)

Start with the simplest possible case. Write down what Diameter (graph theory) claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Diameter (graph theory) before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Diameter (graph theory) ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Diameter (graph theory)

In research
Diameter (graph theory) appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Diameter (graph theory) in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Diameter (graph theory) is common in secondary-school and first-year university syllabi. It links to neighbouring topics Computational problems in graph theory, Graph distance, Graph invariants, so understanding it makes those chapters shorter.
In everyday life
Look for Diameter (graph theory) outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Diameter (graph theory)” →

How to study Diameter (graph theory) in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Diameter (graph theory) means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Diameter (graph theory) out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Diameter (graph theory) in simple terms?

In graph theory, the diameter of a connected undirected graph is the farthest distance between any two of its vertices. That is, it is the diameter of a set for the set of vertices of the graph, and for the shortest-path distance in the graph.

Why does Diameter (graph theory) matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Diameter (graph theory)?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Diameter (graph theory).

Tags

  • Computational problems in graph theory
  • Graph distance
  • Graph invariants

Keep exploring