Find ancestors of a node in biograph object
Node
= getancestors(BiographNode
)
Node
= getancestors(BiographNode,
NumGenerations
)
| Node in a biograph object. |
| Number of generations. Enter a positive integer. |
returns
a node (Node
= getancestors(BiographNode
)BiographNode
) and all of its direct ancestors.
finds the node (Node
= getancestors(BiographNode,
NumGenerations
)BiographNode
)
and its direct ancestors up to a specified number of generations (NumGenerations
).
If NumGenerations
is 0
,
the function returns the node itself.
Create a biograph object.
cm = [0 1 1 0 0;1 0 0 1 1;1 0 0 0 0;0 0 0 0 1;1 0 1 0 0]; bg = biograph(cm)
Find one generation of ancestors for node 2.
ancNodes = getancestors(bg.nodes(2)); set(ancNodes,'Color',[1 .7 .7]); bg.view;
Find two generations of ancestors for node 2.
ancNodes = getancestors(bg.nodes(2),2); set(ancNodes,'Color',[.7 1 .7]); bg.view;
biograph
| dolayout
| get
| getancestors
| getdescendants
| getedgesbynodeid
| getnodesbyid
| getrelatives
| set
| view