As mentioned during logic and interpretations: a Relation is just a subset of (tuples of) the domain. For instance, the binary relations ``likes(•,•)'', ``hasCoStarredWith(•,•)'', ≥. Or unary relations like safe?(•), has3?(•).
Binary relations are particularly interesting:
Consider domain {Ian,Gillis,Leebron}
and the relation hasHeardOf(•,•).
We can show this particular relation as a list:
hasHeardOf = {
We can also give a pictorial relation:
Graphs can be considered equivalent to listing a particular relation. But they're common in their own right: Def'n: A Graph G is a tuple 〈V,E〉 where V is a set of vertices, and E ⊆ V×V is a set of directed edges. Note that a graph is not tied to one particular way of drawing; you can move edges (and stretch incident edges) around in the picture, change whether edges are drawn crossing over other edges, etc, and it's still the same graph. (We refer to the embedding of a graph, if the geometry is important.)
Draw the graphs of some particular relations: K_n: the domain of n nodes, where everything is related (including self). ``The complete graph''. The discrete graph: nothing related to anything else. Equality: things related exactly to themselves. Subset-of, on domain P({1,2,3}). thinks-is-cute on domain of people.
Digression:
Trees differ from (undirected) graphs in that trees can't allow cycles.
But consider these graphs which are "almost" trees:
...[show some picts]...
This might well be a LAN (or internet) layout.
Can we formalize the notion of 'nearly a tree'?
- How? Go home and think about it. - One idea: "tree width": If you squint and consider several nodes to be all one big node, then it might look like a tree. Draw some pictures/examples to develop this idea. We say that the "tree width" is the size of the largest set you had to collapse; "Small tree width" is a quantitative idea of tree-like. [You can think of other ways to count, of course.] - What are trivial cases?Exercise: write down a formal def'n of tree-width (using sets, functions, etc). Hint: create a *tree* whose nodes are entire *sets* of original graph nodes. (What is an idea of edge?)
For each of the following properties,
Def'n: A binary relation R(•,•) on domain D is …
We say that an equivalence relation partitions the domain into equivalence classes.
Def'n: equivalence class: The equivalence class of a under relation R = { b in domain | R(a,b) }
Def'n: partition [finite]: a set of sets {A1,A2,…,An}
Equivalence relations are interesting because one can create a new domain whose elements are just the original equivalence classes; it's a way of boosting a relation into its version equality. Example we'll see later: the relation ``remainder upon dividing by 7'' partitions the integers into 7 equivalence classes. The set Z/7 (``Z mod 7'') is a new set with 7 elements.
[an error occurred while processing this directive] [an error occurred while processing this directive]