***** To join INSNA, visit http://www.insna.org *****
Hey Simo,
Good point, and that would work for degree(). The problem is it won't
help in cases where the function is not called directly by the user, but
by another function within the package.
For example, both 'igraph' and 'network' have functions named
"add.edges()" and "add.vertices()". So say I load 'igraph' first and
then 'network', masking the igraph add.vertices() function. Now, if I
try to use another 'igraph' function that contains a call to
add.vertices (say one of the ones that generate trees, the name escapes
me now) -- that would result in lots of complaining and error-throwing.
I believe Gabor Csardi had mentioned he was going to fix the naming
issues in one of the coming igraph releases -- not sure if he's gotten
around to that yet or not.
Best!
Katya
On 7/13/2015 3:33 AM, Simone Gabbriellini wrote:
> Katherine,
>
> When you call a function, say from igraph, simply use
>
> igraph::degree(g)
>
> This way, no confusion arises!
>
> HTH,
> Simo
>
> Ps: it could be igraph::: instead of igraph:: I don't have my Mac with me and cannot check for sure
>
> Sent from my iPhone
>
>> On 13 Jul 2015, at 08:34, Katherine Ognyanova <[log in to unmask]> wrote:
>>
>> ***** To join INSNA, visit http://www.insna.org *****
>>
>> Hey Ian,
>>
>> Same deal here - I use both packages and switch back and forth. By the way, I find it best not to keep both loaded at same time (or at least not for long). They do have overlapping function names, and sooner or later that will cause something to throw an error.
>>
>> Alex has covered converting igraph to network objects and back. I usually just do that by extracting a matrix or edgelist from one and reading that into the other one (with get.adjacency() or get.edgelist() in igraph, and with as.matrix.network() in statnet).
>>
>> On question (1), pretty much all of the metrics you mention in are available in the 'sna' package. So for a network named 'net', you can do:
>>
>> library(sna)
>> connectedness(net) # Krackhardt connectedness
>> hierarchy(net, measure="krackhardt") # Krackhardt hierarchy
>> efficiency(net) # Krackhardt efficiency
>>
>> On question (3), you can use the argument 'vertex.cex' to change the size of the nodes when plotting a network object. So if you want to size by degree, this should work:
>>
>> library(sna)
>> deg <- degree(net)
>> plot(net, vertex.cex=deg)
>>
>> I've recently put together a quick tutorial on network visualization in R that might be of some use for this - it's available here: http://kateto.net/network-visualization and as a PDF here: http://bitly.com/networkviz
>>
>> Best!
>> Katya
>>
>>> On 7/13/2015 1:22 AM, Alex Stivala wrote:
>>> ***** To join INSNA, visit http://www.insna.org *****
>>> Ian,
>>>
>>> I use statnet and igraph at the same time, and have found the R
>>> intergraph package by Michal Bojanowski:
>>>
>>> http://cran.r-project.org/web/packages/intergraph/index.html
>>>
>>> to be very useful for converting between the igraph and statnet network
>>> formats.
>>>
>>> For example:
>>>
>>> library(igraph)
>>> library(statnet)
>>> library(intergraph)
>>>
>>> netscience <- nexus.get('netscience')
>>> nNetscience <- asNetwork(netscience)
>>>
>>> system.time(nsmodel <- ergm(nNetscience ~ edges + altkstar(2.0,
>>> fixed=TRUE) + gwesp(log(2.0), fixed=TRUE) + gwdsp(log(2.0),
>>> fixed=TRUE), control=control.ergm(main.method="Stepping",
>>> MCMC.burnin=1e+6,MCMC.interval=1e+04,MCMC.samplesize=1e+05)))
>>>
>>> summary(nsmodel)
>>>
>>> Note sure I can help with your other particular questions, I prefer to
>>> use igraph for plotting (where it is relatively easy to do things like
>>> your question 3) and computing various statistics (question 1), I use
>>> statnet primarily for ergm.
>>>
>>> Regards,
>>> Alex..
>>>
>>>
>>> On Mon, Jul 13, 2015 at 3:10 PM, Ian McCulloh <[log in to unmask]
>>> <mailto:[log in to unmask]>> wrote:
>>>
>>> ***** To join INSNA, visit http://www.insna.org *****
>>>
>>> Hello,
>>>
>>> I have noticed some compatibility issues when I load igraph and
>>> statnet into R at the same time. I'm preferring to use statnet
>>> because of ergms. I'm hoping I can get a little help with the
>>> following:
>>>
>>> 1. How do you calculate connectedness, hierarchy, krackhardt
>>> efficiency, and least upper boundedness using the network package,
>>> SNA, or any of the statnet dependencies?
>>>
>>> 2. Alternatively, is there an easier way to convert data formats
>>> between the network structure of the network package and the graph
>>> structure of the igraph package?
>>>
>>> 3. How do you size nodes by an attribute measure such as centrality
>>> using the network package?
>>>
>>> Thanks,
>>>
>>> Ian McCulloh
>>>
>>> _____________________________________________________________________
>>> SOCNET is a service of INSNA, the professional association for social
>>> network researchers (http://www.insna.org). To unsubscribe, send
>>> an email message to [log in to unmask]
>>> <mailto:[log in to unmask]> containing the line
>>> UNSUBSCRIBE SOCNET in the body of the message.
>>>
>>>
>>> _____________________________________________________________________
>>> SOCNET is a service of INSNA, the professional association for social
>>> network researchers (http://www.insna.org). To unsubscribe, send an
>>> email message to [log in to unmask] containing the line UNSUBSCRIBE
>>> SOCNET in the body of the message.
>>
>> --
>>
>> _______________________________________
>>
>> Katherine Ognyanova, Ph.D.
>> Postdoctoral Researcher, The Lazer Lab
>> Web: www.kateto.net, Twitter: @ognyanova
>> _______________________________________
>>
>> _____________________________________________________________________
>> SOCNET is a service of INSNA, the professional association for social
>> network researchers (http://www.insna.org). To unsubscribe, send
>> an email message to [log in to unmask] containing the line
>> UNSUBSCRIBE SOCNET in the body of the message.
>
>
--
_______________________________________
Katherine Ognyanova, Ph.D.
Postdoctoral Researcher, The Lazer Lab
Web: www.kateto.net, Twitter: @ognyanova
_______________________________________
_____________________________________________________________________
SOCNET is a service of INSNA, the professional association for social
network researchers (http://www.insna.org). To unsubscribe, send
an email message to [log in to unmask] containing the line
UNSUBSCRIBE SOCNET in the body of the message.
|