equivalenceClassIndex {socialranking}R Documentation

Get index of equivalence class containing a coalition

Description

Given a coalition vector, return the equivalence class index it appears in.

Usage

equivalenceClassIndex(powerRelation, coalition)

coalitionLookup(powerRelation, coalition)

Arguments

powerRelation

A PowerRelation object created by PowerRelation() or as.PowerRelation()

coalition

a coalition vector or that is part of powerRelation

Details

This function calls powerRelation$coalitionLookup(coalition).

equivalenceClassIndex() serves as an alias to coalitionLookup().

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.

See Also

Other lookup functions: coalitionsAreIndifferent(), elementLookup()

Examples

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)))


[Package socialranking version 1.2.0 Index]