View source: R/frag.graph.reduce.R
| frag.graph.reduce | R Documentation |
Remove fragments from a fragmentation graph
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)
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 units ('balance'). |
conserve.inter.units.connection |
Logical. If TRUE, preserve the proportion of connection relationships between fragments located in different spatial units (see details). |
verbose |
Logical. Whether to print or not warning messages. |
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.
A fragmentation graph (igraph object) with less fragments (vertices).
Sebastien Plutniak <sebastien.plutniak at posteo.net>
frag.get.parameters
frag.get.layers.pair
g <- frag.simul.process(n.components=15, vertices=50, disturbance=.15)
igraph::gorder(g)
igraph::components(g)$no
# reduce the number of fragments 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 fragments 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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.