Undirected path(s) between two nodes {MXM} | R Documentation |
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. |
Details
The algorithm finds all the nodes between the two nodes. It finds all paths between the two chosen nodes.
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.
Author(s)
Michail Tsagris
R implementation and documentation: Michail Tsagris mtsagris@uoc.gr
References
Tsamardinos, Brown and Aliferis (2006). The max-min hill-climbing Bayesian network structure learning algorithm. Machine learning, 65(1), 31-78.
See Also
Examples
# simulate a dataset with continuous data
set.seed(1234)
dataset <- matrix(runif(1000 * 10, 1, 100), nrow = 1000 )
G <- pc.con(dataset)$G
plotnetwork(G)
undir.path(G, 3, 4)
undir.path(G, 1, 3)