ysig / GraKeL

A scikit-learn compatible library for graph kernels
https://ysig.github.io/GraKeL/
Other
588 stars 96 forks source link

Faster "calculation" stage for Floyd-Warshall #30

Closed Alessi0X closed 4 years ago

Alessi0X commented 4 years ago

Hi ysig.

Following Issue #27 and following PR #29 I found a way also to speedup significantly the "Calculation" stage for Floyd-Warshall (in PR #29 only the "Initialization" stage was involved).

Briefly, instead of running a triple-nested for-loop, only 2 for-loops are involved + a vectorised statement.

I have been comparing your floyd_warshall() function against the fully vectorised one (PR #29 and this PR) on a Linux 19.10 machine with an Intel(R) Core(TM) i7-3770K CPU @ 3.50GHz and these are my results.

Dataset AIDS (entire dataset):

Dataset COX2 (entire dataset):

Dataset MSRC_9 (entire dataset):

Dataset MUTAG (entire dataset):

Dataset DD (first 20 graphs only):

Needless to say, the two routines return the very same shortest path matrix.