Hi Alpár,<div><br></div><div>Thanks for your kind response and interest. If I'll try to answer your</div><div>question maybe I can formulate more precisely my own. When you</div><div>write a R package there are 2 main subdirectories, one named R/</div>
<div>and other src/. Inside R/ you put all your .R files (the files with the R</div><div>code) and inside src/ you put all your .cpp and .h files. Eventually</div><div>you build the package with the R builder which will compile and link the</div>
<div>.cpp and .h files in src/, in libraries files .so that you can "load"</div><div>from the R code.</div><div><br></div><div>Now, that seems to be the way when you use your own .cpp and .h</div><div>files. In the case of using Lemon I think in two possibilities:</div>
<div><br></div><div>1) Installing it, so all the .h and (may be .so, I don't know if there are some</div><div>of them) files will be some where in the systems accessible via the</div><div> system PATHs. So one can use the tools provided by the library by means</div>
<div>of a simple line like:</div><div><br></div><div><meta http-equiv="content-type" content="text/html; charset=utf-8"><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">#include<lemon/dijkstra.h></span></div>
<div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; "><br></span></div><div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">in your/s .cpp file/s. And this is what I had done. I first try this options because</span></div>
<div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">I don't know what the installation of the Lemon library does. So maybe the</span></div><div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">process of installation is necessary in order that the Lemon library works.</span></div>
<div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; "><br></span></div><div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">2) Now, I'm thinking in this other option (which I do not test yet). Just copying</span></div>
<div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">the /lemon/ directory inside the src/ directory and access the .h files trough</span></div><div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">a line like (for example):</span></div>
<div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; "><br></span></div><div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; "><meta http-equiv="content-type" content="text/html; charset=utf-8">#include "lemon/dijkstra.h"</span></div>
<div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; "><br></span></div><div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;">that is, now the .h files (I don't know what happens if there are or must be .so </span></font></div>
<div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;">files in the Lemon library) are not accessed via the system PATHs, but</span></font></div><div>
<font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;">directly inside the src/ directory. This option is in some way better for me</span></font></div><div>
<font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;">(and maybe for others) if it works. Why? Simply, in this way one can build</span></font></div><div>
<font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;">a self-sufficient R package that can be easily installed in other systems</span></font></div><div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;">that uses R via a simple R command from a R console like this (suppose </span></font></div>
<div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;">that the package </span></font><span class="Apple-style-span" style="font-family: arial, sans-serif; border-collapse: collapse; ">is named LemonPkg):</span></div>
<div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;"><br></span></font></div><div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;">> install.packages("LemonPkg")</span></font></div>
<div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;"><br></span></font></div><div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;">and that is !!! You can use all the power of R (the main power of</span></font></div>
<div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;">R is that it integrates conveniently a lot of libraries, also it seems </span></font></div><div>
<font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;">a nice </span></font><span class="Apple-style-span" style="font-family: arial, sans-serif; border-collapse: collapse; ">language to work with) and Lemon in a very easy </span><span class="Apple-style-span" style="font-family: arial, sans-serif; border-collapse: collapse; ">way. </span></div>
<div><span class="Apple-style-span" style="font-family: arial, sans-serif; border-collapse: collapse; ">But only </span><span class="Apple-style-span" style="font-family: arial, sans-serif; border-collapse: collapse; ">if this second option works. I will try this at some point.</span></div>
<div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;"><br></span></font></div><div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;">Best Regards</span></font></div>
<div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;"><br></span></font></div><div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;">P.S.: Sorry if my mail is so extent.</span></font></div>
<div><br><div class="gmail_quote">On Mon, Feb 14, 2011 at 7:45 AM, Alpár Jüttner <span dir="ltr"><<a href="mailto:alpar@cs.elte.hu" target="_blank">alpar@cs.elte.hu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Juan,<br>
<br>
Thanks for sharing your experience. I am not familiar with R, but went<br>
trough your blogpost and I found it really exciting.<br>
<br>
At the end of your post (and at <a href="http://stackoverflow.com/" target="_blank">http://stackoverflow.com/</a>) you have a<br>
question about using LEMON without installing it. Is it a general issue<br>
using Rcpp, or something LEMON specific?<br>
<br>
In general, LEMON headers must be included like<br>
#include<lemon/dijkstra.h>, indeed, but this shouldn't cause any problem<br>
for you - simply create a lemon subdirectory within your include dir and<br>
put the lemon headers there.<br>
<br>
Regards,<br>
Alpár<br>
<br>
P.S. It was nice to find other happy users following the links in your<br>
post.<br>
<div><div></div><div><br>
<br>
<br>
On Fri, 2011-02-11 at 19:51 -0300, Juan Ignacio Perotti wrote:<br>
> Hi, everybody.<br>
><br>
><br>
> I'm just new on this. Few months before I had started to learn R<br>
> (<a href="http://www.r-project.org/" target="_blank">http://www.r-project.org/</a>). R is nice, but it may be slow.<br>
> I'm a physicist and normally I do high performance computations.<br>
> Eventually I get to know that one can integrate C++ code<br>
> into R. As I normally work in complex networks, I was looking for C++<br>
> libraries developed for that purpose. In fact, igraph is<br>
> a package available to R users. So eventually I think to look at the C<br>
> implementation of it. But I found the C igraph library<br>
> a bit "dirty" to deal with. Eventually I also found the Boost Graph<br>
> Library, but I read about it that it has a step learning curve.<br>
> Then I found LGL (Lemon Graph Library). It looks pretty nice to work<br>
> with, and it seems "transparent" so one can understand<br>
> it easily. Also it seems that can deal with hard computations. So, I<br>
> decide to try the integration of R with LGL using a R<br>
> package called Rcpp (which is also awesome!!!). So after a while I had<br>
> success on it. More precisely, I just got working<br>
> a very small and simple program that integrates LGL via Rcpp into R.<br>
><br>
><br>
> I wrote the details of this in my blog. So I want to share it with the<br>
> LGL community.<br>
><br>
> <a href="http://deliriosderayohauno.blogspot.com/2011/02/lemon-graph-library-lgl-instalation.html" target="_blank">http://deliriosderayohauno.blogspot.com/2011/02/lemon-graph-library-lgl-instalation.html</a><br>
> <a href="http://deliriosderayohauno.blogspot.com/2011/02/r-learning-building-r-packages-that_468.html" target="_blank">http://deliriosderayohauno.blogspot.com/2011/02/r-learning-building-r-packages-that_468.html</a><br>
><br>
><br>
> Maybe, some others are walking on the same road. Let my know about<br>
> that.<br>
><br>
><br>
> Best Regards<br>
><br>
> --<br>
> Lic. Juan I. Perotti<br>
><br>
> Instituto de Física Enrique Gaviola (IFEG).<br>
> Facultad de Matemática Astronomía y Física (FaMAF).<br>
> Universidad Nacional de Córdoba (UNC).<br>
> Medina Allende y Haya de la Torre s/n<br>
> Ciudad Universitaria - X5000HUA<br>
> Oficina 233<br>
> Te: +54-351-4334051 (int. 233)<br>
> Fax: +54-351-4334054<br>
> home page: <a href="http://www.famaf.unc.edu.ar/~perotti/" target="_blank">http://www.famaf.unc.edu.ar/~perotti/</a><br>
><br>
><br>
</div></div>> _______________________________________________<br>
> Lemon-user mailing list<br>
> <a href="mailto:Lemon-user@lemon.cs.elte.hu" target="_blank">Lemon-user@lemon.cs.elte.hu</a><br>
> <a href="http://lemon.cs.elte.hu/mailman/listinfo/lemon-user" target="_blank">http://lemon.cs.elte.hu/mailman/listinfo/lemon-user</a><br>
<br>
<br>
</blockquote></div><br><br clear="all"><br>-- <br>Lic. Juan I. Perotti<br><br>Instituto de Física Enrique Gaviola (IFEG).<br>Facultad de Matemática Astronomía y Física (FaMAF).<br>Universidad Nacional de Córdoba (UNC).<br>
Medina Allende y Haya de la Torre s/n<br>Ciudad Universitaria - X5000HUA<br>Oficina 233<br>Te: +54-351-4334051 (int. 233)<br>Fax: +54-351-4334054<div>home page: <a href="http://www.famaf.unc.edu.ar/~perotti/" target="_blank">http://www.famaf.unc.edu.ar/~perotti/</a></div>
<br>
</div>