import time import java.awt.Color #The max degree should be the population size, or something similar. #It will be the red of the heat map-like colouring MAXDEG = 271 f = 240.0/360.0 f = f/MAXDEG #This loop format will go through all the nodes in the graph for u in g.nodes: #<- Note: for jython scripting the tab here is very important #This will set the node size of a node u u.size = 15 #If for some reason you exceed the population size you set, it will still be red if u.degree > MAXDEG: u.color = (java.awt.Color.getHSBColor(0,0.8,0.9)) #Otherwise, will be on the scale between blue and red else: u.color = (java.awt.Color.getHSBColor((MAXDEG-u.degree)*f,0.8,0.9)) #This is something you may want to know, the number of dots in the graph print(g.underlyingGraph.getNodeCount()) #An example of running a couple layouts. runLayout(YifanHu,iters=250) #If you are running more than one, you will need to give it time to complete before #running another one. Depending on the size of your graph you can tweak this. time.sleep(10) runLayout(FruchtermanReingold,iters=5000)