Private Function getAllParentsList(ByVal node As Node, ByVal subset As ArrayList)
' integer variable for FOR loops
Dim i As Integer = 0
Dim j As Integer = 0
' temporary node to take the node out from lattice
Dim parentNode As New Node
' boolean variable to avoid the duplicacy of the parent ID's in the list
Dim checkOnAdd As Boolean = False
' outer FOR loop to traverse from start to end of list of parentsList of the node
For i = 0 To node.getNoOfParentsPointers - 1
' taking node out of the parent list
parentNode = node.getParentNode(i)
' inner for loop to traverse in the subset list, which is list of unique parents of node
For j = 0 To subset.Count - 1
' if Id of parent node exists in subset list then change the value of boolean
'variable to true and exit for loop
If subset.Item(j) = parentNode.getId Then
checkOnAdd = True
Exit For ' exiting for loop
End If ' end of if condition
Next ' end of For Loop
'if value of that boolean variable is false then it means that parent Id does not exist
' in subset so add parent id to subset otherwise go to next parent node
If checkOnAdd = False Then
subset.Add(parentNode.getId)
End If
' reintialisation of boolean variable
checkOnAdd = False
' function calling itself to go to grand parents and so on, so that to traverse in whole lattice
getAllParentsList(parentNode, subset)
Next ' end of For loop means end of parent list
End Function