Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

Social network analysis and Perl

by jmerelo (Sexton)
on Oct 28, 2003 at 11:55 UTC ( #302669=perlquestion: print w/replies, xml ) Need Help??

jmerelo has asked for the wisdom of the Perl Monks concerning the following question:

I'm trying to find a module for doing social network analysis in Perl, and there seems to be none; even worse, there does not seem to be any way of using a command-line utility or a library from Perl to perform social network analysis. The best thing I have come up with so far is using the sna library for the R statistical package, and calling it from a Perl program; unfortunately, the RSPerl package (Perl interface from R) can't seem to work properly, at least with the combination I have now (Perl 5.8, R 1.7). Anybody can be of help here? Anybody doing social network analysis with Perl?

Replies are listed 'Best First'.
Re: Social network analysis and Perl
by Roger (Parson) on Oct 28, 2003 at 13:23 UTC
    If you only want to write an analysis package to assist your research on Social Network Analysis, then you could try to download one of these software packages from the International network for Social Network Analysis. Afterall, why reinvent the wheel if there is already a freeware to do what you want. :-)

    You mentioned that the RSPerl package was not working properly on your system, can you please describe what is happening and why you think it is not working in detail, so we can perhaps help you to rectify the problem.

    By the way, the latest R is version 1.8 on, perhaps you should consider an upgrade...

      Most programs are buggy, for Windows or both. They break down with large networks. I could give them a try using Windows automation from Perl. I could also try to make R work from Perl and give it a go go the SNA package with R, which is extremely slow. Not that writing it in Perl would speed it up a bit, but at least, I could handle data in a format I am familiar with. With respect to RSPerl, it's probably a perfectly good thing, but a) it's not on CPAN and b) googling "RSPerl problems" returns more than 200 hits. It's just weird to see that a popular thing such as Social Network Analysis does not have a Perl library, or a Perl interface to an existing library. I'll update R, anyways.
      I have upgraded to R 1.8. Installation of RSPerl, from R, works fine, but following the not-so-clear instructions for making R work from Perl issues such an amount of errors...
      cc1: aviso: cambiando el orden de búsqueda para el directorio del sist +ema "/usr/local/include" cc1: aviso: porque ya ha sido especificado cmo un directorio que no +es del sistema En el fichero incluído de R.xs:5: RSCommon.h:49:26: Rinternals.h: No existe el fichero o el directorio RSCommon.h:50:24: Rdefines.h: No existe el fichero o el directorio En el fichero incluído de R.xs:5: RSCommon.h:65: error de decodificación antes de "USER_OBJECT_" RSCommon.h:65: aviso: la definición de datos no tiene tipo o clase de +almacenamiento RSCommon.h:67:24: Rversion.h: No existe el fichero o el directorio RSCommon.h:68:28: falta un operador binario antes de `(' RSCommon.h:76:29: R_ext/Boolean.h: No existe el fichero o el directori +o En el fichero incluído de R.xs:6:
      ... and so on, up to 200 hundred, that I think it just does not work with Perl >= 5.6. The web page says it works for 5.005 and R 1.3; it keeps working for R 1.8, but it no longer works with Perl.
        Ummm, could you translate the error messages to English please?

        I am *guessing* that you are using version 0.5.7 of RSPerl, which contains C files hardwired to Perl 5.0's XS. Unfortunately the guts of Perl has changed much since then, you just can not expect perl XS to be backward compatible with older versions. And from what I see, the guts of R has also changed dramatically since then...

        You could try to fix RSPerl's C files by resolving each error one-by-one. Probably not... Why don't you email an request to the Author of RSPerl and ask him for the upgrade?

        Anonymous Monks's suggestion looks good...

        So why don't you write your R script manually and just shell out to rcmd.exe with Perl? Typically I read data from a db with Perl/DBI, write it to a file, dynamically write an R script, shell to R (which opens the file, analyzes it, writes results to text), Perl validates the results, parses file, loads analyzed data back to DB. All is good in the world.
Re: Social network analysis and Perl
by ptkdb (Monk) on Oct 28, 2003 at 14:22 UTC
    If social network analysis is something that you know alot about, perl is something you want to know more about, and you have a spark of an idea of how it can be done right, you may just want to get yourself a copy of Programming Perl, The Perl Cookbook and Learning Emacs, and get to work.

    Wheels have been made of stone, wood, iron, rubber and even rope. While you can't say that they were reinvented, they were certainly improved on. YMMV

Re: Social network analysis and Perl
by TVSET (Chaplain) on Oct 28, 2003 at 22:00 UTC
      It's something you can't do with Perl, at least off-the-shelf :-)
      No, seriously, it's about analyzing large networks and finding outstanding properties of the network itself (such as density, shortest and longest path) and of each node (how it's connected to the rest of the network).
        Sounds like a complex software which will eat a lot of traffic and CPU power, without giving you much more then you already know. :)
Re: Social network analysis and Perl
by spx2 (Deacon) on Feb 01, 2008 at 16:20 UTC
    yes,there are some projects around regarding social network analysis in perl
    if you are interested,take a look here: social network analysis
    the project seems to be at it's beggining but maybe you want to contribute

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://302669]
Approved by phydeauxarff
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (5)
As of 2020-05-28 22:01 GMT
Find Nodes?
    Voting Booth?
    If programming languages were movie genres, Perl would be:

    Results (166 votes). Check out past polls.