How do I find the cycles in a particular graph using the Bioinformatics Toolbox?

2 views (last 30 days)
I am trying to determine the cycles in a graph using the bioinformatics Toolbox.
I would like to know if there is a function available in MATLAB to do this.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
The ability to determine the cycles in a graph is not available in MATLAB.
The solution to this problem depends on the connectivity degree of the graph and the type of graph (directed or undirected), and it may have a combinatorial number of solutions, one way to do this is with DFS(Depth First Search).
Find attached a simple function FINDCYCLES that determines the cycles for simple graphs.
1. Download the attached file findcycles.m to your current directory.
2. Enter the following at the MATLAB command prompt to execute the function
G = sparse([1 2 3 4 5 5 5 6 7 8 8 9],[2 4 1 5 3 6 7 9 8 1 10 2],true,10,10);
view(biograph(G))
findcycles(G)
For complex graphs there are other solutions, such as first computing the strong connected components, or variations of spanning trees, for which custom code needs to be written.

More Answers (0)

Products


Release

R2006b

Community Treasure Hunt

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

Start Hunting!