Search code examples
algorithmgraphedge-detection

Find the maximum number of edges in the graph


There are 'n' vertices and 0 edges of an undirected graph. What can be the maximum number of edges that we can draw such that the graph remains disconnected.

I have made the solution that we can exclude one vertex and can find the maximum number of edges between n-1 vertices of undirected graph, so that the graph still remains disconnected.

which is n(n-1)/2 for n vertices and will be (n-1)(n-2)/2 for n-1 vertices. Can there be a better solution?


Solution

  • Your solution should be the best solution.

    Because any new edge added must have the nth vertex at one end.