Split a graph path of length at most into two consecutive parts of length at most , allowing a zero-length part. Conversely, concatenating two such parts gives a walk of length at most and hence the same reachability. ThereforeStart at , then square to obtain . Stop at equality of successive matrices, or after the length bound reaches . The invariant is now after squarings. Equality implies closure under composition, and the included identity matrix ensures reflexivity.
For the same elementary dense Boolean matrix multiplication and equality stopping test, the cost isThe additive constant covers the final stability check and the cases . Thus, with , the number of cubic passes falls from to . In terms of alone the worst-case bound improves from to for these implementations. A directed chain also requires logarithmically many squarings. This comparison uses ordinary triple-loop multiplication, rather than a faster matrix multiplication method.
Articles by others on the same topic
There are currently no matching articles.