In this Session…

Before you begin…

  • Using Link to create new edges.

  • Using the Degree Centrality algorithm to Filter data.

  • Using Snapshots to save data.

To follow along, download the files:

HowTo_04_START.graphxr

and http://kineviz.com/s/GXR_QSG.zip


Slide

1

How To GraphXR 4. Link and Filter

2

Before You Begin…

Ideally, you’ll have worked through Module 3. Properties and Extract. If you’re starting here, and you want to follow along, you’ll need to:

  • Log in to GraphXR, create a Project, and open its graph space. 

  • Download the file http://kineviz.com/s/GXR_QSG.zip, which contains the Game of Thrones data we’ll use in our tutorials.

  • Download the starting data (HowTo_04_START.graphxr) for this module and drag and drop it onto the graph space.  

3

So far, we’ve extracted a House category from the Characters.csv data and created a belongs_to relationship linking House to Character nodes. Now drag and drop Lines.csv onto the graph space. It includes the total number of lines and words spoken by each character in every episode of  HBO’s Game of Thrones.

4

You might want to zoom out—at over 3,000 nodes, this is a much larger dataset than Characters.csv.  At any time, you can open the Table panel to see the graph and its properties in spreadsheet format. You can also view specific categories, relationships, or search by keywords. Do you notice the speaker property on Lines?

5

The values in speaker should match the values in Characters’ characterName. We can use these properties to link our characters to their line counts for each episode. Go to the Transforms panel => Link  tab.

6

The Link transform enables creation of new edges belonging to a new or existing relationship. Let’s set Characters-spoke-Lines using characterName as the source property, and speaker as the target property, then click Run.

7

You’ll notice there are numerous nodes with no connections. These correspond to lines by characters like “King's Landing Man #7” who didn’t make it into the Characters.csv source data. Let’s clean up these extraneous nodes. Before we do, though, let’s turn on Snapshots to save our graph state in memory.

8

Go to the Project panel => Settings tab and enable Show Snapshot. Snapshots are a way of saving  the current graph state in memory (rather than creating a view in the Data tab, which saves to the GraphXR server). This is useful for creating a history or library of graph states. Click the plus sign to capture a Snapshot.

9

You can click the arrow to show thumbnails of the snapshots you’ve taken so far. Now we can go back to cleaning up unconnected nodes in our graph. 

10

Open the Algorithm panel. We’ll use the Degree centrality algorithm to write a measure of node connection to a new property gxr_degree, then use it to select and remove nodes with a zero value. In the Centrality tab, click the Degree button. The algorithm returns the value for all nodes.

11

Now select the Property tab in the Legend and select gxr_degree from the dropdown menu. In the list of property values locate the gxr_degree value of 0. Click to select those nodes then press delete, or the Delete icon, to delete them. 

12

Now only nodes which have at least one connection remain. Alternatively, you can use a filter to accomplish the same thing. Let’s see how.

13

First, let’s load our saved snapshot. Open your snapshot library, locate the snapshot, and click the cloud icon to restore the graph with unconnected nodes.

14

Open the Algorithm panel and the Centrality tab, and click Degree to generate gxr_degree  again. Now go to the Filter panel.

15

Open the Node Properties dropdown and select the gxr_degree property.

16

Set the Max value for gxr_degree to 0 to filter out any nodes with one or more connections. We can select all visible nodes by pressing ctrl+a, clicking Select Fully Visible Nodes, or clicking the zero-value item the Legend. Then press delete or click Delete in the context menu. Now press Del to clear your filter. 

17

What’s left are only nodes that have connections. Let’s take another Snapshot (or save a Data View or a GXRF file). Next we’ll work with Episodes.csv in Module 5. Aggregate and Merge.

Next Steps…