Vertex Triangle Count

The Vertex Triangle Count algorithm counts number of triangles that a vertex is a member of and computes the clustering coefficient for the vertex. A triangle is defined as three nodes that are connected by three edges (a-b, b-c, c-a).

Vertex Triangle Count Syntax

Graph algorithms are accessed from an internal SPARQL service endpoint. To incorporate the Vertex 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 in the SERVICE clause to count the number of triangles that each node belongs to in a graph. The table below describes each property.

SERVICE <csi:triangles>
  {
    [] <csi:binding-vertex>                  ?vertex_variable_name ;
       <csi:binding-vertex-triangle-count>   ?triangle_count_variable_name ;
       <csi:binding-clustering-coefficient>  ?binding_cc_variable_name ;
       <csi:edge-label>                      <edge_uri> .
}
Property Range Description
<csi:binding-vertex> URI Required property that defines the name to use for the result column that lists each vertex.
<csi:binding-vertex-triangle-count> variable Required property that defines the name to use for the result column that lists the number of triangles that a vertex belongs to.
<csi:binding-clustering-coefficient> variable Required property that defines the name to use for the result column that lists the clustering coefficient value for each node. The algorithm returns a double value that indicates the degree to which the node tends to cluster with other nodes.
<csi:edge-label> URI 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.