equivalenceClassIndex {socialranking} | R Documentation |
Given a coalition
vector, return the equivalence class index it appears in.
equivalenceClassIndex(powerRelation, coalition)
coalitionLookup(powerRelation, coalition)
powerRelation |
A |
coalition |
a coalition vector or that is part of |
This function calls powerRelation$coalitionLookup(coalition)
.
equivalenceClassIndex()
serves as an alias to coalitionLookup()
.
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.
Other lookup functions:
coalitionsAreIndifferent()
,
elementLookup()
pr <- as.PowerRelation("12 > 2 ~ 1")
(e1 <- equivalenceClassIndex(pr, c(1, 2)))
# 1
(e2 <- equivalenceClassIndex(pr, c(1)))
# 2
(e3 <- equivalenceClassIndex(pr, c(2)))
# 2
(e4 <- equivalenceClassIndex(pr, c()))
# NULL <- empty set does not exist
stopifnot(all(c(e1,e2,e3,e4) == c(1,2,2)))