This is the same as redefining a commercial product.
Usually this is done in the style of a clean room - one team carefully analyzes the product, specifying what it does, and then another team (whose members do not belong to the original team) implements the replacement only using the specification document.
As tdammers said, understanding the algorithm and executing the new implementation is generally excellent (excluding patent issues).
GPL , - , , , / , GPL. , , , , - , .