remove_nodes {spatgraphs} | R Documentation |
Remove edges connected to certain nodes
Description
Remove the existence of particular nodes from the graph.
Usage
remove_nodes(g, i, fuse = FALSE, verb = FALSE)
Arguments
g |
sg object |
i |
indices of nodes for which to remove the edges |
fuse |
Should the neighours of removed nodes be connected? |
verb |
verbose? |
Details
Basically, just clear the neighbourhood of selected indices. If fuse=TRUE, connect neighbours together (excluding i's). Should work over several remove nodes along a path.
Note: g should be symmetric. use sg2sym to force symmetry, it is not checked.
Warning: In development.
Examples
x <- matrix(runif(200), ncol=2)
g <- spatgraph(x, "RST", c(1,0))
g <- sg2sym(g)
i <- sample(100, 50)
k <- setdiff(1:100, i)
gs <- remove_nodes(g, i, fuse=TRUE)
plot(g,x, add=FALSE)
points(x[k,], pch=19, col=4)
plot(gs, x, add=TRUE, lty=2, col=3)
[Package spatgraphs version 3.4 Index]