问题
I am trying to calculate a transitive closure of a graph. Let`s consider this graph as an example (the picture depicts the graph, its adjacency and connectivity matrix):
Using Warshall's algorithm, which i found on this page, I generate this connectivity matrix (=transitive closure?), that is different from the one in the picture:
01111
01111
01011
01111
01111
I have also tried using this applet which also gives me a different result:
01111
01111
01111
01111
01111
So I'm a little confused right now, since I don't know which matrix is the right one. Can someone shed some light on my problem?
回答1:
C(1,1): The letter T at C(1,1) implies that there should be Ts on the diagonal of A.
C(3,3): One round of the Warshall algorithm only seems to find reachable nodes at a depth of two. Since it takes three edges to reach node number three from itself, one round is not enough.
来源:https://stackoverflow.com/questions/13438865/finding-the-transitive-closure-of-a-graph