def _straight_line_vertices(adjacency_mat, node_coords, directed=False):
 if (not issparse(adjacency_mat)):
  adjacency_mat = np.asarray(adjacency_mat, float)
 if ((adjacency_mat.ndim != 2) or (adjacency_mat.shape[0] != adjacency_mat.shape[1])):
  raise ValueError('Adjacency matrix should be square.')
 arrow_vertices = np.array([])
 edges = _get_edges(adjacency_mat)
 line_vertices = node_coords[edges.ravel()]
 if directed:
  arrows = np.array(list(_get_directed_edges(adjacency_mat)))
  arrow_vertices = node_coords[arrows.ravel()]
  arrow_vertices = arrow_vertices.reshape(((len(arrow_vertices) / 2), 4))
 return (line_vertices, arrow_vertices)

def _straight_line_vertices ( adjacency_mat , node_coords , directed = False ) : if ( not issparse ( adjacency_mat ) ) : adjacency_mat = np . asarray ( adjacency_mat , float ) if ( ( adjacency_mat . ndim != 2 ) or ( adjacency_mat . shape [ 0 ] != adjacency_mat . shape [ 1 ] ) ) : raise ValueError ( 'Adjacency matrix should be square.' ) arrow_vertices = np . array ( [ ] ) edges = _get_edges ( adjacency_mat ) line_vertices = node_coords [ edges . ravel ( ) ] if directed : arrows = np . array ( list ( _get_directed_edges ( adjacency_mat ) ) ) arrow_vertices = node_coords [ arrows . ravel ( ) ] arrow_vertices = arrow_vertices . reshape ( ( ( len ( arrow_vertices ) / 2 ) , 4 ) ) return ( line_vertices , arrow_vertices )
generate the vertices for straight lines between nodes .