remove_nodes: Remove edges connected to certain nodes

View source: R/remove_nodes.R

remove_nodesR 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)


spatgraphs documentation built on Feb. 16, 2023, 8:49 p.m.