# [SciPy-User] Scipy.spatial.Delaunay

Pauli Virtanen pav@iki...
Wed Mar 16 12:31:20 CDT 2011

```Wed, 16 Mar 2011 14:57:28 +0000, Dan Richards wrote:
[clip]
> I am sure for here it is very simple, however I have been struggling to
> understand which attributes I need access to get the vertices of
> connecting lines?
>
> *         x.vertices?
> *         x.neighbors?
> *         x.vertex_to_simplex?
> *         x.convex_hull...?
>
> If anyone can help or point me in the right direction that would be very
> much appreciated.

The edges are recorded in the `vertices` array, which contains indices of
the points making up each triangle. The overall structure is recorded
`neighbors`.

This is maybe easiest to explain in code. The set of edges is:

edges = []
for i in xrange(x.nsimplex):
edges.append((x.vertices[i,0], x.vertices[i,1]))
edges.append((x.vertices[i,1], x.vertices[i,2]))
edges.append((x.vertices[i,2], x.vertices[i,0]))

This however counts each edge multiple times. To get around, that:

edges = []
for i in xrange(x.nsimplex):
if i > x.neighbors[i,2]:
edges.append((x.vertices[i,0], x.vertices[i,1]))
if i > x.neighbors[i,0]:
edges.append((x.vertices[i,1], x.vertices[i,2]))
if i > x.neighbors[i,1]:
edges.append((x.vertices[i,2], x.vertices[i,0]))

This counts each edge only once. Note how the `neighbors` array relates
to `vertices`: its j-th entry gives the neighboring triangle on the
other side of the edge formed that remains after the j-th vertex is
removed from the triangle.

--
Pauli Virtanen

```