Solution Explanation (Sketch)
Label the users asv1,2022 users asv1,v2,…,v2022v_1, v_2, \dots, v_{2022}v1,v2,…,v2022. We claim the minimum number of initial friendships (edges) needed is
Here is why:
A construction with 4041 edges that eventually becomes completeOne can arrange the users in a “chain of triangles”:First, make{v1,v2,v3,v1,v2,v3,v1,v2,v3}{v_1, v_2, v_3}{v1,v2,v3}all friends with each other (that’s one triangle with 3 edges).Then, for each new userv4,v5,…,v2022v_4, v_5, \ldots, v_{2022}v4,v5,…,v2022, introduce exactly 2 new edges tying that user to two consecutive vertices from the previous triangle. Concretely:{v2,v3,v4,v2,v3,v4,v2,v3,v4},{v3,v4,v5,v3,v4,v5,v3,v4,v5},…,{v2020,v2021,v2022,v2020,v2021,v2022,v2020,v2021,v2022}.{v_2, v_3, v_4},\quad {v_3, v_4, v_5},\quad \dots,\quad {v_{2020}, v_{2021}, v_{2022}}.{v2,v3,v4},{v3,v4,v5},…,{v2020,v2021,v2022}.Each new “triangle” beyond the first adds exactly 2 new edges (because two of its edges already existed from the overlap with the old of edges:The first triangle (usersv1,v2,v3v_1,v_2,v_3v1,v2,v3) has 3 edges.Each of the remaining2022−3= - 3 = −3=2019users is introduced by adding 2 new edges.Total initial edges=3+2×2019=4041.= 3 + 2 \times 2019 = 4041.=3+2×2019=4041.Why this eventually becomes a clique:In this chain-of-triangles setup, any two vertices in adjacent triangles already share two common neighbors, so they become friends. Once one new edge appears, it provides even more shared neighbors for other pairs, triggering a cascade. In fact, you can show inductively that the entire set of vertices merges into one giant clique.
First, make{v1,v2,v3,v1,v2,v3,v1,v2,v3}{v_1, v_2, v_3}{v1,v2,v3}all friends with each other (that’s one triangle with 3 edges).
Then, for each new userv4,v5,…,v2022v_4, v_5, \ldots, v_{2022}v4,v5,…,v2022, introduce exactly 2 new edges tying that user to two consecutive vertices from the previous triangle. Concretely:{v2,v3,v4,v2,v3,v4,v2,v3,v4},{v3,v4,v5,v3,v4,v5,v3,v4,v5},…,{v2020,v2021,v2022,v2020,v2021,v2022,v2020,v2021,v2022}.{v_2, v_3, v_4},\quad {v_3, v_4, v_5},\quad \dots,\quad {v_{2020}, v_{2021}, v_{2022}}.{v2,v3,v4},{v3,v4,v5},…,{v2020,v2021,v2022}.
Count of edges:The first triangle (usersv1,v2,v3v_1,v_2,v_3v1,v2,v3) has 3 edges.Each of the remaining2022−3= - 3 = −3=2019users is introduced by adding 2 new edges.Total initial edges=3+2×2019=4041.= 3 + 2 \times 2019 = 4041.=3+2×2019=4041.
The first triangle (usersv1,v2,v3v_1,v_2,v_3v1,v2,v3) has 3 edges.
Each of the remaining2022−3= - 3 = −3=2019users is introduced by adding 2 new edges.
Total initial edges=3+2×2019=4041.= 3 + 2 \times 2019 = 4041.=3+2×2019=4041.
Why this eventually becomes a clique:In this chain-of-triangles setup, any two vertices in adjacent triangles already share two common neighbors, so they become friends. Once one new edge appears, it provides even more shared neighbors for other pairs, triggering a cascade. In fact, you can show inductively that the entire set of vertices merges into one giant clique.
Why you cannot do it with fewer than 4041 edgesAt the very start, you need at least a triangle (3 edges) somewhere to “seed” the process; pairs of vertices need two common friends to create new edges. A single edge or even a pair of edges does not allow any new edge to form.Past those first 3 vertices, each newly introduced vertex must initially connect toat leasttwo existing vertices (otherwise, it can never gain the second friend needed to spread edges further). That forces at least 2 new edges per additional vertex.Hence you cannot go below333(for the first triangle) plus2×(2022−3)2 \times (2022-3)2×(2022−3)(for the remaining 2019 vertices).
At the very start, you need at least a triangle (3 edges) somewhere to “seed” the process; pairs of vertices need two common friends to create new edges. A single edge or even a pair of edges does not allow any new edge to form.
Past those first 3 vertices, each newly introduced vertex must initially connect toat leasttwo existing vertices (otherwise, it can never gain the second friend needed to spread edges further). That forces at least 2 new edges per additional vertex.
Hence you cannot go below333(for the first triangle) plus2×(2022−3)2 \times (2022-3)2×(2022−3)(for the remaining 2019 vertices).
A construction with 4041 edges that eventually becomes completeOne can arrange the users in a “chain of triangles”:
First, make{v1,v2,v3,v1,v2,v3,v1,v2,v3}{v_1, v_2, v_3}{v1,v2,v3}all friends with each other (that’s one triangle with 3 edges).
Then, for each new userv4,v5,…,v2022v_4, v_5, \ldots, v_{2022}v4,v5,…,v2022, introduce exactly 2 new edges tying that user to two consecutive vertices from the previous triangle. Concretely:{v2,v3,v4,v2,v3,v4,v2,v3,v4},{v3,v4,v5,v3,v4,v5,v3,v4,v5},…,{v2020,v2021,v2022,v2020,v2021,v2022,v2020,v2021,v2022}.{v_2, v_3, v_4},\quad {v_3, v_4, v_5},\quad \dots,\quad {v_{2020}, v_{2021}, v_{2022}}.{v2,v3,v4},{v3,v4,v5},…,{v2020,v2021,v2022}.
First, make{v1,v2,v3,v1,v2,v3,v1,v2,v3}{v_1, v_2, v_3}{v1,v2,v3}all friends with each other (that’s one triangle with 3 edges).
Then, for each new userv4,v5,…,v2022v_4, v_5, \ldots, v_{2022}v4,v5,…,v2022, introduce exactly 2 new edges tying that user to two consecutive vertices from the previous triangle. Concretely:
Each new “triangle” beyond the first adds exactly 2 new edges (because two of its edges already existed from the overlap with the old triangle).
Count of edges:The first triangle (usersv1,v2,v3v_1,v_2,v_3v1,v2,v3) has 3 edges.Each of the remaining2022−3= - 3 = −3=2019users is introduced by adding 2 new edges.Total initial edges=3+2×2019=4041.= 3 + 2 \times 2019 = 4041.=3+2×2019=4041.
The first triangle (usersv1,v2,v3v_1,v_2,v_3v1,v2,v3) has 3 edges.
Each of the remaining2022−3= - 3 = −3=2019users is introduced by adding 2 new edges.
Total initial edges=3+2×2019=4041.= 3 + 2 \times 2019 = 4041.=3+2×2019=4041.
Why this eventually becomes a clique:In this chain-of-triangles setup, any two vertices in adjacent triangles already share two common neighbors, so they become friends. Once one new edge appears, it provides even more shared neighbors for other pairs, triggering a cascade. In fact, you can show inductively that the entire set of vertices merges into one giant clique.
Count of edges:
The first triangle (usersv1,v2,v3v_1,v_2,v_3v1,v2,v3) has 3 edges.
Each of the remaining2022−3= - 3 = −3=2019users is introduced by adding 2 new edges.
Total initial edges=3+2×2019=4041.= 3 + 2 \times 2019 = 4041.=3+2×2019=4041.
The first triangle (usersv1,v2,v3v_1,v_2,v_3v1,v2,v3) has 3 edges.
Each of the remaining2022−3= - 3 = −3=2019users is introduced by adding 2 new edges.
Total initial edges=3+2×2019=4041.= 3 + 2 \times 2019 = 4041.=3+2×2019=4041.
Why this eventually becomes a clique:In this chain-of-triangles setup, any two vertices in adjacent triangles already share two common neighbors, so they become friends. Once one new edge appears, it provides even more shared neighbors for other pairs, triggering a cascade. In fact, you can show inductively that the entire set of vertices merges into one giant clique.
Why you cannot do it with fewer than 4041 edges
At the very start, you need at least a triangle (3 edges) somewhere to “seed” the process; pairs of vertices need two common friends to create new edges. A single edge or even a pair of edges does not allow any new edge to form.
Past those first 3 vertices, each newly introduced vertex must initially connect toat leasttwo existing vertices (otherwise, it can never gain the second friend needed to spread edges further). That forces at least 2 new edges per additional vertex.
Hence you cannot go below333(for the first triangle) plus2×(2022−3)2 \times (2022-3)2×(2022−3)(for the remaining 2019 vertices).
At the very start, you need at least a triangle (3 edges) somewhere to “seed” the process; pairs of vertices need two common friends to create new edges. A single edge or even a pair of edges does not allow any new edge to form.
Past those first 3 vertices, each newly introduced vertex must initially connect toat leasttwo existing vertices (otherwise, it can never gain the second friend needed to spread edges further). That forces at least 2 new edges per additional vertex.
Hence you cannot go below333(for the first triangle) plus2×(2022−3)2 \times (2022-3)2×(2022−3)(for the remaining 2019 vertices).
Consequently,