Parent, Child, Ancestor and Descendant
Parent, Child, Ancestor and Descendant
- If there is an edge A®B, then A is said to be a parent of B, and B is said to be a child of A.
- If there is a directed path from A to D, i.e. A®…®D, or A=D then A is said to be an ancestor of D, and D is said to be a descendant of A.
- Note: Every vertex is its own ancestor and descendant.
- Parents(X) = {V | V ® X}
- Parents(Z)={V | V ® W for some W Î Z}
- Likewise for Child, Descendant, Ancestor etc.,