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

  • Multiple edges between nodes are counted as separate.

Examples

open allclose all

Basic Examples  (2)

Count the number of edges:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=

Count the number of edges that match a pattern:

In[1]:=
Click for copyable input
Out[1]=

The number of edges incident to 1:

In[2]:=
Click for copyable input
Out[2]=

Scope  (7)

Generalizations & Extensions  (1)

Applications  (2)

Properties & Relations  (7)

See Also

EdgeList  VertexCount  AdjacencyMatrix  IncidenceMatrix  Graph

Introduced in 2010
(8.0)
| Updated in 2015
(10.3)