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 re_type, STRING weight, BOOL in_degree = TRUE,
    BOOL out_degree = TRUE, INT top_k=100, BOOL print_accum = TRUE,
    STRING result_attr = "",STRING file_path = "")

Parameters

Parameter Description

STRING v_type

Vertex type to traverse.

STRING e_type

Edge type to traverse.

STRING re_type

Reverse vertex type to traverse and calculate in-degree.

STRING weight

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_accum

If true, return JSON results to standard output.

STRING result_attr

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.