Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

getdescendants (biograph)

Find descendants of a node in biograph object

Syntax

Nodes = getdescendants(BiographNode)
Nodes = getdescendants(BiographNode,NumGenerations)

Arguments

BiographNode

Node in a biograph object.

NumGenerations

Number of generations. Enter a positive integer.

Description

Nodes = getdescendants(BiographNode) finds a given node (BiographNode) all of its direct descendants.

Nodes = getdescendants(BiographNode,NumGenerations) finds the node (BiographNode) and all of its direct descendants up to a specified number of generations (NumGenerations). If the NumGenerations is 0, the function returns the node itself.

Examples

  1. 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)
  2. Find one generation of descendants for node 4.

    desNodes = getdescendants(bg.nodes(4));
    set(desNodes,'Color',[1 .7 .7]);
    bg.view;

  3. Find two generations of descendants for node 4.

    desNodes = getdescendants(bg.nodes(4),2);
    set(desNodes,'Color',[.7 1 .7]);
    bg.view;

More About

Introduced before R2006a

Was this topic helpful?