I need to find all the nodes that are children of the selected node. The graph is designed like this: (Setic Graph 1 '(A (BC)) (B (DE)) (C (FG)) (D), (E (I)) (F), (G) and (H) (J)) (j ()))) So, all children of node b are (at first level), d, e, on second h, i, third j. Here's the code to get children of the first level, but as I am writing, I have been able to work for other people.
(defun sledG (cvor graf obradjeni) (cond ((null graph) '() () ((equal (Carr graph) Sewer) (Dodj (cadre charts) Obradjeni) (T ( sled Jivr (CDR graph) Obradjeni)) (Dipan Dodj (Potomsi Obradjeni) (code (tap Potomsi) ()) ((member (car Potmsi) Obradjeni) (Dodj (CDR Potomsi) Obradjeni) (t (cons (car Potomsi ) (Dodj (CDR Potomsi) Obradjeni))))) (Setk graph 1 '((A (BC)) (B (D)) (C (FG)) (D (H)) (e (i) () F (J)) (G) ((H)) (I) (J ()))
using the package:
((A B) ((A (BC)) (B) (C) (C) (D), (E (I)) (F (J)) (G) (I (j)) (J. Brown))) (continuous descent (tree label) (LE (t (generation (Nkkashin # 'cadre (delete-if-not (Elekghandria composition (Elekghandria: curry #' ACL label) #) Car) tree)) (Adding Generation (McCann (Alexandria: Curry # 'lineage offspring)) generation)));); (DEHJ) I believe Is that you Wanted to. This will work for the escalale graph, but it will do it "forever" if you have a circle in it. If you want to add a depth counter, you can add it as another logic on descendants or enter a counter counter in the last mapcan . > is included in the depth:
(root label (tree label) (label ((% descendant (depth label) (give (generation (map # cadre (delete- if- No (Alexandria composition (Alexandria: curry # AGL label) # 'car) tree))) (Aepend (Mapakar (Alexandria: #' Nrhwars (Alexandria: curry # 'of depth) type) (Mapaken (Alexandria: curry # '% Descendant (1 + Depth)) Production))))) (% Scion 0 Label)); (D) (E) (H1) (1 1) (J2))
No comments:
Post a Comment