Mirror 'root' functionality for leaf nodes
[cl-graph.git] / dev / api.lisp
index 332b881..955f5dd 100644 (file)
@@ -550,11 +550,22 @@ as a source. [?? Could be a defun]."))
   are out-going\). (cf. rootp) [?? could be a defun]"))
 
 
+(defgeneric graph-leafs (graph)
+  (:documentation "Returns a list of the leafs of graph. A leaf is
+  defined as a vertex with no target edges \(i.e., all of the edges
+  are incoming\). (cf. targetp) [?? could be a defun]"))
+
+
 (defgeneric rootp (vertex)
   (:documentation "Returns true if `vertex` is a root vertex \(i.e.,
   it has no incoming \(source\) edges\)."))
 
 
+(defgeneric leafp (vertex)
+  (:documentation "Returns true if `vertex` is a leaf vertex \(i.e.,
+  it has no outgoing \(target\) edges\)."))
+
+
 (defgeneric find-vertex-if (thing predicate &key key)
   (:documentation "Returns the first vertex in `thing` for which the
   `predicate` function returns non-nil. If the `key` is supplied, then