WLJS LogoWLJS Notebook

EdgeCount

EdgeCount[g] gives the number of edges in graph g. EdgeCount[g, patt] counts edges matching the pattern.

Examples

Count edges:

EdgeCount[CompleteGraph[5]]
(* 10 - n*(n-1)/2 for complete graph *)

EdgeCount[CycleGraph[10]]
(* 10 *)

Edge count in grid:

EdgeCount[GridGraph[{3, 3}]]
(* 12 *)

Please visit the official Wolfram Language Reference for more details.

On this page