Max number of edges in a graph with n vertices without $P_3$

339 Views Asked by At

Find max number of edges in a graph with n vertices without a $P_3$ structure.

*Note $P_3$ denotes the path with four vertices and three edges.

I have two solutions:

  1. dividing n by 5 and forming a star structure for every 5 vertices (center vertex of degree 4 is connected to all 4 other vertices). I believe this is the optimal substructure of 5 vertices as if we add any more edge to this substructure of 5 vertices, it would introduce a path of length 3.
  2. dividing n by 3 so we form as many triangles ($K_3$) as possible as 3-cycles do not contain a path of length 3.

The answer should be 2 I believe as 2 is more dense in terms of ratio of edges/vertices but how do i prove that 2. is the optimal way.

Any help is appreciated thanks!