How to colour the node with the highest centrality differently from all other nodes?

I have this data frame:

   Entrez Gene Interactor A  Entrez Gene Interactor B
0                      6840                      7431
1                      6640                      5217
2                       823                      7431

I wrote this code to generate a dash network:

dash_elements = []

for index,i in final_net.iterrows():
    dict1 = {}
    dict2 = {}
    dict1['data'] = dict2
    dict2['id'] = str(i[0])
    dict2['label'] = str(i[0])
    
    dict3 = {}
    dict1['data'] = dict3
    dict3['id'] = str(i[1])
    dict3['label'] = str(i[1])
    
    final_dict2 = {}
    final_dict3 = {}
    final_dict2['data'] = dict2
    final_dict3['data'] = dict3
    
    dash_elements.append(final_dict2)
    dash_elements.append(final_dict3)
    
  
    dict4 = {}
    final_dict4 = {}
    final_dict4['data'] = dict4
    dict4['source'] = str(i[0])
    dict4['target'] = str(i[1])
    dash_elements.append(final_dict4)
    

print(dash_elements)


import dash
import dash_core_components as dcc
from dash import html
import dash_cytoscape as cyto
from dash.dependencies import Input, Output
import plotly.express as px

app = dash.Dash(__name__)

app.layout = html.Div([
    html.P("Dash Cytoscape:"),
    cyto.Cytoscape(
        id='cytoscape',
        elements = dash_elements,
        layout={'name': 'breadthfirst'},
        style={'width': '1000px', 'height': '1000px'}
    )
])

if __name__ == '__main__':
   app.run_server()

The output is:

enter image description here

I want to highlight node 7431, as it is the node with the highest centrality (i.e. the most connections to any other node). I want to colour this node differently (e.g. red), but not manually as this is test data (so I want to calculate every nodes centrality and then colour the node with the highest centrality, instead of manually colouring node 7431).

I identified that node 7431 was the node with the max degree like this:

import networkx as nx
G = nx.from_pandas_edgelist(final_net,'Entrez Gene Interactor A','Entrez Gene Interactor B',['Entrez Gene Interactor A', 'Entrez Gene Interactor B'])
degree = G.degree
degrees = [val for (node, val) in sorted(G.degree(), key=lambda pair: pair[0])]
nodes =  [node for (node, val) in sorted(G.degree(), key=lambda pair: pair[0])]

maxIndexList = [i for i,j in enumerate(degrees) if j==max(degrees)]
max_nodes = [nodes[i] for i in maxIndexList]
print(max_nodes)

And now all I have to do I guess is add a line somewhere to the dash code saying 'if node in max_nodes, colour with X colour, else, colour with Y colour'.

I can find how to add a general stylesheet here, but I can't see how to turn that into an if/else loop. Could someone show me how to do that (or any other code for colouring nodes differently?)

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum