getrelatives (biograph)

Find relatives of a node in biograph object

Syntax

Nodes = getrelatives(BiographNode)
Nodes = getrelatives(BiographNode,NumGenerations)

Arguments

BiographNode

Node in a biograph object.

NumGenerations

Number of generations. Enter a positive integer.

Description

Nodes = getrelatives(BiographNode) finds all the direct relatives for a given node (BiographNode).

Nodes = getrelatives(BiographNode,NumGenerations) finds the direct relatives for a given node (BiographNode) 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 all nodes interacting with node 1.

    intNodes = getrelatives(bg.nodes(1));
    set(intNodes,'Color',[.7 .7 1]);
    bg.view;
Introduced before R2006a