EdgeCount
✖
EdgeCount
Examples
open allclose allBasic Examples (2)Summary of the most common use cases

https://wolfram.com/xid/0cg4pc29u-b1kkxi


https://wolfram.com/xid/0cg4pc29u-b3rg0e

Count the number of edges that match a pattern:

https://wolfram.com/xid/0cg4pc29u-olztr

The number of edges incident to 1:

https://wolfram.com/xid/0cg4pc29u-fzbrwl

Scope (7)Survey of the scope of standard use cases
EdgeCount works with undirected graphs:

https://wolfram.com/xid/0cg4pc29u-y99orn


https://wolfram.com/xid/0cg4pc29u-f3ma9n


https://wolfram.com/xid/0cg4pc29u-uvnf7h


https://wolfram.com/xid/0cg4pc29u-5geyu

Use rules to specify the graph:

https://wolfram.com/xid/0cg4pc29u-bndh30

Use a pattern to count a subset of edges:

https://wolfram.com/xid/0cg4pc29u-53nmq


https://wolfram.com/xid/0cg4pc29u-cszard


https://wolfram.com/xid/0cg4pc29u-cnnizt


https://wolfram.com/xid/0cg4pc29u-pq9ae

https://wolfram.com/xid/0cg4pc29u-lgy7yy

Generalizations & Extensions (1)Generalized and extended use cases
Count the number of edges on symbolic graph constructors:

https://wolfram.com/xid/0cg4pc29u-kaghv3


https://wolfram.com/xid/0cg4pc29u-b77x3e


https://wolfram.com/xid/0cg4pc29u-bxol7n


https://wolfram.com/xid/0cg4pc29u-dnfq4d


https://wolfram.com/xid/0cg4pc29u-fre4dl


https://wolfram.com/xid/0cg4pc29u-ngm30


https://wolfram.com/xid/0cg4pc29u-ie64y


https://wolfram.com/xid/0cg4pc29u-dnjiv


https://wolfram.com/xid/0cg4pc29u-iymgk


https://wolfram.com/xid/0cg4pc29u-0kvl6


https://wolfram.com/xid/0cg4pc29u-kqp2v9


https://wolfram.com/xid/0cg4pc29u-bzvv78

Applications (2)Sample problems that can be solved with this function
The minimum number of edges in a connected graph with vertices is
:

https://wolfram.com/xid/0cg4pc29u-bge9sr


https://wolfram.com/xid/0cg4pc29u-bkwc58

A path graph with vertices has exactly
edges:

https://wolfram.com/xid/0cg4pc29u-iqoccl


https://wolfram.com/xid/0cg4pc29u-tfe5e

The number of edges for Bernoulli graphs with probability on
vertices has mean
:

https://wolfram.com/xid/0cg4pc29u-lqqrc2

https://wolfram.com/xid/0cg4pc29u-8xqbp


https://wolfram.com/xid/0cg4pc29u-bgrhnr


https://wolfram.com/xid/0cg4pc29u-bz6k12

Properties & Relations (7)Properties of the function, and connections to other functions
The number of edges of CompleteGraph[n]:

https://wolfram.com/xid/0cg4pc29u-uaq6r

EdgeCount can be found using EdgeList:

https://wolfram.com/xid/0cg4pc29u-rtzao


https://wolfram.com/xid/0cg4pc29u-cnrlqt


https://wolfram.com/xid/0cg4pc29u-dw7ac3

The number of edges for a directed graph can be found from matrix representations:

https://wolfram.com/xid/0cg4pc29u-dxrnuc


https://wolfram.com/xid/0cg4pc29u-b6qsb8

Totaling the adjacency matrix:

https://wolfram.com/xid/0cg4pc29u-bci0zk

The number of columns of the incidence matrix:

https://wolfram.com/xid/0cg4pc29u-h2ry9v

The number of edges for an undirected graph can be found from matrix representations:

https://wolfram.com/xid/0cg4pc29u-dn3kq0


https://wolfram.com/xid/0cg4pc29u-0nrde

The total of the upper (or lower) triangular part of the adjacency matrix:

https://wolfram.com/xid/0cg4pc29u-burep

The number of columns of the incidence matrix:

https://wolfram.com/xid/0cg4pc29u-l1r5kf

Totaling the diagonal elements of the Kirchhoff matrix, divided by 2:

https://wolfram.com/xid/0cg4pc29u-c6ou08

The number of edges of the graph is equal to the number of vertices of its line graph:

https://wolfram.com/xid/0cg4pc29u-bv7fow


https://wolfram.com/xid/0cg4pc29u-fvjkui

The sum of the degrees of all vertices of a graph is twice the number of edges:

https://wolfram.com/xid/0cg4pc29u-nc90z


https://wolfram.com/xid/0cg4pc29u-dga86

The underlying undirected graph of a graph g has the same number of edges as g:

https://wolfram.com/xid/0cg4pc29u-1sko1


https://wolfram.com/xid/0cg4pc29u-qhgql

Wolfram Research (2010), EdgeCount, Wolfram Language function, https://reference.wolfram.com/language/ref/EdgeCount.html (updated 2015).
Text
Wolfram Research (2010), EdgeCount, Wolfram Language function, https://reference.wolfram.com/language/ref/EdgeCount.html (updated 2015).
Wolfram Research (2010), EdgeCount, Wolfram Language function, https://reference.wolfram.com/language/ref/EdgeCount.html (updated 2015).
CMS
Wolfram Language. 2010. "EdgeCount." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2015. https://reference.wolfram.com/language/ref/EdgeCount.html.
Wolfram Language. 2010. "EdgeCount." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2015. https://reference.wolfram.com/language/ref/EdgeCount.html.
APA
Wolfram Language. (2010). EdgeCount. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/EdgeCount.html
Wolfram Language. (2010). EdgeCount. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/EdgeCount.html
BibTeX
@misc{reference.wolfram_2025_edgecount, author="Wolfram Research", title="{EdgeCount}", year="2015", howpublished="\url{https://reference.wolfram.com/language/ref/EdgeCount.html}", note=[Accessed: 08-July-2025
]}
BibLaTeX
@online{reference.wolfram_2025_edgecount, organization={Wolfram Research}, title={EdgeCount}, year={2015}, url={https://reference.wolfram.com/language/ref/EdgeCount.html}, note=[Accessed: 08-July-2025
]}