Cody

Problem 45220. Find triangles from edge

Solution 2044389

Submitted on 3 Dec 2019 by Nicolas Douillet
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

This solution is outdated. To rescore this solution, sign in.

Test Suite

Test Status Code Input and Output
1   Pass
T = [1, 2, 3; 1, 3, 4; 1, 2, 4; 2, 3, 4]; e = [2, 4]; S = [1, 2, 4; 2, 3, 4]; assert(isequal(sortrows(find_triangles_from_edges(T,e)),S))

2   Pass
T = [1, 2, 3; 1, 3, 4; 1, 4, 5; 1, 2, 5; 2, 3, 6; 3, 4, 6; 4, 5, 6; 2, 5, 6; 2, 3, 4; 2, 4, 5]; e = [2, 3]; S = [1, 2, 3; 2, 3, 4; 2, 3, 6]; assert(isequal(sortrows(find_triangles_from_edges(T,e)),S))

3   Pass
T = [1, 2, 4; 2, 3, 4; 5, 6, 8; 6, 7, 8; 1, 2, 5; 2, 5, 6; 2, 3, 6; 3, 6, 7; 3, 4, 7; 4, 7, 8; 1, 4, 8; 1, 5, 8]; e = [3, 7]; S = [3, 4, 7; 3, 6, 7]; assert(isequal(sortrows(find_triangles_from_edges(T,e)),S))

4   Pass
T = [2, 3, 5; 3, 5, 7; 5, 7, 11; 7, 11, 13]; e = [6, 8]; assert(isempty(find_triangles_from_edges(T,e)))

Suggested Problems

More from this Author9

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!