def circular_layout(G, scale=1, center=None, dim=2):
 import numpy as np
 (G, center) = _process_params(G, center, dim)
 if (len(G) == 0):
  pos = {}
 elif (len(G) == 1):
  pos = {nx.utils.arbitrary_element(G): center}
 else:
  theta = ((np.linspace(0, 1, (len(G) + 1))[:(-1)] * 2) * np.pi)
  theta = theta.astype(np.float32)
  pos = np.column_stack([np.cos(theta), np.sin(theta)])
  pos = (rescale_layout(pos, scale=scale) + center)
  pos = dict(zip(G, pos))
 return pos

def circular_layout ( G , scale = 1 , center = None , dim = 2 ) : import numpy as np ( G , center ) = _process_params ( G , center , dim ) if ( len ( G ) == 0 ) : pos = { } elif ( len ( G ) == 1 ) : pos = { nx . utils . arbitrary_element ( G ) : center } else : theta = ( ( np . linspace ( 0 , 1 , ( len ( G ) + 1 ) ) [ : ( - 1 ) ] * 2 ) * np . pi ) theta = theta . astype ( np . float32 ) pos = np . column_stack ( [ np . cos ( theta ) , np . sin ( theta ) ] ) pos = ( rescale_layout ( pos , scale = scale ) + center ) pos = dict ( zip ( G , pos ) ) return pos
position nodes on a circle .