Get index of equivalence class containing a coalition
Source:R/PowerRelation.R
equivalenceClassIndex.Rd
Given a coalition
vector, return the equivalence class index it appears in.
Arguments
- powerRelation
A
PowerRelation
object created byPowerRelation()
oras.PowerRelation()
- coalition
a coalition vector or that is part of
powerRelation
Value
Numeric value, equivalence class index containing coalition
.
NULL
if the coalition does not exist.
If the powerRelation
contains cycles, it is possible that multiple values are returned.
Details
This function calls powerRelation$coalitionLookup(coalition)
.
equivalenceClassIndex()
serves as an alias to coalitionLookup()
.
See also
Other lookup functions:
coalitionsAreIndifferent()
,
elementLookup()
Examples
pr <- as.PowerRelation("12 > 2 ~ 1")
(e1 <- equivalenceClassIndex(pr, c(1, 2)))
#> [1] 1
# 1
(e2 <- equivalenceClassIndex(pr, c(1)))
#> [1] 2
# 2
(e3 <- equivalenceClassIndex(pr, c(2)))
#> [1] 2
# 2
(e4 <- equivalenceClassIndex(pr, c()))
#> NULL
# NULL <- empty set does not exist
stopifnot(all(c(e1,e2,e3,e4) == c(1,2,2)))