Triangle Count
The Triangle Count algorithm determines the number of triangles that a graph includes and calculates the average clustering coefficient for the resulting network of nodes. A triangle is defined as three nodes that are connected by three edges (a-b, b-c, c-a).
Triangle Count Syntax
Graph algorithms are accessed from an internal SPARQL service endpoint. To incorporate the Triangle Count algorithm in a query, include a SERVICE statement in the WHERE clause. The service call specifies the name of the algorithm and defines the required and optional property values for that algorithm.
Use the following syntax to count the triangles in a graph. The table below describes each property.
SERVICE <csi:triangles> { [] <csi:binding-average-clustering-coefficient> ?binding_avg_cc_var_name ; <csi:binding-triangle-count> ?triangle_count_var_name ; <csi:edge-label> <edge_uri> . }
Property | Description | Range & Default Value |
---|---|---|
<csi:binding-average-clustering-coefficient> | Required property that defines the name to use for the result column that lists the average clustering coefficient value. The algorithm returns a double value that indicates the average degree to which the nodes in the network tend to cluster. | Range: Must be a variable name Default: none |
<csi:binding-triangle-count> | Required property that defines the name to use for the result column that lists the number of triangles in the graph. | Range: Must be a variable name Default: none |
<csi:edge-label> | Required property that lists the edge URI that defines the graph to operate on. The graph is the set of vertices that are connected by this URI. | Range: Must be a URI Default: none |