3

I found an algorithm and the corresponding implementation (code) on Wikipedia.

Can I use that code in commercial software? Or would this mean that I would introduce a viral license and would have to share my whole code under the Creative Commons Attribution-ShareAlike License?

4
  • 4
    Is it the code, or the algorithm, that is published on wikipedia?
    – MadHatter
    Commented Jul 13, 2018 at 8:30
  • 4
    Do you plan to copy the code as is (possibly copying the copyrighted content) or simply use the Wikipedia article as a source of information about the algorithm and reimplement it in your own code base using your own implementation? Algorithms in and of themselves are not generally copyrightable. See Does copyrighted code protect intellectual property rights on novel algorithms it implements?
    – Brandin
    Commented Jul 13, 2018 at 10:02
  • It's the code, but I ended up reimplementing it again
    – joz
    Commented Jul 14, 2018 at 10:31
  • 2
    If you copy the code, then you must abide by the license. If you look at the code only to get a description of the algorithm (e.g. how to sort numbers using Quicksort), and then you reimplement that yourself without copying the code, then that is either your own implementation with your own copyright, or it is an implementation devoid of copyright because it contains no copyrightable elements. Some things are not copyrightable because they are statements of fact with no creativity, or because they are only one of very few ways to express some fact. Algorithms often fall into this category.
    – Brandin
    Commented Jul 16, 2018 at 6:14

2 Answers 2

3

As Brandin said: if you copy the code verbatim, or copy and modify it then you have to follow the license. In this case you are advised to check the original sources since they may be licensed differently.

If you use Wikipedia to understand the method, then create your own code based on that knowledge then it is not restricted by the license of Wikipedia.

4
  • Even if you use the code verbatim in a commercial product, you could most likely still comply with the CC ShareAlike provisions, depending on how you do it. But without more details from the OP it is hard to give specific advice for this.
    – Brandin
    Commented Sep 4, 2019 at 8:46
  • The general problem I have experienced was that CC and other licenses were not compatible, so it was pretty hard to incorporate foreign license in a differently licensed codebase. Also it may be suboptimal to separately release integral parts of a large product (like you mentioned the QuickSort example). But Wikipedia most often contains the algorithm and not the specific code.
    – grin
    Commented Sep 4, 2019 at 8:49
  • But after looking at the code, will mine not automatically be similar?
    – joz
    Commented Sep 6, 2019 at 7:56
  • Similar is not the same. Here around the judge would ask the professionals whether the similarity is due to the way implementation have to be or it doesn't need to be that similar therefore it was a process of copying. Like if you use a different programming language it cannot be copying, and it's really hard to interpret as a "derivative work" if you look only at the code and not the algorithm.
    – grin
    Commented Sep 6, 2019 at 14:48
0

I have some code for an algorithm that is published on Wikipedia.

If you are the one who created the code and published it on Wikipedia, you are the copyright holder and therefore you can do anything you like with the code such as distributing it with a different license, or revoking your license on a subsequent version.

2
  • 2
    I don't think OP meant it's code they authored. I read the question as "I came across a snippet of code I found useful on Wikipedia, how can I use it in my commercial software?"
    – Mureinik
    Commented Aug 13, 2022 at 11:12
  • 2
    The phrasing "revoking your license" is a bit misleading. In fact, you cannot really revoke a license. What you can do, however, is license version 1 under license A, and then the next version 2 and later under license B. In that scenario, versions 2+ would not be available under license A, but version 1 which was originally released under license A would still be available under that license; that cannot be revoked.
    – Brandin
    Commented Aug 18, 2022 at 10:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.