frag.graph.reduce {archeofrag} | R Documentation |
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)
Arguments
graph |
An |
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. |
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.
Value
A fragmentation graph (igraph object) with less fragments (vertices).
Author(s)
Sebastien Plutniak <sebastien.plutniak at posteo.net>
See Also
frag.get.parameters
frag.get.layers.pair
Examples
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