Class OCGraph.TriangleCount

java.lang.Object
com.ocient.jdbc.graph.OCGraph.TriangleCount
Enclosing class:
OCGraph

public static class OCGraph.TriangleCount extends Object
Provides utility methods for performing Triangle Counting operations on graph data stored in a database. This class handles the creation of intermediate tables and the final result table containing triangle counts per vertex.
  • Constructor Details

    • TriangleCount

      public TriangleCount()
  • Method Details

    • run

      public static void run(String inputSchema, String inputVerticesTable, String inputEdgesTable, String resultSchema, String resultVerticesTable, ArrayList<String> resultVerticesIndexes, Statement stmt) throws SQLException
      Runs the full triangle counting process. This method handles the initial setup, including creating a temporary table for canonical edges (where srcid invalid input: '<' destid, and duplicates/self-loops are removed), executing the core triangle counting logic using the canonical edges, and cleaning up the temporary table afterward.
      Parameters:
      inputSchema - The schema containing the input vertices and edges tables.
      inputVerticesTable - The name of the table containing the graph vertices (must have an 'id' column).
      inputEdgesTable - The name of the table containing the graph edges (must have 'srcid' and 'destid' columns).
      resultSchema - The schema where the result vertices table will be created.
      resultVerticesTable - The name of the table to be created, which will store vertex IDs and their corresponding triangle counts.
      resultVerticesIndexes - A list of column names ('id' or 'triangle_count') on which to create indexes in the result table.
      stmt - The JDBC Statement object to execute SQL queries.
      Throws:
      SQLException - if any database access error occurs during the process.
    • runPreCanonicalized

      public static void runPreCanonicalized(String inputSchema, String inputVerticesTable, String canonicalEdgesTable, String resultSchema, String resultVerticesTable, ArrayList<String> resultVerticesIndexes, Statement stmt) throws SQLException
      Runs triangle count on a graph where the input vertices and canonical edges reside in the same schema, and the edges are already canonicalized (srcid invalid input: '<' destid, no duplicates or self-loops). This method creates the result table, populates it with triangle counts for each vertex, and creates specified indexes. If the operation fails midway, it attempts to drop the partially created result table.
      Parameters:
      inputSchema - The schema containing the input vertices and canonical edges tables.
      inputVerticesTable - The name of the table containing the graph vertices (must have an 'id' column).
      canonicalEdgesTable - The name of the table containing the pre-canonicalized graph edges (must have 'srcid' and 'destid' columns where srcid invalid input: '<' destid).
      resultSchema - The schema where the result vertices table will be created.
      resultVerticesTable - The name of the table to be created, which will store vertex IDs and their corresponding triangle counts.
      resultVerticesIndexes - A list of column names ('id' or 'triangle_count') on which to create indexes in the result table.
      stmt - The JDBC Statement object to execute SQL queries.
      Throws:
      SQLException - if any database access error occurs during the process, or if an invalid index column name is provided.