Exercise · ZW-PATH-IN-A-GRAPH-009 · ★★★ Advanced

A graph has edges \(12, 23, 34, 45, 16, 65, 25\). What is the distance (length of a shortest path) between \(1\) and \(4\)?

Choose one option.

Show answer
  • C. 3

Explanation

A shortest path is 1, 2, 5, 4 (or 1, 6, 5, 4) of length 3; no path of length 2 exists because 1 and 4 have no common neighbour.

Study Discrete mathematics in ZWMath →

Review the concept: Path in a graph

A path of length \(k\) is a sequence of vertices \(v_0,\dots,v_k\) such that each consecutive pair is joined by an edge of \(E\).

\[\{v_{i-1},v_i\}\in E,\qquad i=1,\dots,k\]

More practice problems: path in a graph

← ZW-PATH-IN-A-GRAPH-008 ZW-PATH-IN-A-GRAPH-010 →