← All problemsSign in

Line Line Line Graph

CodeChefRating 2961Open on judge ↗

Consider an undirected graph $G$ with $N$ vertices and $M$ edges. A *line graph* $L(G)$ of this graph is a graph with $M$ vertices; each of these vertices corresponds to an edge in $G$ and two vertices in $L(G)$ are connected by an edge if the corresponding edges in $G$ have a common vertex. Let $L^k(G)$ denote the result of performing the operation "replace $G$ by $L(G)$" $k$ times, i.e. $L^1(

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start