Find border edges of the graph
Show older comments
I have a graph like this, how I can find border edges.
M = [1 8; 7 8; 1 7; 7 6; 1 6; 1 5; 4 5; 1 3; 2 3; 1 2; 1 4];
Layout = [3 2; 5 2; 5 4; 6 1; 6 6; 4 6; 2 4; 1 1];
g = graph(M(:, 1), M(:, 2));
h = plot(g);
h.XData=Layout(:,1);
h.YData=Layout(:,2);
The border edges in this graph is (1,8), (8,7), (7,6), (6,1), (1,5), (5,4), (4,1)
result should be:
border_edges = [1,8; 8,7; 7,6; 6,1; 1,5; 5,4; 4,1]
The other question is that, how I can find nodes with 2 edges?
node_with_two_edges =[8; 6; 5; 4; 2; 3]
Accepted Answer
More Answers (0)
Categories
Find more on Graph and Network Algorithms in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
