cnReorderNodes: Reorder Network Nodes

Description Usage Arguments Details Value Author(s) Examples

Description

The function rearranges the nodes of a network according to a new order.

Usage

1
cnReorderNodes(object, nodeIndices)

Arguments

object

a catNetwork

nodeIndices

a vector representing the new node order

Details

Node reordering affects the list of node names, parents and probabilities. It is a useful operation in cases when comparison of two networks is needed.

Value

A catNetwork object.

Author(s)

N. Balov

Examples

1
2
3
4
5
  cnet <- cnRandomCatnet(numnodes=10, maxpars=3, numcats=2)
  cnMatParents(cnet)
  cnet1 <- cnReorderNodes(object=cnet, nodeIndices=cnOrder(cnet))
  cnNodes(object=cnet1)
  cnMatParents(cnet1)

Example output

    N1 N2 N3 N4 N5 N6 N7 N8 N9 N10
N1   0  0  0  0  0  0  0  0  0   0
N2   0  0  0  0  0  1  0  0  0   0
N3   0  0  0  0  0  0  0  0  0   0
N4   0  0  0  0  0  1  0  1  1   0
N5   0  0  0  0  0  0  0  0  0   0
N6   0  0  0  0  0  0  0  0  0   0
N7   0  1  0  0  0  1  0  0  1   0
N8   0  0  0  0  0  0  0  0  0   0
N9   0  0  0  0  0  0  0  0  0   0
N10  0  0  1  0  0  0  0  1  0   0
 [1] "N1"  "N3"  "N5"  "N6"  "N8"  "N9"  "N10" "N2"  "N4"  "N7" 
    N1 N3 N5 N6 N8 N9 N10 N2 N4 N7
N1   0  0  0  0  0  0   0  0  0  0
N3   0  0  0  0  0  0   0  0  0  0
N5   0  0  0  0  0  0   0  0  0  0
N6   0  0  0  0  0  0   0  0  0  0
N8   0  0  0  0  0  0   0  0  0  0
N9   0  0  0  0  0  0   0  0  0  0
N10  0  1  0  0  1  0   0  0  0  0
N2   0  0  0  1  0  0   0  0  0  0
N4   0  0  0  1  1  1   0  0  0  0
N7   0  0  0  1  0  1   0  1  0  0

sdnet documentation built on May 2, 2019, 12:43 a.m.