Re: [igraph] Interpretation of edge weights in the calculation of weighted diameter and weighted betweenness
Hi Chris, Thanks for this great clarification and the proposed transform methods. Also thanks for the reference to your R package, I will definitely take note of that. Now, I have looked at the distribution of the edge weights of all my daily networks. The weights are indeed between 0 and 1, however they are not evenly distributed between 0 and 1. Actually, most edge weights are below 0.2. Cases in which the edge weight is 1 is basically where 2 birds have only interacted with each other and not with any other birds (during that day). These cases are rather outliers as it does not happen that often that 2 birds only interact with each other and not with others. Would this be a problem when using the method 'substracting from 1' or say the method 'taking the inverse'? Thanks. Kindly, Brenn Van: igraph-help namens Chris Watson Verzonden: dinsdag 15 oktober 2019 16:48 Aan: Help for igraph users Onderwerp: Re: [igraph] Interpretation of edge weights in the calculation of weighted diameter and weighted betweenness Hi Brenn, this is common in analyses of brain networks, in which a higher edge weight indicates a stronger connection. For example, they can be represented by correlation/covariance (between signals in brain regions A and B) so that a higher edge weight (w --> 1) indicates greater similarity in function; or, they are (proportional to) the "number of connections" between regions A and B so that a higher edge weight (w --> Inf) indicates a greater amount of structural/physical connectivity. In the brain network literature, I have discovered that there are ~5 different edge weight transform methods (the first 3 being the most common by far): 1. Invert the weights:1 / w 2. Take the negative (natural) log:-log(w) 3. Subtract from 1:1 - w 4. Normalize by the network's maximum weight and take the log: -log10(w / max(w)) 5. Same as 4, but add 1:-log10(w / max(w) + 1) Since all your edge weights are 0 <= w <= 1, then subtracting from 1 might be the best. However, as Szabolcs points out, you need to consider if this makes practical sense for your study and the type of data you have. Chris P.S. I have an R package, "brainGraph", with a function called "xfm.weights" that does this. You can see an older version of the function at https://github.com/cwatson/brainGraph/blob/master/R/utils.R#L396 On 10/15/19, Brenn Poppe wrote: > Hi Tamás, > > Thank you very much for this answer! > > I could definitely consider using the centrality metrics you propose here. > > Thanks. > > Kindly, > Brenn > > Van: igraph-help > namens Tamas Nepusz > Verzonden: dinsdag 15 oktober 2019 10:30 > Aan: Help for igraph users > Onderwerp: Re: [igraph] Interpretation of edge weights in the calculation of > weighted diameter and weighted betweenness > > > My 'raw' adjacency matrices have as values these numbers of co-occurrences > (as you say: the number of interactions) between each pair of birds. However > for constructing my networks I do not use these absolute values (nr. of > occurrences) as edge weights but a standardized value. This standardized > value is actually the number of co-occurences 2 birds have divided by the > sum of all co-occurrences both of these 2 birds had with other birds > (including with each other) during that day. > > In this case the weights behave very much like "probabilities" for a random > walker that traverses the graph (the sum of weights of each outbound edge > incident on a node is 1); your best bet is a measure that has an underlying > random-walker-like assumption like eigenvector centrality or PageRank. > > T. > > > ___ igraph-help mailing list igraph-help@nongnu.org https://lists.nongnu.org/mailman/listinfo/igraph-help ___ igraph-help mailing list igraph-help@nongnu.org https://lists.nongnu.org/mailman/listinfo/igraph-help
Re: [igraph] Interpretation of edge weights in the calculation of weighted diameter and weighted betweenness
Hi Brenn, this is common in analyses of brain networks, in which a higher edge weight indicates a stronger connection. For example, they can be represented by correlation/covariance (between signals in brain regions A and B) so that a higher edge weight (w --> 1) indicates greater similarity in function; or, they are (proportional to) the "number of connections" between regions A and B so that a higher edge weight (w --> Inf) indicates a greater amount of structural/physical connectivity. In the brain network literature, I have discovered that there are ~5 different edge weight transform methods (the first 3 being the most common by far): 1. Invert the weights:1 / w 2. Take the negative (natural) log:-log(w) 3. Subtract from 1:1 - w 4. Normalize by the network's maximum weight and take the log: -log10(w / max(w)) 5. Same as 4, but add 1:-log10(w / max(w) + 1) Since all your edge weights are 0 <= w <= 1, then subtracting from 1 might be the best. However, as Szabolcs points out, you need to consider if this makes practical sense for your study and the type of data you have. Chris P.S. I have an R package, "brainGraph", with a function called "xfm.weights" that does this. You can see an older version of the function at https://github.com/cwatson/brainGraph/blob/master/R/utils.R#L396 On 10/15/19, Brenn Poppe wrote: > Hi Tamás, > > Thank you very much for this answer! > > I could definitely consider using the centrality metrics you propose here. > > Thanks. > > Kindly, > Brenn > > Van: igraph-help > namens Tamas Nepusz > Verzonden: dinsdag 15 oktober 2019 10:30 > Aan: Help for igraph users > Onderwerp: Re: [igraph] Interpretation of edge weights in the calculation of > weighted diameter and weighted betweenness > > > My 'raw' adjacency matrices have as values these numbers of co-occurrences > (as you say: the number of interactions) between each pair of birds. However > for constructing my networks I do not use these absolute values (nr. of > occurrences) as edge weights but a standardized value. This standardized > value is actually the number of co-occurences 2 birds have divided by the > sum of all co-occurrences both of these 2 birds had with other birds > (including with each other) during that day. > > In this case the weights behave very much like "probabilities" for a random > walker that traverses the graph (the sum of weights of each outbound edge > incident on a node is 1); your best bet is a measure that has an underlying > random-walker-like assumption like eigenvector centrality or PageRank. > > T. > > > ___ igraph-help mailing list igraph-help@nongnu.org https://lists.nongnu.org/mailman/listinfo/igraph-help
Re: [igraph] Interpretation of edge weights in the calculation of weighted diameter and weighted betweenness
Hi Tamás, Thank you very much for this answer! I could definitely consider using the centrality metrics you propose here. Thanks. Kindly, Brenn Van: igraph-help namens Tamas Nepusz Verzonden: dinsdag 15 oktober 2019 10:30 Aan: Help for igraph users Onderwerp: Re: [igraph] Interpretation of edge weights in the calculation of weighted diameter and weighted betweenness My 'raw' adjacency matrices have as values these numbers of co-occurrences (as you say: the number of interactions) between each pair of birds. However for constructing my networks I do not use these absolute values (nr. of occurrences) as edge weights but a standardized value. This standardized value is actually the number of co-occurences 2 birds have divided by the sum of all co-occurrences both of these 2 birds had with other birds (including with each other) during that day. In this case the weights behave very much like "probabilities" for a random walker that traverses the graph (the sum of weights of each outbound edge incident on a node is 1); your best bet is a measure that has an underlying random-walker-like assumption like eigenvector centrality or PageRank. T. ___ igraph-help mailing list igraph-help@nongnu.org https://lists.nongnu.org/mailman/listinfo/igraph-help
Re: [igraph] Interpretation of edge weights in the calculation of weighted diameter and weighted betweenness
Hi Serafim, Thank you for this tip! This is indeed what I was thinking about doing. Kindly, Brenn Van: igraph-help namens serafim loukas Verzonden: dinsdag 15 oktober 2019 7:59 Aan: Help for igraph users Onderwerp: Re: [igraph] Interpretation of edge weights in the calculation of weighted diameter and weighted betweenness Hi there, Since the higher the value on the edge, the higher the interaction, you can invert the edge weights before applying any function that uses shortest paths (e.g efficiency, shortest path length). The reason is that in graph theory the lower the shortest path (cost) from node i to j the higher the efficiency to go from i to j. So by inverting the values, you will “force” these functions to look at the right direction. Hope this helps, Serafeim On Oct 14, 2019, at 22:06, Brenn Poppe wrote: Hi Szabolcs, Thank you very much for the answers and the clarification! Due to time limitations and the upcoming deadlines of my thesis I won't be able to dig much deeper into the matter on how I should eventually properly transform my edge weights into distances, so that the meaning of diameter and betweenness would make sense. I will however definitely discuss this issue with my thesis supervisor. I definitely understand that the meaning and usefullness of diameter and betweenness indeed strongly depend on the context of how the networks are constructed Some clarification on the background of my networks: My networks are actually based on registration data of birds visiting garden feeders. Here we assume that birds that visit a feeder together (at the same time) have a social connection. The more co-occurences between both birds, the more strongly they are socially connected. My 'raw' adjacency matrices have as values these numbers of co-occurrences (as you say: the number of interactions) between each pair of birds. However for constructing my networks I do not use these absolute values (nr. of occurrences) as edge weights but a standardized value. This standardized value is actually the number of co-occurences 2 birds have divided by the sum of all co-occurrences both of these 2 birds had with other birds (including with each other) during that day. It is these standardized values that I use as interaction strengths (strength of connection) and thus as edge weights. Thanks again. Kindly, Brenn Van: igraph-help namens Szabolcs Horvát Verzonden: maandag 14 oktober 2019 18:14 Aan: Help for igraph users Onderwerp: Re: [igraph] Interpretation of edge weights in the calculation of weighted diameter and weighted betweenness Hello Brenn, All functions in igraph which are based on the concept of paths / paths lengths / shortest paths interpret weights as distances. The length of a path is the sum of the edge weights along the path. On Mon, 14 Oct 2019 at 17:57, Brenn Poppe wrote: > > Dear all, > > For my masterthesis I'm constructing and analyzing animal social networks. In > these networks individual Great Tits (Parus major) and Blue Tits (Cyanistes > caeruleus) are represented by nodes. I construct a set of daily networks that > are undirected and weighted starting from adjacency matrices. The values in > these adjacency matrices are used as the edge weights of the links between > nodes in my graphs. These values represent an interaction strength: the more > 2 individuals interacted (co-occurring on garden feeders) the higher their > interaction strength and the higher the edge weight between these individuals > in the graph. > > I use igraph in R to construct and analyse these daily networks. > > Now for each of these daily networks I calculate (among others) 2 metrics > namely: the diameter (graph-level) and the betweenness centrality > (node-level). Because I have weighted networks I also use the weights when > implementing these functions. > > Now based on my interpretation of the edge weights, being interaction > strengths, I would expect the diameter to be the path that has the lowest sum > of edge weights and thus a path along which all interactions are weak. That is not how "diameter" is defined in graph theory. The diameter is the length of the longest shortest-path. Of course we can talk about the shortest shortest path too, regardless of what we call it. However, you may not find that to be a useful concept. THe shortest shortest path consists of the edge with the smallest weight. > Assuming that for example information travels slower along a path with weak > connections opposed to a path with strong connections. However I have noticed > that the calculated diameter actually gives the 'opposite' result being the > path with the highest sum of edge weights and thus a path with overall strong > connections. This is a path tha
Re: [igraph] Interpretation of edge weights in the calculation of weighted diameter and weighted betweenness
> My 'raw' adjacency matrices have as values these numbers of co-occurrences > (as you say: the number of interactions) between each pair of birds. > However for constructing my networks I do not use these absolute values > (nr. of occurrences) as edge weights but a standardized value. This > standardized value is actually the number of co-occurences 2 birds have > divided by the sum of all co-occurrences both of these 2 birds had with > other birds (including with each other) during that day. > In this case the weights behave very much like "probabilities" for a random walker that traverses the graph (the sum of weights of each outbound edge incident on a node is 1); your best bet is a measure that has an underlying random-walker-like assumption like eigenvector centrality or PageRank. T. ___ igraph-help mailing list igraph-help@nongnu.org https://lists.nongnu.org/mailman/listinfo/igraph-help
Re: [igraph] Interpretation of edge weights in the calculation of weighted diameter and weighted betweenness
Hi there, Since the higher the value on the edge, the higher the interaction, you can invert the edge weights before applying any function that uses shortest paths (e.g efficiency, shortest path length). The reason is that in graph theory the lower the shortest path (cost) from node i to j the higher the efficiency to go from i to j. So by inverting the values, you will “force” these functions to look at the right direction. Hope this helps, Serafeim On Oct 14, 2019, at 22:06, Brenn Poppe wrote: Hi Szabolcs, Thank you very much for the answers and the clarification! Due to time limitations and the upcoming deadlines of my thesis I won't be able to dig much deeper into the matter on how I should eventually properly transform my edge weights into distances, so that the meaning of diameter and betweenness would make sense. I will however definitely discuss this issue with my thesis supervisor. I definitely understand that the meaning and usefullness of diameter and betweenness indeed strongly depend on the context of how the networks are constructed Some clarification on the background of my networks: My networks are actually based on registration data of birds visiting garden feeders. Here we assume that birds that visit a feeder together (at the same time) have a social connection. The more co-occurences between both birds, the more strongly they are socially connected. My 'raw' adjacency matrices have as values these numbers of co-occurrences (as you say: the number of interactions) between each pair of birds. However for constructing my networks I do not use these absolute values (nr. of occurrences) as edge weights but a standardized value. This standardized value is actually the number of co-occurences 2 birds have divided by the sum of all co-occurrences both of these 2 birds had with other birds (including with each other) during that day. It is these standardized values that I use as interaction strengths (strength of connection) and thus as edge weights. Thanks again. Kindly, Brenn Van: igraph-help namens Szabolcs Horvát Verzonden: maandag 14 oktober 2019 18:14 Aan: Help for igraph users Onderwerp: Re: [igraph] Interpretation of edge weights in the calculation of weighted diameter and weighted betweenness Hello Brenn, All functions in igraph which are based on the concept of paths / paths lengths / shortest paths interpret weights as distances. The length of a path is the sum of the edge weights along the path. On Mon, 14 Oct 2019 at 17:57, Brenn Poppe wrote: > > Dear all, > > For my masterthesis I'm constructing and analyzing animal social networks. In > these networks individual Great Tits (Parus major) and Blue Tits (Cyanistes > caeruleus) are represented by nodes. I construct a set of daily networks that > are undirected and weighted starting from adjacency matrices. The values in > these adjacency matrices are used as the edge weights of the links between > nodes in my graphs. These values represent an interaction strength: the more > 2 individuals interacted (co-occurring on garden feeders) the higher their > interaction strength and the higher the edge weight between these individuals > in the graph. > > I use igraph in R to construct and analyse these daily networks. > > Now for each of these daily networks I calculate (among others) 2 metrics > namely: the diameter (graph-level) and the betweenness centrality > (node-level). Because I have weighted networks I also use the weights when > implementing these functions. > > Now based on my interpretation of the edge weights, being interaction > strengths, I would expect the diameter to be the path that has the lowest sum > of edge weights and thus a path along which all interactions are weak. That is not how "diameter" is defined in graph theory. The diameter is the length of the longest shortest-path. Of course we can talk about the shortest shortest path too, regardless of what we call it. However, you may not find that to be a useful concept. THe shortest shortest path consists of the edge with the smallest weight. > Assuming that for example information travels slower along a path with weak > connections opposed to a path with strong connections. However I have noticed > that the calculated diameter actually gives the 'opposite' result being the > path with the highest sum of edge weights and thus a path with overall strong > connections. This is a path that I would consider to be the shortest rather > than the longest. In some occassions the diameter is exactly the same as the > highest edge weight in a network. It looks as if the edge weights are > interpreted as costs/distances/resistance. > > Because of this 'problem' with the calculation of diameter according to my > interpretation I also
Re: [igraph] Interpretation of edge weights in the calculation of weighted diameter and weighted betweenness
Hi Szabolcs, Thank you very much for the answers and the clarification! Due to time limitations and the upcoming deadlines of my thesis I won't be able to dig much deeper into the matter on how I should eventually properly transform my edge weights into distances, so that the meaning of diameter and betweenness would make sense. I will however definitely discuss this issue with my thesis supervisor. I definitely understand that the meaning and usefullness of diameter and betweenness indeed strongly depend on the context of how the networks are constructed Some clarification on the background of my networks: My networks are actually based on registration data of birds visiting garden feeders. Here we assume that birds that visit a feeder together (at the same time) have a social connection. The more co-occurences between both birds, the more strongly they are socially connected. My 'raw' adjacency matrices have as values these numbers of co-occurrences (as you say: the number of interactions) between each pair of birds. However for constructing my networks I do not use these absolute values (nr. of occurrences) as edge weights but a standardized value. This standardized value is actually the number of co-occurences 2 birds have divided by the sum of all co-occurrences both of these 2 birds had with other birds (including with each other) during that day. It is these standardized values that I use as interaction strengths (strength of connection) and thus as edge weights. Thanks again. Kindly, Brenn Van: igraph-help namens Szabolcs Horvát Verzonden: maandag 14 oktober 2019 18:14 Aan: Help for igraph users Onderwerp: Re: [igraph] Interpretation of edge weights in the calculation of weighted diameter and weighted betweenness Hello Brenn, All functions in igraph which are based on the concept of paths / paths lengths / shortest paths interpret weights as distances. The length of a path is the sum of the edge weights along the path. On Mon, 14 Oct 2019 at 17:57, Brenn Poppe wrote: > > Dear all, > > For my masterthesis I'm constructing and analyzing animal social networks. In > these networks individual Great Tits (Parus major) and Blue Tits (Cyanistes > caeruleus) are represented by nodes. I construct a set of daily networks that > are undirected and weighted starting from adjacency matrices. The values in > these adjacency matrices are used as the edge weights of the links between > nodes in my graphs. These values represent an interaction strength: the more > 2 individuals interacted (co-occurring on garden feeders) the higher their > interaction strength and the higher the edge weight between these individuals > in the graph. > > I use igraph in R to construct and analyse these daily networks. > > Now for each of these daily networks I calculate (among others) 2 metrics > namely: the diameter (graph-level) and the betweenness centrality > (node-level). Because I have weighted networks I also use the weights when > implementing these functions. > > Now based on my interpretation of the edge weights, being interaction > strengths, I would expect the diameter to be the path that has the lowest sum > of edge weights and thus a path along which all interactions are weak. That is not how "diameter" is defined in graph theory. The diameter is the length of the longest shortest-path. Of course we can talk about the shortest shortest path too, regardless of what we call it. However, you may not find that to be a useful concept. THe shortest shortest path consists of the edge with the smallest weight. > Assuming that for example information travels slower along a path with weak > connections opposed to a path with strong connections. However I have noticed > that the calculated diameter actually gives the 'opposite' result being the > path with the highest sum of edge weights and thus a path with overall strong > connections. This is a path that I would consider to be the shortest rather > than the longest. In some occassions the diameter is exactly the same as the > highest edge weight in a network. It looks as if the edge weights are > interpreted as costs/distances/resistance. > > Because of this 'problem' with the calculation of diameter according to my > interpretation I also have similar concerns about the calculation of weighted > betweenness. I have seen this issue (a confusing interpretation of edge > weights by igraph) pop up several times on this mailing list. > > Although this issue has popped up several times, I have not found a clear > solution in the answers as to what I should do with my data or my script to > get diameter and betweenness to be interpretable according to my > interpretation of the edge weights: This is because there is no g
Re: [igraph] Interpretation of edge weights in the calculation of weighted diameter and weighted betweenness
Hello Brenn, All functions in igraph which are based on the concept of paths / paths lengths / shortest paths interpret weights as distances. The length of a path is the sum of the edge weights along the path. On Mon, 14 Oct 2019 at 17:57, Brenn Poppe wrote: > > Dear all, > > For my masterthesis I'm constructing and analyzing animal social networks. In > these networks individual Great Tits (Parus major) and Blue Tits (Cyanistes > caeruleus) are represented by nodes. I construct a set of daily networks that > are undirected and weighted starting from adjacency matrices. The values in > these adjacency matrices are used as the edge weights of the links between > nodes in my graphs. These values represent an interaction strength: the more > 2 individuals interacted (co-occurring on garden feeders) the higher their > interaction strength and the higher the edge weight between these individuals > in the graph. > > I use igraph in R to construct and analyse these daily networks. > > Now for each of these daily networks I calculate (among others) 2 metrics > namely: the diameter (graph-level) and the betweenness centrality > (node-level). Because I have weighted networks I also use the weights when > implementing these functions. > > Now based on my interpretation of the edge weights, being interaction > strengths, I would expect the diameter to be the path that has the lowest sum > of edge weights and thus a path along which all interactions are weak. That is not how "diameter" is defined in graph theory. The diameter is the length of the longest shortest-path. Of course we can talk about the shortest shortest path too, regardless of what we call it. However, you may not find that to be a useful concept. THe shortest shortest path consists of the edge with the smallest weight. > Assuming that for example information travels slower along a path with weak > connections opposed to a path with strong connections. However I have noticed > that the calculated diameter actually gives the 'opposite' result being the > path with the highest sum of edge weights and thus a path with overall strong > connections. This is a path that I would consider to be the shortest rather > than the longest. In some occassions the diameter is exactly the same as the > highest edge weight in a network. It looks as if the edge weights are > interpreted as costs/distances/resistance. > > Because of this 'problem' with the calculation of diameter according to my > interpretation I also have similar concerns about the calculation of weighted > betweenness. I have seen this issue (a confusing interpretation of edge > weights by igraph) pop up several times on this mailing list. > > Although this issue has popped up several times, I have not found a clear > solution in the answers as to what I should do with my data or my script to > get diameter and betweenness to be interpretable according to my > interpretation of the edge weights: This is because there is no general solution to this problem. Betweenness centrality is just one of many graph metrics that can characterize each vertex (or each edge) in a graph. It is a useful concept for some applications, but not for others. It is up to you to decide whether betweenness carries anything meaningful in your network. It is true that the interpretation is not trivial, and—sadly—not very well-founded in many published papers. Many people will simply transform the weights with a monotonically decreasing functions (e.g. taking the inverse), then compute the betweenness with these new weights. Does this make any sense? In my opinion, this is often debatable. The results you get will depend on the specific monotonic transformation you chose. In some applications, such as when agents are moving along the shortest paths in the network (think e.g. travelling on roads), betweenness can be connected to an actual physical process happening on the network. In a social network where people pass information to each other, there is again a way to connect it to something physical (sociological?) Is there anything tangible (ethological?) you can connect it to? I don't know. It is good to note that if the "strength of connection" in your network represents the number of interactions between the bird, then you can also use a multigraph. The number of edges is the number of interactions. The betweenness computed in this network is yet another different thing. > > Do I have to use a different function or do I have to specify certain > arguments in the functions diameter() and betweenness() > Or can I simple take the inverse (1/edge weight) of the edge weights before > calling the specified functions? > Or. > > Note: all the edge weights range between 0 and 1. > > Thanks in advance, > > Brenn Poppe > Masterstudent MSc in Biology (University of Ghent) > > ___ > igraph-help mailing list > igraph-help@nongnu.org > https://lists.nongnu.o