Subtract Edges from an Adjacency List
subtract_edge(adj, v1, v2, ids = NULL, zero = TRUE)
list of adjacent precincts
vector of vertex identifiers for the first vertex. Can be an
integer index or a value to look up in ids
, if that argument is provided.
If more than one identifier is present, disconnects each to corresponding
entry in v2, if an edge exists.
vector of vertex identifiers for the second vertex. Can be an
integer index or a value to look up in ids
, if that argument is provided.
If more than one identifier is present, disconnects each to corresponding
entry in v2, if an edge exists.
A vector of identifiers which is used to look up the row indices
for the vertices. If provided, the entries in v1
and v2
must match
exactly one entry in ids
.
boolean, TRUE if adj
is zero indexed. False if one indexed.
adjacency list.
data(towns)
adj <- adjacency(towns)
subtract_edge(adj, 2, 3)
#> [[1]]
#> [1] 3 4 6
#>
#> [[2]]
#> [1] 4
#>
#> [[3]]
#> [1] 3 5
#>
#> [[4]]
#> [1] 0 4 2 6 5
#>
#> [[5]]
#> [1] 0 1 3 5
#>
#> [[6]]
#> [1] 3 4 2 6
#>
#> [[7]]
#> [1] 0 3 5
#>
subtract_edge(adj, "West Haverstraw", "Stony Point", towns$MUNI)
#> [[1]]
#> [1] 3 4 6
#>
#> [[2]]
#> [1] 4
#>
#> [[3]]
#> [1] 3 5
#>
#> [[4]]
#> [1] 0 4 2 6
#>
#> [[5]]
#> [1] 0 1 3 5
#>
#> [[6]]
#> [1] 4 2 6
#>
#> [[7]]
#> [1] 0 3 5
#>