Learn R Programming

MXM (version 0.9.7)

Undirected path(s) between two nodes: Undirected path(s) between two nodes

Description

Undirected path(s) between two nodes.

Usage

undir.path(G, y, x)

Arguments

G
An adjacency matrix where G[i,j] = G[j, i] = 1 means there is an edge between nodes i and j. If G[i, j] = G[j, i] = 0 there is no edge between them.
y
A numerical value indicating the first node, it has to be a number between 1 and the maximum number of variables.
x
A numerical value indicating the second node, it has to be a number between 1 and the maximum number of variables. The order of the nodes does not make a difference.

Value

A vector with the two nodes and all nodes between them in the case of connecting nodes. Otherwise, a matrix with the neighbours of each node.

Details

The algorithm finds all the nodes between the tow nodes. It finds all paths between the two chosen nodes.

References

Tsamardinos, Brown and Aliferis (2006). The max-min hill-climbing Bayesian network structure learning algorithm. Machine learning, 65(1), 31-78.

See Also

SES, MMPC, pc.skel

Examples

Run this code
# simulate a dataset with continuous data
set.seed(1234)
dataset <- matrix(runif(1000 * 20, 1, 100), nrow = 1000 ) 
G <- pc.con(dataset)$G
plotnetwork(G)
undir.path(G, 3, 4)
undir.path(G, 1, 3)

Run the code above in your browser using DataLab