Vertex Triangle Counting

Description, inputs and outputs of the Vertex Triangle counting algorithm

URI

<http://cray.com/graphAlgorithm.vertex_triangle_counting>

Description

The Vertex Triangle Counting algorithm is used to gather statistics on the vertices based on the triangles they participate in and for non-cyclic triangles, their position in the triangle.

Inputs and Default Values

  • Vector inputs- None.
  • Scalar inputs - This algorithm accepts a single integer scalar argument. The value of this integer ranges from 0 to 4 and specifies which types of triangles are to be included in the counting statistics.
    • 0: Return a count of all the triangles in the graph, both cyclic (including rotations) and non-cyclic triangles.
    • 1: Return a count of all the unique triangles in the graph, both cyclic and non-cyclic triangles
    • 2: Return a count of only the non-cyclic triangles
    • 3: Return a count of only the cyclic triangles (including rotations)
    • 4: Return a count of only the unique cyclic triangles

Outputs

Output is a four-column intermediate result. Each row in the intermediate results contains a vertex URI followed by a total count of the triangles for which it participates as either a through_vertex, in_vertex, or out_vertex, respectively. The PRODUCING clause should be interpreted as "vertexID","through_count", "in_count", "out_count", where the counts refer to the number of triangles in which the vertex participates in that role.

Example: Vertex Triangle Counting

PREFIX cray: <http://cray.com/>
  SELECT ?id ?through ?in ?out
  WHERE {
    CONSTRUCT{
      ?sub ?pred ?obj .
    }
    WHERE{
      ?sub ?pred ?obj .
    }
    INVOKE cray:graphAlgorithm.vertex_triangle_counting(0)
    PRODUCING ?id ?through ?in ?out
  }