Aggregate Property values Aggregate lets you gather properties from a node’s neighboring nodes or edges, optionally perform a function on those values, and write the result back to the origin node. The Aggregate transform starts from a node, collects neighbors connected by a specific relationship, calculates aggregate property values, and writes them back to the original node as a new property. You can aggregate along a property of neighbor nodes or a property of connecting edges. Use Aggregate to generate quantitative data relating to how the graph is connected. For example, in a telephone call log, you can aggregate the number of incoming and outgoing calls for a given caller, and write that aggregate value as a property on each caller node. Preset formulas for an Aggregate property Preset formulas for often-used calculations are shown in the following table. You can also enter a custom javascript formula. Preset Function Format custom Editable format take first Copies the first value of another property. (neighborPropValues) => _.size(neighborPropValues) > 0 ? neighborPropValues[0] : null count Calculates a value based on number of connections. (neighborPropValues) => _.size(neighborPropValues) sum Sums the values of the selected property. (neighborPropValues) => _.sumBy(neighborPropValues,d => Number(d) | 0) average Averages the values of the selected property. (neighborPropValues) => .sumBy(neighborPropValues,d => Number(d) | 0)/(.size(neighborPropValues) > 0 ? _.size(neighborPropValues) : 1) range Finds the lowest and highest value of the selected property. (neighborPropValues) => ${_.minBy(neighborPropValues, d => Number(d) \| 0)} - ${_.maxBy(neighborPropValues, d => Number(d) \| 0)} max Finds the maximum value of the selected property. (neighborPropValues) => _.maxBy(neighborPropValues, d => Number(d) \| 0) min Finds the minimum value of the selected property. (neighborPropValues) => _.minBy(neighborPropValues, d => Number(d) | 0) Aggregate connections between nodes We can use Aggregate to add the total number of lines spoken on each Game of Thrones episode to the graph. Examples use the open-source dataset for the HBO Game of Thrones series. For a hands-on exercise see our How to GraphXR tutorials. A Lines.csv file includes data about the dialog in the show, and an Episodes.csv file includes details about each season and episode. We first transform the imported data as follows: Use an f(x) transform to format seasonEpisode property values for the Episodes category, so that they match the seasonEpisode property in the Lines category. Use the Link transform to link lines to their respective episodes through a new SPOKEN_ON relationship. To aggregate connections between nodes: Deselect the data on the canvas. Open the Transform panel and Aggregate subpanel. In Aggregate To Category, select Episodes. In Aggregate Along select the SPOKEN_ON relationship. In Property Source, we’ll click Property from neighbor nodes and select the lineCount property. In Formula, choose the Sum preset from the dropdown menu. In the New Property textbox, enter totalLines. This is the new aggregate property that will contain the total number of lines of dialog in an episode. A sample result is displayed below the property name. Click the Run button, which also shows the number of nodes involved. Log Error and completion messages appear below the Run button. Since we are just adding a new property to nodes, the graph on the canvas does not visually change. To review the new totalLines property, open the Table panel, click the Category subpanel, and select Episodes.