vertex of the graph
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.
G≔Graph 1: a directed unweighted graph with 4 vertices, 4 arc(s), and 1 self-loop(s)
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.
Download Help Document
What kind of issue would you like to report? (Optional)