What is the maximum number of edges in a directed

2019-01-21 15:58发布

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

11条回答
祖国的老花朵
2楼-- · 2019-01-21 16:11

Undirected is N^2. Simple - every node has N options of edges (himself included), total of N nodes thus N*N

查看更多
相关推荐>>
3楼-- · 2019-01-21 16:12

Directed graph:

Question: What's the maximum number of edges in a directed graph with n vertices?

  • Assume there are no self-loops.
  • Assume there there is at most one edge from a given start vertex to a given end vertex.

Each edge is specified by its start vertex and end vertex. There are n choices for the start vertex. Since there are no self-loops, there are n-1 choices for the end vertex. Multiplying these together counts all possible choices.

Answer: n(n−1)

Undirected graph

Question: What's the maximum number of edges in an undirected graph with n vertices?

  • Assume there are no self-loops.
  • Assume there there is at most one edge from a given start vertex to a given end vertex.

In an undirected graph, each edge is specified by its two endpoints and order doesn't matter. The number of edges is therefore the number of subsets of size 2 chosen from the set of vertices. Since the set of vertices has size n, the number of such subsets is given by the binomial coefficient C(n,2) (also known as "n choose 2"). Using the formula for binomial coefficients, C(n,2) = n(n-1)/2.

Answer: (n*(n-1))/2

查看更多
聊天终结者
4楼-- · 2019-01-21 16:14

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)

查看更多
不美不萌又怎样
5楼-- · 2019-01-21 16:15

The correct answer is n*(n-1)/2. Each edge has been counted twice, hence the division by 2. A complete graph has the maximum number of edges, which is given by n choose 2 = n*(n-1)/2.

查看更多
We Are One
6楼-- · 2019-01-21 16:16

If the graph is not a multi graph then it is clearly n * (n - 1), as each node can at most have edges to every other node. If this is a multigraph, then there is no max limit.

查看更多
该账号已被封号
7楼-- · 2019-01-21 16:20

If you have N nodes, there are N - 1 directed edges than can lead from it (going to every other node). Therefore, the maximum number of edges is N * (N - 1).

查看更多
登录 后发表回答