Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8516451
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T05:25:55+00:00 2026-06-11T05:25:55+00:00

I have been searching for an answer to this question but cannot find anything

  • 0

I have been searching for an answer to this question but cannot find anything useful.

I am working with the python scientific computing stack (scipy,numpy,matplotlib) and I have a set of 2 dimensional points, for which I compute the Delaunay traingulation (wiki) using scipy.spatial.Delaunay.

I need to write a function that, given any point a, will return all other points which are vertices of any simplex (i.e. triangle) that a is also a vertex of (the neighbors of a in the triangulation). However, the documentation for scipy.spatial.Delaunay (here) is pretty bad, and I can’t for the life of me understand how the simplices are being specified or I would go about doing this. Even just an explanation of how the neighbors, vertices and vertex_to_simplex arrays in the Delaunay output are organized would be enough to get me going.

Much thanks for any help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T05:25:56+00:00Added an answer on June 11, 2026 at 5:25 am

    I figured it out on my own, so here’s an explanation for anyone future person who is confused by this.

    As an example, let’s use the simple lattice of points that I was working with in my code, which I generate as follows

    import numpy as np
    import itertools as it
    from matplotlib import pyplot as plt
    import scipy as sp
    
    inputs = list(it.product([0,1,2],[0,1,2]))
    i = 0
    lattice = range(0,len(inputs))
    for pair in inputs:
        lattice[i] = mksite(pair[0], pair[1])
        i = i +1
    

    Details here not really important, suffice to say it generates a regular triangular lattice in which the distance between a point and any of its six nearest neighbors is 1.

    To plot it

    plt.plot(*np.transpose(lattice), marker = 'o', ls = '')
    axes().set_aspect('equal')
    

    enter image description here

    Now compute the triangulation:

    dela = sp.spatial.Delaunay
    triang = dela(lattice)
    

    Let’s look at what this gives us.

    triang.points
    

    output:

    array([[ 0.        ,  0.        ],
           [ 0.5       ,  0.8660254 ],
           [ 1.        ,  1.73205081],
           [ 1.        ,  0.        ],
           [ 1.5       ,  0.8660254 ],
           [ 2.        ,  1.73205081],
           [ 2.        ,  0.        ],
           [ 2.5       ,  0.8660254 ],
           [ 3.        ,  1.73205081]])
    

    simple, just an array of all nine points in the lattice illustrated above. How let’s look at:

    triang.vertices
    

    output:

    array([[4, 3, 6],
           [5, 4, 2],
           [1, 3, 0],
           [1, 4, 2],
           [1, 4, 3],
           [7, 4, 6],
           [7, 5, 8],
           [7, 5, 4]], dtype=int32)
    

    In this array, each row represents one simplex (triangle) in the triangulation. The three entries in each row are the indices of the vertices of that simplex in the points array we just saw. So for example the first simplex in this array, [4, 3, 6] is composed of the points:

    [ 1.5       ,  0.8660254 ]
    [ 1.        ,  0.        ]
    [ 2.        ,  0.        ]
    

    Its easy to see this by drawing the lattice on a piece of paper, labeling each point according to its index, and then tracing through each row in triang.vertices.

    This is all the information we need to write the function I specified in my question.
    It looks like:

    def find_neighbors(pindex, triang):
        neighbors = list()
        for simplex in triang.vertices:
            if pindex in simplex:
                neighbors.extend([simplex[i] for i in range(len(simplex)) if simplex[i] != pindex])
                '''
                this is a one liner for if a simplex contains the point we`re interested in,
                extend the neighbors list by appending all the *other* point indices in the simplex
                '''
        #now we just have to strip out all the dulicate indices and return the neighbors list:
        return list(set(neighbors))
    

    And that’s it! I’m sure the function above could do with some optimization, its just what I came up with in a few minutes. If anyone has any suggestions, feel free to post them. Hopefully this helps somebody in the future who is as confused about this as I was.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been searching desperately for an answer to this question, but not found
I have been searching and searching for an answer to this question but with
This question might seem strange but I have been searching for an answer for
I have been searching the internet wildly for an answer to this question. We
I have been searching everywhere but I could not find an answer. I need
I have been searching around using Google but I can't find an answer to
I have been searching the answer to this question for a while. It seemed
I've been searching for an answer to this but I can't seem to find
After searching online this is a question I have been unable to find an
I have been searching for an answer to this question for some time now,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.