mstGames: Cooperative games from minimum cost spanning tree problems

Description Usage Arguments Value Examples

View source: R/mstGames.R

Description

Given a graph with at least one minimum cost spanning tree, mstGames builds both cooperative games: the pessimistic and the optimistic game.

The pessimistic game associated with a minimum cost spanning tree problem is a cooperative game in which every coalition of agents obtains the minimum cost assuming that the agents outside the coalition are not connected.

The optimistic game associated with with a minimum cost spanning tree problem is a cooperative game in which every coalition of agents obtains the minimum cost assuming that that the agents outside the coalition are connected. Thus, the agents in the coalition can benefit from their connections to the source

Usage

1
mstGames(nodes, arcs, game, show.data = TRUE)

Arguments

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.

game

denotes the game that we want to obtain: "pessimistic" or "optimistic".

show.data

logical value indicating if the function displays the console output (TRUE) or not (FALSE). By default its value is TRUE.

Value

mstGames returns a vector with the characteristic fuction of the selected game associated with the graph and prints the result in console.

Examples

1
2
3
4
5
6
7
# Graph
nodes <- 1:4
arcs <- matrix(c(1,2,6, 1,3,10, 1,4,6, 2,3,4, 2,4,6, 3,4,4),
               byrow = TRUE, ncol = 3)
# Cooperative games
mstGames(nodes, arcs, game = "pessimistic")
mstGames(nodes, arcs, game = "optimistic")

Example output

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

Loading required package: optrees
v(S) =  6 10 6 10 12 10 14 
$coalitions
[1] "1"     "2"     "3"     "1,2"   "1,3"   "2,3"   "1,2,3"

$values
[1]  6 10  6 10 12 10 14

v(S) =  4 4 4 8 8 8 14 
$coalitions
[1] "1"     "2"     "3"     "1,2"   "1,3"   "2,3"   "1,2,3"

$values
[1]  4  4  4  8  8  8 14

cooptrees documentation built on May 30, 2017, 8:11 a.m.