Want to calculate edge weights as a function of edge attributes

Feb 19, 2014 at 11:46 PM
So, I'm working with a network of political organizations, and I have a number of attributes that I want to use as numerical values in computing the strength of a particular tie. In the network, two organizations are linked (per attribute) if they share the attribute. For example, any two organizations whose Political Orientation is "Left" are linked. Thus two given organizations may have many links between them - one for each attribute they have in common.

However, currently each of these types of links are given the same weight/strength. I want certain attributes to generate stronger links (e.g. the Political Orientation tie should be stronger than a tie indicating whether the two are radical or reformist). I believe I can do this with an IF function for each edge, but what I'm stuck on is how to assign the value to the edge so that it pulls relatively more/less on the vertices it connects. I know it should be listed in 'Other Columns' on the edge sheet, but I don't know how to get that data to reflect visually on the graph.

Thanks for any help you can offer!
Feb 24, 2014 at 4:06 PM

Thanks for the interest in NodeXL.

Please have a look at the NodeXL>Data>Prepare Data>Count and Merge Duplicate Edges feature.


This can help you add a value to the edges based on the frequency of incidence of connections.

But if you already have Edge Attributes that you would like to map to various weights, you can add another column, call it "Relationship Strength" and use a formula to assign a different weight based on the type of relationship.

Here is an example that sets a value for "Replies to" = 10 and the value for "Mentions" = 20:
 =IF([@Relationship]="Replies to",10,IF([@Relationship]="Mentions",20,1))
Hope this helps!


Feb 27, 2014 at 7:34 PM
Hey Marc, thanks for your reply!

The IF function is definitely what I want to be using here. However, I'm still unsure as to how I get the graph to reflect the edge weights, i.e. bring vertices with stronger net edge weight closer together. Also, I tried copy/pasting the IF function you wrote above into the formula bar, and NodeXL won't accept the syntax, though I've checked it with the Excel function library and everything looks okay. The parentheses for the nested IF are colored red, I think it must have something to do with that.

Thanks again, you're a great help.

Mar 1, 2014 at 6:33 PM

You may want to share the workbook with me via NodeXLGraphGallery or email.

I believe it is possible to take a small set of categorical variables and map them to numerical values with a compound =IF() function.

With a large set, it is possible to get this result with a =VLOOKUP() but that may require creating a new worksheet with a table with all categorical values and their respective numerical weights.