Neighbours of nodes in an undirected graph | R Documentation |
Returns the node(s) and their neighbour(s) of one or more nodes (if there are any).
nei(G, node)
G |
The adjacency matrix of an undirected graph as produced by |
node |
A vector with one or more numbers indicating the seleted node(s) (or variable(s)). |
This is a way to see the network for some given nodes. It is useful if you have many nodes and the whole network is a bit difficult to see clearly.
A list object called "geit" containing the neighbours of the node(s). If there are no neighbours a message appears and no plot is presented. If the "graph" argument is set to TRUE and there are neighbours, a plot will appear.
Bear in mind that the values can be extracted with the $ symbol, i.e. this is an S3 class output.
Michail Tsagris
R implementation and documentation: Michail Tsagris mtsagris@uoc.gr
mmhc.skel, SES, MMPC
# simulate a dataset with continuous data set.seed(1234) dataset <- matrix(runif(500 * 20, 1, 100), nrow = 500 ) G <- pc.con(dataset)$G plotnetwork(G) dev.new() nei( G, c(3, 4) ) nei( G, c(1, 3) )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.