code: def classify_nodes(graph, hub):
      node_stats = defaultdict(lambda: defaultdict(list))
      for u, v, data in graph.edges(data=True):
          if hub == u:
              h, o = u, v
              if data['i'] != 'Complex':
                  node_stats[o]['up'].append(-1)
              else:
                  node_stats[o]['up'].append(0)
          elif hub == v:
              h, o = v, u
              if data['i'] != 'Complex':
                  node_stats[o]['up'].append(1)
              else:
                  node_stats[o]['up'].append(0)
          else:
              continue
          node_stats[o]['interaction'].append(edge_type_to_class(data['i']))
      node_classes = {}
      for node_id, stats in node_stats.items():
          up = max(set(stats['up']), key=stats['up'].count)
          interactions = [i for i in stats['interaction'] if
                          not (up != 0 and i == 'complex')]
          edge_type = max(set(interactions), key=interactions.count)
          node_type = graph.nodes[node_id]['type']
          node_classes[node_id] = (up, edge_type, node_type)
      return node_classes