Built-in vs. User defined Functions Performance #5517
Replies: 2 comments 2 replies
-
You could use the Digraphs package which contains equivalent functionality, and some of the routines are implemented in c, including our implementation of the Floyd-Warshall Algorithm, which is probably faster than the library code. |
Beta Was this translation helpful? Give feedback.
-
I am confused about this report. You report that a highly tuned built-in function written by experts is a lot faster than the code you wrote. No offense, but this is not exactly surprising, especially if you are a relative beginner at writing GAP code and don't know about pitfalls etc. Maybe you are (implicitly) meaning to ask about help for improving your code? Or what is it you are looking to achieve by your report? Perhaps you can clarify that, then you might get help. Or maybe you really just wanted to report that "GAP is much faster than my own code", but that's not very interesting by itself, I am afraid... |
Beta Was this translation helpful? Give feedback.
-
I would like to report a performance difference of 30X+ factor when using
TransitiveClosureBinaryRelation(rel)
vs.
My user-defined function-based version of the transitive closure of a graph having n^3 vertices.
Here n is the problem size parameter-- vertices in another graph (Graph Isomorphism Problem).
TransitiveClosureBinaryRelation() runs 30X faster than my user-defined GAP program.
I am using the Floyd-Warshall algorithm with O(N^3) time complexity. I do not think anything is missing in my implementation of the F-W algorithm.
So I wonder if there is any better alternative to using TransitiveClosureBinaryRelation(), which was suggested by Max.
PS: Even this test IsTransitiveBinaryRelation(rel) runs 30 times faster on the TransitiveClosureBinaryRelation generated relation.
Thank you
Beta Was this translation helpful? Give feedback.
All reactions