Is there an arrow missing ? (Relations - Part1: Reflexivity)
Description:
##Relations Relations form a foundational topic in Logic, Math and Philosopy.
Here are a few references to understand the importance of relations:
Objects, properties and relations
There are many different categories of relations. In this kata we will focus on reflexivity.
##Reflexivity Reflexivity as explained on Stanford:
A relation R is reflexive iff, everything bears R to itself. For example, "being the same height as" is a reflexive relation: everything is the same height as itself. Stanford
###The Model In this exercise we will look at a Model consisting of points and arrows. The points will be given in an array S. For example S = [1,2,3] and the arrows will be given as a relation R = [ [1,1], [1,2], [1,3] ] . What this means is that there are arrows pointing from 1 to itself, from 1 to 2 and from 1 to 3.
In the tests every arrow in R will always be unique.
###Task What we want to know is whether the Relation is reflexive. R is a reflexive relation if every point in S has an arrow pointing from itself to itself
###Examples Suppose you have S and R as in the first example below then this means that you have 3 points where every point has an arrow pointing from itself to itself.
In the second example the red arrow is missing from the relation R, i.e. [1,1] is not in R. Therefore the relation is not reflexive.
Example 1: Suppose S = [1,2,3]. Let R be [[1,1],[2,2],[3,3]]
Result: R is reflexive, return true in the kata.
Example 2: Suppose S = [1,2]. Let R be [[1,2],[2,2]]
Result: R is NOT reflexive, as you can tell point 1 has no arrow pointing from itself to itself, i.e. [1,1] is missing in the relation R. Return false in the kata.
Similar Kata:
Stats:
Created | Nov 30, 2016 |
Published | Nov 30, 2016 |
Warriors Trained | 104 |
Total Skips | 26 |
Total Code Submissions | 71 |
Total Times Completed | 32 |
PHP Completions | 10 |
JavaScript Completions | 24 |
Total Stars | 2 |
% of votes with a positive feedback rating | 87% of 15 |
Total "Very Satisfied" Votes | 12 |
Total "Somewhat Satisfied" Votes | 2 |
Total "Not Satisfied" Votes | 1 |
Total Rank Assessments | 13 |
Average Assessed Rank | 7 kyu |
Highest Assessed Rank | 6 kyu |
Lowest Assessed Rank | 7 kyu |