giving weights to relationships (or connections, or edges)

Jun 15, 2013 at 8:18 PM
Here's the scenario: a node (representing a person) could have, say, following types of relationships with another node: personal, political, and institutional, and this applies to each and every node in the network. Now, I'd like to give the highest weight to edges that represent personal relationships(say a weight of 3), followed by institutional (weight=2) and then political (weight=1). My goal is to differentiate the impact of these different types of relationships on the network of relationships. I'd like to see the impact in terms of node size and other metrics in the vertices metrics (degree in undirected and in/out degree in directed) and visually in the graph.

My question (and thank you in advance): how do I do it? I have no idea how to write code, so plain English please! Please let me know if you need any clarification to my question. Thank you!
Jun 16, 2013 at 9:09 PM

Thanks for the interest in NodeXL. You can probably accomplish your task in NodeXL, but I may need more detail.

In NodeXL, you can express your data as an attribute of an edge. What I believe you would like to do is count the number of connections of each type that occurs in your network.

The NodeXL>Data>Prepare Data>Count and Merge Duplicate Edges feature may be useful for you. It allows you to create a count of the number of edges between each pair of vertices connected in the network. It can also allow you to specify that edges have different types and NodeXL will count the number of edges between each vertex pair in the network with each kind of edge type.

You describe wanting to get different metrics for each of the different networks created by each edge type. To do this you can selectively "Skip" all edges that do not meet a requirement and then recalculate metrics, save the results, and then repeat with a different set of edges. You can turn edges on or off manually by changing the "Visibility"column for any edge in the Edges worksheet. You may need to select the NodeXL>Show/Hide>Workbook Columns>Visual Properties command to display the Visibility column. The value of this cell governs if the edge is displayed and used for calculating metrics or if it is skipped and ignored completely, or hidden from view but still used in calculations. (Show if in an Edge=1, Skip=0, Hide=2,Show=4).

An alternative method of selecting edges for display is the Autofill Columns>Edges>Edge Visibility setting. Be sure to check out the options for that setting to configure a conditional for setting which edges to display.

Edges of different types can also be assigned different colors or widths.

I hope this helps you get the results you are looking for using NodeXL.

Jun 17, 2013 at 1:10 PM
Sorry about not being clear but I'm NOT trying to count the number of connections of each type that occurs in my network. I'd rather like to give weight (mentioned in the original post) to EACH connection depending on the type of relationship each node has (please see my original post). Does this make more sense? Due to sensitive nature of the data, I could only provide additional details on the nodes and their relationships offline (off the discussion page) - please contact me if needed. Thank you very much!
Jun 17, 2013 at 4:55 PM
Edited Jun 17, 2013 at 4:55 PM
OK! Yes: it is possible to create a different value for each relationship type for edges in NodeXL.

I will assume that you have a column on the Edges worksheet that contains the name of the relationship.

You can add a column (I called mine "Relationship Value) alongside this column and populate it with a formula that might look like:

=IF([@Relationship]="Mentions",10,IF([@Relationship]="Replies to",5,IF([@Relationship]="Tweet",1)))

(This assumes three relationship types: Mentions, Replies to, and Tweet which have a numerical value of 10, 5, and 1 respectively.)

This creates mapping between each relationship type and a value:

10 Mentions
10 Mentions
10 Mentions
5 Replies to
5 Replies to
5 Replies to
1 Tweet
1 Tweet
1 Tweet

These values could then be used in another formula in a new column I called "Vertex 1 Relationship Value":

=SUMIF([Vertex 1],[@[Vertex 1]],[Relationship value])

This will place the sum of the Relationship value found for each edge.

To make this value available to drive a vertex display attribute it must now be transferred to the Vertices worksheet with a VLOOKUP()


NOTE: it is necessary to SORT the Edges worksheet from A->Z on the Vertex 1 Column to allow the VLookup to operate correctly.

I hope this helps!


Jun 17, 2013 at 4:58 PM
I'm also having trouble understanding your requirements.

Are you saying that you would like the size of a vertex to be proportional to the sum of the weights of the edges connected to the vertex? In other words, if you have these three edges in your graph:

Vertex 1, Vertex 2, Edge Weight
A, B, 3
A, B, 1
B, C, 2

...then do you want vertex A to be twice as large as vertex C, because the sum of the weights of the edges connected to vertex A (3+1=4) is twice as large as the sum of the weights of the edges connected to vertex C (2)?

If not, then please provide a specific example of what you want to accomplish.

-- Tony
Jun 17, 2013 at 4:59 PM
My question crossed paths with Marc's post. If he nailed what you need, ignore my comments.

-- Tony
Jun 18, 2013 at 3:26 PM
Hi Marc and Tony,
Thank you both. I think Marc is more on the target with what I'm trying to accomplish, so I'd like to try his suggestion.

This is what I already have (prior to asking for help) - I used the "Add Your Own Columns Here" column to identify the type of relationships between nodes (edges) in the Edge worksheet; each cell in this column was text only and was populated with one of the following words: personal, political, or institutional (these are the type of relationships I mentioned in my original post). Now, to implement Marc's suggestion, am I correct in assuming that I again use the "Add Your Own Columns Here" to implement Marc's formulae (I'll modify) in my data? If I'm not on the right track in terms of understanding Marc's suggestion, please let me know what should I be doing differently. Thank you again!