Cody

Problem 45219. Find edges from a vertex

Solution 2044422

Submitted on 3 Dec 2019 by Tim
  • Size: 32
  • This is the leading solution.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
T = [1 2 3;... 1 3 4;... 1 4 2;... 2 3 4]; i = 4; edg_list = [1 4;... 2 4;... 3 4]; assert(isequal(sortrows(find_edges_from_vertex(T,i)),edg_list))

2   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;... 4 1 8;... 1 8 5]; i = 7; edg_list = [3 7;... 4 7;... 6 7;... 7 8]; assert(isequal(sortrows(find_edges_from_vertex(T,i)),edg_list));

3   Pass
T = [2 3 5;... 3 5 7;... 5 7 11;... 7 11 13]; i = 8; assert(isempty(find_edges_from_vertex(T,i)))

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!