Dear Gabor, Thanks for you reply. I'm sorry if I wasn't clear, so let me try to be more precise.
I have a undirected graph constructed from and edge list, with vertex names as attributes, I want to generate a triad census for each vertex and print out a data.frame with each row containing each vertex name and its values for each triad. The cols being the vertex's id and the triads' codename. Being an undirected graph I'm not sure all 16 triads types will apply. To perform the above task I relied on the example shown in the link from stackoverflow, where the triad.census function is part of the solution but unfortunately, it doesn't return the vertex name. Here's what I did so far: #construct ego-networks first ego.nets = igraph::graph.neighborhood(g,order=1,nodes=V(g)) #run triad.census on each ego-network triads_davis = sapply(ego.nets,igraph::triad.census) #bind together list of triads codenames(triad_census_labels) and triad census values triads.ego.df = data.frame(triad_census_labels,triads_davis) #transpose data.frame to have triad labels as columns and vertex names as rows triads.ego.df = as.data.frame(t(triads.ego.df)) Cheers, Marco On 15 January 2014 18:01, <[email protected]> wrote: > Send igraph-help mailing list submissions to > [email protected] > > To subscribe or unsubscribe via the World Wide Web, visit > https://lists.nongnu.org/mailman/listinfo/igraph-help > or, via email, send a message with subject or body 'help' to > [email protected] > > You can reach the person managing the list at > [email protected] > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of igraph-help digest..." > > > Today's Topics: > > 1. Node-level triad census with igraph for R (Marco Milano) > 2. Re: Node-level triad census with igraph for R (G?bor Cs?rdi) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Wed, 15 Jan 2014 11:49:08 +0100 > From: Marco Milano <[email protected]> > To: [email protected] > Subject: > [igraph] Node-level triad census with igraph for R > Message-ID: > < > cahahnf04u9s2isuianr0e6un_wkkmuquecoyorx0tk8zj56...@mail.gmail.com> > Content-Type: text/plain; charset="iso-8859-1" > > Dear igraph list, > > I'm currently working on extracting node-level properties from a social > network and I'm stuck with the triad census calculation. As there isn't a > function to call on the graph to perform such task, this is the most > updated solution I found so far: > > http://stackoverflow.com/questions/12374534/how-to-mine-for-motifs-in-r-with-igraph > . > > When I try to iterate the triad census on each node in my graph though, I > get some strange results. First of all, being an undirected graph I should > be getting 4 values but instead I get 16. Moreover, I don't know which > resulting census corresponds to which node. The name attribute I call to > iterate on the list of nodes seems to contain the NULL value but it > correctly contains the vertex names at graph level before calling the > graph.neighborhood function. > > My problem is: how can I have each node printed out along with its triad > census? > And, please forgive me for adding a side-question to my main one but seen > that we are talking about triads, I was wondering if anyone is aware of a > way to calculate the Kalish & Robins Strong-Weak-NoTie relation? > > Thanks. I appreciate any help or advice. > > > Marco > > > -- > *Find me on LinkedIn:* > linkedin.com/in/marcomilano <http://www.linkedin.com/in/marcomilano> > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: < > http://lists.nongnu.org/archive/html/igraph-help/attachments/20140115/8fdfc91b/attachment.html > > > > ------------------------------ > > Message: 2 > Date: Wed, 15 Jan 2014 10:28:54 -0500 > From: G?bor Cs?rdi <[email protected]> > To: Help for igraph users <[email protected]> > Subject: > Re: [igraph] Node-level triad census with igraph for R > Message-ID: > <CABtg=K= > [email protected]> > Content-Type: text/plain; charset="iso-8859-1" > > Hi Marco, > > > On Wed, Jan 15, 2014 at 5:49 AM, Marco Milano <[email protected]> > wrote: > > > Dear igraph list, > > > > I'm currently working on extracting node-level properties from a social > > network and I'm stuck with the triad census calculation. As there isn't a > > function to call on the graph to perform such task, this is the most > > updated solution I found so far: > > > http://stackoverflow.com/questions/12374534/how-to-mine-for-motifs-in-r-with-igraph > > . > > > > actually there is triad.census: > http://igraph.sourceforge.net/doc/R/triad.census.html > > > > > > When I try to iterate the triad census on each node in my graph though, I > > get some strange results. First of all, being an undirected graph I > should > > be getting 4 values but instead I get 16. Moreover, I don't know which > > resulting census corresponds to which node. The name attribute I call to > > iterate on the list of nodes seems to contain the NULL value but it > > correctly contains the vertex names at graph level before calling the > > graph.neighborhood function. > > > > To be honest, it is hard to follow what you are doing, without seeing your > code. If just calling triad.census() is not an option for you, then please > include your code. Thanks. > > Best, > Gabor > > > > > > My problem is: how can I have each node printed out along with its triad > > census? > > And, please forgive me for adding a side-question to my main one but seen > > that we are talking about triads, I was wondering if anyone is aware of a > > way to calculate the Kalish & Robins Strong-Weak-NoTie relation? > > > > Thanks. I appreciate any help or advice. > > > > > > Marco > > > > > > -- > > *Find me on LinkedIn:* > > linkedin.com/in/marcomilano <http://www.linkedin.com/in/marcomilano> > > > > _______________________________________________ > > igraph-help mailing list > > [email protected] > > https://lists.nongnu.org/mailman/listinfo/igraph-help > > > > > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: < > http://lists.nongnu.org/archive/html/igraph-help/attachments/20140115/593adaa9/attachment.html > > > > ------------------------------ > > _______________________________________________ > igraph-help mailing list > [email protected] > https://lists.nongnu.org/mailman/listinfo/igraph-help > > > End of igraph-help Digest, Vol 90, Issue 10 > ******************************************* > -- *Find me on LinkedIn:* linkedin.com/in/marcomilano <http://www.linkedin.com/in/marcomilano>
_______________________________________________ igraph-help mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/igraph-help
