Weighted Degree Centrality

Supported Graph Characteristics

Weighted edges

Directed edges

Undirected edges

Homogeneous vertex types

Degree centrality is defined as the number of edges connected to a vertex. The degree can be interpreted in terms of the immediate risk of a vertex for catching whatever is flowing through the network.

Weighted degree centrality allows you to assign weights to the edges connected to a vertex.

Specifications

CREATE QUERY tg_weighted_degree_cent(STRING v_type, STRING e_type,
    STRING reverse_e_type, STRING weight_attribute, BOOL in_degree = TRUE,
    BOOL out_degree = TRUE, INT top_k=100, BOOL print_results = TRUE,
    STRING result_attribute = "",STRING file_path = "")

Parameters

Parameter Description

STRING v_type

Vertex type to traverse.

STRING e_type

Edge type to traverse.

STRING reverse_e_type

Reverse vertex type to traverse and calculate in-degree.

STRING weight_attribute

The name of the attribute that indicates the weight of the edge. The attribute itself must be of type INT.

BOOL in_degree

Whether to count incoming edges when calculating degree centrality.

BOOL out_degree

Whether to count outgoing edges when calculating degree centrality.

INT top_k

The number of vertices with the highest degree centrality to return.

BOOL print_results

If true, return JSON results to standard output.

STRING result_attribute

If not empty, save the degree centrality of each vertex to this attribute.

STRING file_path

If not empty, output CSV results to this filepath.

Output

The vertices with the highest degree centrality scores along with their scores.

Time complexity

The algorithm has a time complexity of \(O(E)\), where \(E\) is the total number of edges in the graph.

Run commands

Schema-Free Query

RUN QUERY tg_weighted_degree_cent (<parameters>)

Packaged Template Query

CALL GDBMS_ALGO.centrality.weighted_degree_cent (<parameters>)