This method uses the descendents (missing documentation) method from the Graphs package to compute the RelationMatrix from the relations $R$.
i1 : G = {1,2,3,4,5};
|
i2 : R = {{1,2}, {1,3}, {2,4}, {3,4}, {4,5}};
|
i3 : transitiveClosure(G, R)
o3 = | 1 1 1 1 1 |
| 0 1 0 1 1 |
| 0 0 1 1 1 |
| 0 0 0 1 1 |
| 0 0 0 0 1 |
5 5
o3 : Matrix ZZ <--- ZZ
|
The object transitiveClosure is a method function.