Learn R Programming

relations (version 0.2-0)

violations: Violations of Relation Properties

Description

Computes a measure of remoteness of a relation from a specified property.

Usage

relation_violations(x, family = c("T", "transitive",
                                  "S", "symmetric",
                                  "A", "antisymmetric",
                                  "C", "complete",
                                  "R", "reflexive"))

Arguments

x
an endorelation.
family
a character string specifying one of the relation families for which the number of violations can be computed.

Value

  • The number of violations for the specified family, i.e. the minimum number of pairs (for transitive relations: triples) that must be modified/added/removed to make the relation comply to the families' restrictions.

encoding

UTF-8

Examples

Run this code
## partial order:
R <- as.relation(1:3)
relation_incidence(R)
## R clearly is transitive, but not symmetric:
relation_violations(R, "transitive")
relation_violations(R, "symmetric")

## create a simple relation:
R <- relation(domain = letters[1:2],
              graph = set(pair("a","b"), pair("b","a")))
relation_incidence(R)
## R is clearly symmetric, but not antisymmetric:
relation_violations(R, "symmetric")
relation_violations(R, "antisymmetric")

Run the code above in your browser using DataLab