Transferred from https://github.com/igraph/rigraph/issues/388
Transferred from igraph/rigraph#388