Representations of Relations
For the following examples, we will consider the set and the binary relation
Graph representation
As a visual diagram, this is very common in the CS and Engineering field. This allows us to study graph theory from a mathematical as well as a CS/Eng perspective.
If we assume a binary relation on a set as a set of 2-tuples like , we can represent each tuple as a directed edge , wherein and are nodes in the graph.
For example the relation can be represented graphically as:
Matrix representation
A slightly less common representation due to the non-visual nature, but heavily used in graph implementations due to computational and mathematical simplicity.
Since we are mapping one set's elements to itself, we can let the rows of the matrix represent the source nodes and the columns, the destination nodes.
Due to the binary nature of directed edges (either an edge, or none) between any two nodes, we can represent a graph or a relation as a matrix by placing s wherever an edge is present, and s wherever absent.
For example, the relation can be represented as a matrix: