Skip to content
arav-agarwal2 edited this page Mar 9, 2022 · 9 revisions

Welcome to the rlemon wiki!

To add functions from lemon to rlemon:

  1. Add the corresponding functions to the corresponding header file under src
  2. Run "Rcpp::compileAttributes()", and check that "RcppExports" got updated with the functions you want
  3. Add the header file to "RInterfaces.cpp", if it does not already exist there.
  4. Run "devtools::check()" to make sure that there are no compilation errors.

Common Errors/Concerns:

  1. I got a "undefined symbol: Rcppajdsojdsaodj" error.
    • Look to see if that is defined in a .cc file in the lemon directory. If it is, move it to the src directory and rename it to have the suffix cpp.
  2. I'm getting results that seem off, and I don't know why.
    • Please check that you're using 1-based indexing in rLemon, and not 0-based indexing. Due to how we are processing graphs, using 0-based indexing will cause problems. The internal "runner" functions, which map R code to C++ code, facilitate this conversion. While they take in 1-based indexed arrays, LEMON handles everything in 0-based indexing, so we make the conversion there to simplify the interface for R users.
  3. I'm unsure how to use the package.
    • In general, the docs hopefully explain things completely, but to summarize, all LEMON algorithms are classes. To make them easily compatible with R, rlemon converts their interfaces to that of functions, and exports those instead. To do so, it assumes that you have a list of source nodes and target nodes that define the edges/arcs of the graph, where the first element of each list defines the first edge/arc, the second element defines the second, etc. For each node, we expect them to be addressed by an integral, sequential index, and that any missing indices are implicitly apart of the graph, so having an edge list where the source nodes are {1,2,4} and the target nodes are {1,4,6} implies that nodes 3 and 5 both exist in the graph if numNodes is 6, and that nodes 3,5,7 exist if numNodes is 7.
    • All rlemon functions will error out if some of these conditions are not met, but passing the checks we have in place does not mean that the output is semantically correct, only that it will not error out on the C++ end.

Clone this wiki locally