What is the maximum number of edges in a directed graph with n nodes?

前端 未结 12 2060
迷失自我
迷失自我 2020-12-07 17:13

What is the maximum number of edges in a directed graph with n nodes? Is there any upper bound?

12条回答
  •  忘掉有多难
    2020-12-07 17:57

    Putting it another way:

    A complete graph is an undirected graph where each distinct pair of vertices has an unique edge connecting them. This is intuitive in the sense that, you are basically choosing 2 vertices from a collection of n vertices.

    nC2 = n!/(n-2)!*2! = n(n-1)/2
    

    This is the maximum number of edges an undirected graph can have. Now, for directed graph, each edge converts into two directed edges. So just multiply the previous result with two. That gives you the result: n(n-1)

提交回复
热议问题