Skip to content

Commit ce3fa38

Browse files
committed
feat:Added &is-acyclic method.
1 parent 10792b0 commit ce3fa38

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/Graph.rakumod

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1006,6 +1006,12 @@ class Graph
10061006
return @cycles;
10071007
}
10081008

1009+
#------------------------------------------------------
1010+
#| Checks if the graph object is acyclic.
1011+
method is-acyclic() {
1012+
return self.find-cycle(:3min-length, max-length => Inf, :1count).elems == 0;
1013+
}
1014+
10091015
#======================================================
10101016
# Spanning tree
10111017
#======================================================

0 commit comments

Comments
 (0)