fornodeinnodes:#iterates over all nodes in the set of nodes
if (node.group=="depth"):#checks if the node has group depth (=is a reference from a paper)
forcitationinnode.citations:#iterates over the papers that this paper is cited by
forcitinnodes:#iterates over all nodes in set of nodes
if (citation.doi_url==cit.doi_urland[citation.doi_url,node.doi_url]notinedges):#checks if there is already a related node that is in the set of nodes
edges.append([citation.doi_url,node.doi_url])# creates an edge between them
if (node.group=="height"):#checks if the node has group height (=is a citation from a paper)
forreferenceinnode.references:#iterates over the papers that this is paper references
forrefinnodes:#iterates over all nodes in set of nodes
if (reference.doi_url==ref.doi_urland[node.doi_url,reference.doi_url]notinedges):#checks if there is already a related node that is in the set of nodes
edges.append([node.doi_url,reference.doi_url])#creates an edge between them