Problem 45219. Find edges from a vertex
First input is T, a triplet list of indices. Second input is i, a single index (positive integer). The goal of this function is to find and return all the edges [e1 e2] this vertex belong to.
For example if inputs are
T = [1 2 3 ;...
1 3 4 ;...
1 4 2 ;...
2 3 4]
and
i = 4
then the output is the 3 x 2
matrix edg_list= [1 4;...
3 4;...
2 4]
since vertex number 4 is linked with vertices number 1, 2, and 3 and then part of edges [1 4], [2 4], and [3 4]. Format of the output must be the following :
- size(edg_list) = [number of edges, 2]
- Every row of it is an edge at the format [e1, e2], sorted in ascending order, i.e. e1 < e2, and e1, e2 positive integers.
- Each edge is present once and only once, no duplicated edge admitted
- Order of rows / edges in the output doesn't matter .
If the vertex is not in the list, the function must of course return the empty set.
See also
Solution Stats
Problem Comments
-
1 Comment
Nicolas Douillet
on 3 Dec 2019
Info : T is actually a triangulation -list of triangles-, in which each index corresponding to the row index of a vertex in another list -a vertices list-, it is a widely used technique used to store and write triangular meshes in mesh processing. Here below the example is a tetrahedron -4 facets-.
Solution Comments
Show commentsProblem Recent Solvers25
Suggested Problems
-
Find state names that end with the letter A
1189 Solvers
-
1787 Solvers
-
How to find the position of an element in a vector without using the find function
2773 Solvers
-
454 Solvers
-
Are all the three given point in the same line?
590 Solvers
More from this Author42
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!