Skip to content

Degree Centrality

Haolin Wu edited this page Jun 19, 2018 · 4 revisions

Degree Centrality Class

For each component in the graph, this method uses a for-loop to iterate through each node in the component. At every iteration, the number of incident nodes (graph.getConnectedNode(node).size()) is compared with the current highest value highest and appropriately updated when necessary.

If the amount of incident nodes for a particular node is greater than highest, the old ArrayList is wiped, and a new list is created with this node.

If the amount of incident nodes is the same as highest and is not already a part of the list, it is added to the list provided the list does not already have 5 nodes.

The return type is an Array of ArrayList integers (ArrayList<Integer>[]). Each index of the array contains an ArrayList of integers representing the nodes which have the highest degree centrality for each component.

Complexity:

The Degree centrality iterates through each node and checks for the amount of incident edges at each iteration. This complexity can be described as O(V)

Clone this wiki locally