DisjointNode   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 9
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 1
c 1
b 0
f 1
lcom 0
cbo 0
dl 0
loc 9
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
1
<?php
2
/**
3
 * DataStructures for PHP
4
 *
5
 * @link      https://github.com/SiroDiaz/DataStructures
6
 * @copyright Copyright (c) 2017 Siro Díaz Palazón
7
 * @license   https://github.com/SiroDiaz/DataStructures/blob/master/README.md (MIT License)
8
 */
9
namespace DataStructures\Trees\Nodes;
10
11
/**
12
 * DisjointNode.
13
 *
14
 * The DisjointNode class represents the disjoint set node. It uses a pointer to the
15
 * next parent node and a rank attribute used to add the little tree to the bigger.
16
 * The trees with just one element have a rank of 0.
17
 * Using rank the execution time for operations makeSet, union, and find is of O(log n).
18
 * Rank is used instead of depth.
19
 *
20
 * @author Siro Diaz Palazon <[email protected]>
21
 */
22
class DisjointNode {
23
    public $parent;
24
    public $data;
25
26
    public function __construct($data) {
27
        $this->parent = null;
28
        $this->data = $data;
29
    }
30
}