Description Usage Arguments Details Value References Examples
Given a connected weighted directed graph,
getMinimumArborescence
computes a minimum cost
arborescence. This function provides a method to find the
minimum cost arborescence with Edmonds' algorithm.
1 2 3 | getMinimumArborescence(nodes, arcs, source.node = 1, algorithm = "Edmonds",
stages.data = FALSE, show.data = TRUE, show.graph = TRUE,
check.graph = FALSE)
|
nodes |
vector containing the nodes of the graph, identified by a number that goes from 1 to the order of the graph. |
arcs |
matrix with the list of arcs of the graph. Each row represents one arc. The first two columns contain the two endpoints of each arc and the third column contains their weights. |
source.node |
number pointing to the source node of the graph. It's node 1 by default. |
algorithm |
denotes the algorithm used to find a minimum cost arborescence: "Edmonds". |
check.graph |
logical value indicating if it is
necesary to check the graph. Is |
show.data |
logical value indicating if the function
displays the console output ( |
show.graph |
logical value indicating if the
function displays a graphical representation of the graph
and its minimum arborescence ( |
stages.data |
logical value indicating if the
function returns data of each stage. The default is
|
Given a connected weighted directed graph, a minimum cost arborescence is an arborescence such that the sum of the weight of its arcs is minimum. In some cases, it is possible to find several minimum cost arborescences, but the proposed algorithm only finds one of them.
Edmonds' algorithm was developed by the mathematician and computer scientist Jack R. Edmonds in 1967. Although, it was previously proposed in 1965 by Yoeng-jin Chu and Tseng-hong Liu. This algorithm decreases the weights of the arcs in a graph and compacts cycles of zero weight until it can find an arborescence. This arborescence has to be a minimum cost arborescence of the graph.
getMinimumArborescence
returns a list with:
tree.nodes |
vector containing the nodes of the minimum cost arborescence. |
tree.arcs |
matrix containing the list of arcs of the minimum cost arborescence. |
weight |
value with the sum of weights of the arcs. |
stages |
number of stages required. |
time |
time needed to find the minimum cost arborescence. |
This function also represents the graph and the minimum arborescence and prints to the console the results with additional information (number of stages, computational time, etc.).
Chu, Y. J., and Liu, T. H., "On the Shortest Arborescence of a Directed Graph", Science Sinica, vol. 14, 1965, pp. 1396-1400.
Edmonds, J., "Optimum Branchings", Journal of Research of the National Bureau of Standards, vol. 71B, No. 4, October-December 1967, pp. 233-240.
1 2 3 4 5 6 | # Graph
nodes <- 1:4
arcs <- matrix(c(1,2,2, 1,3,3, 1,4,4, 2,3,3, 2,4,4, 3,2,3,
3,4,1, 4,2,1, 4,3,2),byrow = TRUE, ncol = 3)
# Minimum cost arborescence
getMinimumArborescence(nodes, arcs)
|
Loading required package: igraph
Attaching package: 'igraph'
The following objects are masked from 'package:stats':
decompose, spectrum
The following object is masked from 'package:base':
union
Minimum cost spanning arborescence
Algorithm: Edmonds
Stages: 2 | Time: 0.173
------------------------------
head tail weight
1 3 3
3 4 1
4 2 1
------------------------------
Total = 5
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.