GraphTheory - Maple Programming Help

Home : Support : Online Help : Mathematics : Discrete Mathematics : Graph Theory : GraphTheory Package : GraphTheory/NumberOfEdges

GraphTheory

 NumberOfEdges
 NumberOfVertices

 Calling Sequence NumberOfEdges(G,opts) NumberOfVertices(G)

Parameters

 G - a graph opts - zero or or more options as specified below

Options

 • selfloops=truefalse
 Specifies whether self-loops should be included in the count of edges returned. The default value is true.

Description

 • The NumberOfEdges(G,opts) command returns the number of edges (or arcs) in G.
 • The NumberOfVertices(G) command returns the number of vertices in G.

Examples

 > $\mathrm{with}\left(\mathrm{GraphTheory}\right):$
 > $\mathrm{K4}≔\mathrm{CompleteGraph}\left(4\right)$
 ${\mathrm{K4}}{≔}{\mathrm{Graph 1: an undirected unweighted graph with 4 vertices and 6 edge\left(s\right)}}$ (1)
 > $\mathrm{NumberOfVertices}\left(\mathrm{K4}\right)$
 ${4}$ (2)
 > $\mathrm{NumberOfEdges}\left(\mathrm{K4}\right)$
 ${6}$ (3)
 > $H≔\mathrm{Digraph}\left(\mathrm{Trail}\left(1,2,3,1,4,3\right),\mathrm{Trail}\left(4,2,1,3\right)\right):$
 > $\mathrm{NumberOfVertices}\left(H\right)$
 ${4}$ (4)
 > $\mathrm{NumberOfEdges}\left(H\right)$
 ${8}$ (5)

Compatibility

 • The selfloops option was introduced in Maple 2020.