4. Link and Filter
In this Session…
Before you begin…
To follow along, download the files:
How To GraphXR 4. Link and Filter
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:
So far, we’ve extracted a House category from the Characters.csv data and created a BELONGS_TO relationship linking House to Character nodes.
Drag and drop Lines.csv onto the project. It includes the number of lines and words spoken by each character in every episode of HBO’s Game of Thrones. Go ahead and zoom out—at over 3,000 nodes, Lines.csv is a much larger dataset than Characters.csv.
Open the Table panel to view Lines data in a spreadsheet format. Under the Category tab click the Lines bubble and locate the speaker property.
With the Link transform, properties with equivalent values can be linked even if the property names are different.
Open the Transform panel => Link tab. With Link, we can create edges belonging to a new or existing relationship. Let’s link up a Characters-SPOKE-Lines pattern with characterName as the source property and speaker as the target property. Now click Run.
You’ll notice many Lines nodes with no connections. These correspond to lines spoken by characters who weren’t in the Characters.csv source data. Let’s clean up these extraneous nodes.
But first let’s save our graph state in memory using Snapshots, It lets us create a local library of graph states that can be downloaded as a .zip archive. Open the Project panel and Settings tab and click the Show Snapshot checkbox.
The title bar of the Snapshots dialog appears in the project space. Click the plus sign to capture a Snapshot.
Click the arrow icon on the left to show the list of snapshots you’ve taken so far. Notice that you can save your snapshots archive locally at any time.
Now let’s return to cleaning up our graph. We’ll use the Degree centrality algorithm to flag nodes with no connections, which we can then select and delete. In the Algorithm panel and Centrality tab, click the Degree button.
The algorithm writes the number of connections for each node to a new degree property. Now we can remove nodes with a degree of 0. In the Legend, click the Property tab and select degree from the dropdown menu.
Locate the degree value of 0, click to select those nodes and press delete (or the Delete icon in the toolbar).
Only nodes which have at least one connection now remain.
First, load our saved snapshot. Open the Snapshots dialog, locate the snapshot, and click the cloud icon to restore the graph that had unconnected nodes.
Open the Algorithm panel and the Centrality tab and click Degree to generate the degree property again.
Open the Filter panel. In the Node Properties menu, select the degree property.
Set the Max value for degree to 0 to ﬁlter out any nodes with one or more connection. Now Click Select Visible Nodes (or simply click the zero-value item in the Legend) then press delete (or the Delete toolbar icon).
Finally, click the filter’s trash can icon to clear the ﬁlter and show the nodes with one or more connections.
What’s left are the nodes that have at least one connection. Let’s take another snapshot and download the snapshot archive (or save a data View or a GXRF file).
How To GraphXR: Module 5. Aggregate and Merge.