Learn R Programming

archeofrag (version 1.2.0)

frag.graph.reduce: Reduce the size of a fragmentation graph

Description

Remove fragments from a fragmentation graph

Usage

frag.graph.reduce(graph=NULL, n.frag.to.remove=NULL, conserve.objects.nr=FALSE,
       conserve.fragments.balance=FALSE, conserve.inter.units.connection=FALSE,
       verbose=FALSE)

Value

A fragmentation graph (igraph object) with less fragments (vertices).

Arguments

graph

An igraph object.

n.frag.to.remove

Integer. Number of fragments (i.e. vertices) to remove.

conserve.objects.nr

Logical. If TRUE, preserve the number of objects (i.e. connected components) in the graph.

conserve.fragments.balance

Logical. If TRUE, try to preserve the proportion of fragments in the first and second spatial unit ('balance').

conserve.inter.units.connection

Logical. If TRUE, preserve a part of the connection relationships between fragments from different spatial units (see details).

verbose

Logical. Whether to print or not warning messages.

Author

Sebastien Plutniak <sebastien.plutniak at posteo.net>

Details

This function reduces the number of fragments in a fragmentation graph, while controlling that no singleton are created, and (optionally) that the output graph and the input graph have the same number of connected components. Note that if 'conserve.objects.nr' is TRUE then the reduction process might stop before reaching the number of fragments to remove (when the graph only contains pairs of fragments). Similarly, if 'conserve.fragments.balance' is TRUE, then the result is as close as possible from the initial proportion of fragments (i.e. 'frag.get.parameters()' 'balance' output value). Finally, if 'conserve.inter.units.connection' is TRUE, the proportion of connection relationships (i.e. graph edges) between fragments from different spatial units to conserve is equal to the proportion of fragments (i.e. vertices) to preserve.

See Also

frag.get.parameters frag.get.layers.pair

Examples

Run this code
g <- frag.simul.process(n.components=15, vertices=50, disturbance=.15) 
igraph::gorder(g)
igraph::components(g)$no
# reduce the number of framents and conserve the number of connected components:
g1 <- frag.graph.reduce(g, n.frag.to.remove = 40, conserve.objects.nr = TRUE)
igraph::gorder(g1)
igraph::components(g1)$no
# reduce the number of framents and do not conserve the number of connected components:
g2 <- frag.graph.reduce(g, n.frag.to.remove = 40, conserve.objects.nr = FALSE)
igraph::gorder(g2)
igraph::components(g2)$no

Run the code above in your browser using DataLab