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.

DetailsDetails

  • Multiple edges between nodes are counted as separate.

ExamplesExamplesopen allclose all

Basic Examples  (2)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]=
Introduced in 2010
(8.0)
| Updated in 2015
(10.3)
Translate this page: