EdgeCount

EdgeCount[g]

gives a count of the number of edges in the graph g.

EdgeCount[g,patt]

gives a count of the number of edges that match the pattern patt.

EdgeCount[{vw,},]

uses rules vw to specify the graph g.

Details

  • EdgeCount is also known as the size of the graph.
  • Multiple edges between nodes are counted as separate.
  • EdgeCount works with undirected graphs, directed graphs, multigraphs and mixed graphs.

Examples

open allclose all

Basic Examples  (2)

Count the number of edges:

Count the number of edges that match a pattern:

The number of edges incident to 1:

Scope  (7)

EdgeCount works with undirected graphs:

Directed graphs:

Multigraphs:

Mixed graphs:

Use rules to specify the graph:

Use a pattern to count a subset of edges:

Works with large graphs:

Generalizations & Extensions  (1)

Count the number of edges on symbolic graph constructors:

Applications  (2)

The minimum number of edges in a connected graph with vertices is :

A path graph with vertices has exactly edges:

The number of edges for Bernoulli graphs with probability on vertices has mean pTemplateBox[{n, 2}, Binomial]:

The standard deviation is sqrt(p (1-p) TemplateBox[{n, 2}, Binomial]):

The full distribution:

Properties & Relations  (7)

The number of edges of CompleteGraph[n]:

EdgeCount can be found using EdgeList:

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

Totaling the adjacency matrix:

The number of columns of the incidence matrix:

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

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

The number of columns of the incidence matrix:

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

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

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

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

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).

CMS

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

BibTeX

@misc{reference.wolfram_2024_edgecount, author="Wolfram Research", title="{EdgeCount}", year="2015", howpublished="\url{https://reference.wolfram.com/language/ref/EdgeCount.html}", note=[Accessed: 22-November-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_edgecount, organization={Wolfram Research}, title={EdgeCount}, year={2015}, url={https://reference.wolfram.com/language/ref/EdgeCount.html}, note=[Accessed: 22-November-2024 ]}