1.1 - 8.10 - Modularity Tips - Teradata Vantage

Teradata Vantage™ - Machine Learning Engine Analytic Function Reference

Teradata Vantage
Release Number
October 2019
Content Type
Programming Reference
Publication ID
English (United States)
  • If the modularity when you specify multiple resolution points in the Resolution syntax element differs from the modularity for the same resolution points when you specify them individually, Teradata recommends specifying the resolution points individually.
  • The function runs faster on graphs with vertices of data type INTEGER or BIGINT, because they use less memory than graphs with vertices of other data types.

    Suppose that you have Vertices table string_nodes with column id of data type VARCHAR and Edges table string_edges with columns src_id, dest_id, and weight of data types VARCHAR, VARCHAR, and INTEGER, respectively. You can create equivalent INTEGER-based vertex and Edges tables statements such as these:

    CREATE MULTISET TABLE int_nodes (id_string VARCHAR, id_int INTEGER);
    INSERT INTO int_nodes SELECT id, row_number()
      OVER (ORDER BY id) FROM string_nodes;
    CREATE MULTISET TABLE int_edges (src INTEGER, dest INTEGER, weight INTEGER) AS (
      SELECT m1.id_int, m2.id_int, weight
      FROM string_edges E, int_nodes m1, int_nodes m2
      WHERE E.src_id = m1.id_string AND E.dest_id = m2.id_string
    ) WITH DATA;
  • If the column community_id that the function creates has data type VARCHAR, and you want community_id to have the data type INTEGER, use either of the these statements (where the table modularity_output is output by the function):
    SELECT id, rank() OVER (ORDER BY community_id) AS comm_int_id
      FROM modularity_output;
    SELECT id, dense_rank() OVER (ORDER BY community_id) AS comm_int_id
      FROM modularity_output;