MATLAB: Finding lists of connected triangles in TriRep class

adjacency matrixbiographconncompconnected componentsdelaunaygraph theorygraphconncompshortest pathtransitive closuretrirepwarshall's algorithm

Hi
I have a triangle mesh of type TriRep. I have selected few faces (or triangles) out based on some criteria. These few triangles are in connected groups. I want to find out how many groups of these triangles are there.
neighbors(tris,selectedFaces) Only give me connectivity of one triangle. e.g.
3 NaN 2
NaN NaN 1
1 11 4
NaN 12 3
% where tris is the TriRep triangular representation
and selectedFaces is the list of few selected faces in TriRep
The output above means that 1st face (1st row of the output) in selectedFaces has 3rd and 2nd face as neighbors and is not connected at one edge.
We can also see that face 3 (third row of the output) is connected to face 11 and 4 and face 4 (4th row of the output) is connected to 12 in addition to 3.
So this means that faces 1,2,3,4,11,12 form a group or a chain of triangles. I want to know if there is any way to find out this connectivity without using any adjacency matrix or Warshall's algorithms.
Any help is appreciated.
Best Regards
Wajahat

Best Answer

Why don't you want to define an adjacency matrix? If you do, then you could just use the components routine in MATLAB-BGL