The transitive closure of a graph refers to whether node A can be reached from node B for all node pairs (A, B).
Graph state
When described as a graph, it is a graph which contains an edge between A and B whenever there is a directed path from A to B. In other words, every path in the graph is directly added as an additional edge.1
Matrix state
When described as a matrix, it is a matrix , where reflects whether node can reach node . The rows represents the source node (‘from’) and columns represent the target node (‘to’). 0 means not reachable and 1 means reachable:
Properties:
- Unlike adjacency matrix, the value of the pair (, ) where A is any node within the graph is always 1, as there exists a path from a node to itself, although controversy exists.2
- For a completed undirected graph, all cells would be 1, as all nodes would be reachable from any other node. As such transitive closure is only applied to directed graphs.