remove_nodes: Remove edges connected to certain nodes

Description Usage Arguments Details Examples

View source: R/remove_nodes.R

Description

Remove the existence of particular nodes from the graph.

Usage

1
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

1
2
3
4
5
6
7
8
9
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 July 1, 2020, 5:46 p.m.