[Numpy-discussion] matrix multiply
Alan G Isaac
aisaac@american....
Sun Apr 6 23:38:39 CDT 2008
On Sun, 6 Apr 2008, Charles R Harris apparently wrote:
> You mean as edges in a directed graph?
Yes.
Naturally a boolean matrix is not the most compact
representation of a directed graph, especially a
sparse one. However it can be convenient.
If B is a boolean matrix such that Bij=1 if there is
and edge from i to j, then B**2 has unit entries where
there is a path of length 2 from i to j. The transitive
closure is similarly easy to represent (as a matrix power).
Cheers,
Alan Isaac
More information about the Numpy-discussion
mailing list