Hi guys,
I have written some matlab code for image analysis that searches for clusters in an image and that builds an adjacency matrix for those clusters, discribing which clusters are touiching eachother in the image.
I can use this adjacency matrix to derive a graph.
For completion of my algorithm I would now have to mine that graph for all nodes of a maximum degree of 2 where the node index is either higher than that of its neigbor (when the degree is 1) or between the indexes of its two neighbors.
Basically as in the image here:
I need to do so in matlab and it is important to know that my try is available as an adjacency matrix looking like:
1 2 3 4
1 0 0 1 1
2 0 0 0 1
3 1 0 0 1
4 1 1 1 0
Probably its quite simple but I just don't see the solution...