## tnet: Software for Analysing Weighted Networks

*June 12, 2009 at 12:00 am* *
14 comments *

*tnet* is a package written in *R* that can calculate weighted social network measures. Almost all of the ideas posted on this blog are related to weighted networks as, I believe, taking into consideration tie weights enables us to uncover and study interesting network properties. Not only are few social network measures applicable to weighted networks, but there is also a lack of software programmes that can analyse this type of networks. In fact, there are no open-source programmes. This hinders the use and development of weighted measures. *tnet* represents a first step towards creating such a programme. Through this platform, weighted network measures can easily be applied, and new measures easily implemented and distributed.

*tnet*manual, see Software.

Entry filed under: Network thoughts. Tags: actors, arcs, betweenness, centrality, closeness, clustering coefficient, complex networks, degree, directed networks, edges, embeddedness, global, graphs, hubs, Links, local, network, nodes, r-package, reciprocation, reinforcement, shortest distance, shortest path, social network analysis, software, strength of nodes, strength of ties, ties, undirected networks, valued networks, vertices, weighted networks, weighted-richclub.

Weighted Rich-club Effect: A more appropriate null model for scientific collaboration networks Clustering in two-mode networks

1.Mathew Vereb | March 25, 2010 at 9:14 pmDear Mr. Opsahl.

I am writing diploma work and the theme relates with social network analysis. I have a matrix 36×36 which contains european states. Whole matrix contatins just 0 and 1, what depends on fact if states had borders. I think i solve the problem how to define weight to edges and now i am looking for index which will count inputs to vertices which include weights in its calculation. I thought about something like degree, but it always makes the same result even if i am using in or out degree and ignore.eval TRUE or FALSE. Could you help me? Yours sincerely

2.Tore Opsahl | March 27, 2010 at 5:06 pmIf your network is undirected and the weights of ties are symmetric (i.e., if A is connected to B with strength x, B is also connected to A with strength x), out-degree and in-degree produce identical outcomes. Send me an email with the network if you are having issues. T

3.Manal Rayes | October 4, 2010 at 8:34 amDr. Tore,

Thanks for the great tool! I have an issue, though.

I have a longitudinal network that I read from a csv file. When using the as.tnet function it shows an error message: Issues converting matrix format to edgelist.

It is in data-frame format.

Would appreciate your kind help.

Regards

4.Tore Opsahl | October 4, 2010 at 9:57 amManal,

tnet will only be able to handle longitudinal networks from version 3. These functions are still being tested.

Best,

Tore

5.Manal Rayes | October 4, 2010 at 4:11 pmThank you Tore. I managed to write a code to account for the timing info. I got the results of betweenness and closeness, but the clustering showed an error message: Error in rep(1:nrow(net), ks) : invalid ‘times’ argument.

Any hints please?

6.Tore Opsahl | October 7, 2010 at 8:47 amIf you send me your data and code by email, I can have a look at it.

7.Mike sanders | December 14, 2010 at 6:28 amI’d like to thank you for the tnet package, I’ve just recently installed it and found it quite helpful. I had a question for you, if I were dealing with a two-mode network consisting of ‘items vs containers’ and the elements were the frequency counts of the items in each container, what would be the best method for projecting it to a one-mode network of bins? In the SNA literature they use transpose multiplication but that doesn’t give a meaningful representation in the case of weighted networks (but works for binary relations). Any ideas or thoughts would be greatly appreciated.

Thank you,

Mike

8.Tore Opsahl | December 14, 2010 at 7:23 amMike,

Thank you for finding tnet helpful. Some of my thoughts on projecting (binary and weighted) two-mode networks are available here.

Tore

9.Liz | May 12, 2011 at 9:46 pmDear Dr. Opsahl,

Thank you so much for posting all of this information and for creating tnet! Being a social network novice, your papers and blog have been invaluable in my slog through the literature.

I do have two questions. First, I am working with a weighted and directional network and I want to calculate the closeness of each node. Am I right in thinking that the closeness_w function takes directionality into account? This looks to be the case based on the R documentation, but I thought I should check before I go ahead using the values.

Second, I read your 2010 paper in Social Networks and I wanted to clarify my understanding of alpha. As I understand it, if I want to take both the weight of the ties and the number ties for each node equally into account when calculating degree, closeness and betweenness, I should be using an alpha value between 0 and 1 (e.g. a=0.5). Is this correct? Sorry for the simple questions, but as I said, I’m very new to all of this and struggling to understand the basics.

Thank you very much in advance!

Liz

10.Tore Opsahl | May 13, 2011 at 6:48 amLiz,

Thank you for using tnet.

You are absolutely correct on both your assumptions. All one-mode functions in tnet are applicable to directed networks, except when explicitly mentioned (i.e., the local clustering coefficient). Also, you might want to have a look at this post on Closeness centrality in networks with disconnected components as directed networks often do not have just a single strong component (all nodes can reach all other). This feature you can use with (1) the binary measure, alpha=0, (2) the first generation generalisation, alpha=1, and (3) the second generalisation with variable alpha.

Hope this helps,

Tore

11.Liz | May 13, 2011 at 2:26 pmThank you very much! One follow-up question: If I want to put greater emphasis on the weight of the ties than the number of ties would I just choose an alpha value somewhere between 0.5 and 1? I know that an alpha value above 1 positively values the weight and negatively values the number of ties. However, I still want both to have a positive effect, just not equally. Again, sorry for the basic question.

Thank you,

Liz

12.Tore Opsahl | May 13, 2011 at 9:22 pmLiz,

An alpha closer to 1 would indeed do that. Nevertheless, the values of alpha still remain a bit of a question mark as simply the ranges are defined, but not exact values. I hope a study will come that assess optimal levels of alpha for various performance outcomes comes out soon (see the conclusion section of the paper for more details).

Tore

13.Adam | May 27, 2011 at 12:05 pmDear Dr. Opsahl,

I’m a social network novice. I am working with a weighted and directional network and I want to test the “small world effect” with tnet package. But the tnet showed an error message: Error: could not find function “small_world_test_w”. Could you help me?

Adam

14.Tore Opsahl | May 27, 2011 at 1:04 pmAdam,

Great that you are considering the tie weights in the network.

The small_world_test_w-function was removed from tnet since many people had issues understanding exactly what it did. There is hopefully a paper coming out soon that details the steps of it, so then it might be re-introduced.

In the meantime, you can calculate the individual measures yourself as the underlying functions are still part of tnet. In particular, you can create a list-object with random networks, and then use the sapply-function with the distance_w to obtain benchmark values.

If you have any issues with the code, let me know.

Best,

Tore