Is copying an algorithm plagiarism?

Plagiarism is passing someone else's work as your own. If the source is referenced, then there is no plagiarism.

Quoting the whole algorithm verbatim may be considered as bad writing style, may be against a particular journal's rules, or may simply demonstrate a certain lack of creativity. However, this is not a plagiarism, as long as the source is cited.


@DmitrySavostyanov is right in that what matters is that you reference where you got the algorithm from. If you do so, then copying it verbatim is in essence a quote, not plagiarism.

I disagree with him, though, on whether it is good or bad style to copy algorithms verbatim. Algorithms -- especially when giving in short "pseudo-algorithm" form, are concise, technical statements in much the same way as formulas are. There is typically no literary component to it. As such, there is little leeway in rephrasing something to make it your own, other than the gratuitous use of different variable or function names. The latter, however, is not helpful, but rather only serves to confuse readers trying to compare papers. Consequently, I'm all for copying verbatim, as long as it is clear where it comes from.

So, say something like "The problem above is easily solvers by the algorithm of Miller and Smith [13], which is reproduced in the following: [...]".


It may not be plagiarism, but you would be called to task to justify why you are doing it in most cases. My experience has been that you don't need to show an documented algorithm so much as say why you are using it and where someone can find more information on it. So if I'm working on a paper I may say something like,

In order to explore the transmission of memes through the social network, we first assumed that they arrived at highly influential (i.e. well connected) nodes using the shortest path from the source. These paths were identified using Dijkstra's algorithm for finding shortest paths between nodes in a graph (Dijkstra, 1959).

At which point nothing more really needs to be said on the algorithm itself. In fact, depending on the audience, I may have said too much.

Generally writing out the algorithm in full usually means that it's being explained in depth (i.e. a textbook approach), there isn't an expectation that your audience would be familiar with it in any way, or you are doing so to demonstrate a fundamental that needs to be deconstructed as part of a proof. Even then, about the only time you are really going to want to write the algorithm out in full is if you are developing a textbook or teaching materials on it.