HasSelfLoop - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.
Our website is currently undergoing maintenance, which may result in occasional errors while browsing. We apologize for any inconvenience this may cause and are working swiftly to restore full functionality. Thank you for your patience.

Online Help

All Products    Maple    MapleSim


GraphTheory

  

HasSelfLoop

  

test if graph has a self-loop

  

NumberOfSelfLoops

  

count number of self-loops in graph

  

SelfLoops

  

construct list of self-loops in graph

 

Calling Sequence

Parameters

Description

Examples

Compatibility

Calling Sequence

HasSelfLoop(G)

HasSelfLoop(G, v)

NumberOfSelfLoops(G)

SelfLoops(G)

Parameters

G

-

graph

v

-

vertex of the graph

Description

• 

If v is a vertex of the graph, HasSelfLoop(G,v) returns true if the graph G has an edge or arc v to itself, and false otherwise.

• 

The NumberOfSelfLoops(G) command returns the number of self-loops in G.

• 

The SelfLoops(G) command returns a set of self-loops in G.

• 

Because the data structure for a graph is an array of sets of neighbors, the test for self-loop existence checks each neighbor set and the cost is O(n) where n is the number of vertices.

Examples

withGraphTheory:

GGraph1,2,2,3,3,3,3,4,4,1

GGraph 1: a directed graph with 4 vertices, 4 arc(s), and 1 self-loop(s)

(1)

HasSelfLoopG,2

false

(2)

HasSelfLoopG,3

true

(3)

NumberOfSelfLoopsG

1

(4)

Compatibility

• 

The GraphTheory[HasSelfLoop], GraphTheory[NumberOfSelfLoops] and GraphTheory[SelfLoops] commands were introduced in Maple 2020.

• 

For more information on Maple 2020 changes, see Updates in Maple 2020.

See Also

Graph

HighlightEdges