How can I find positive feedback loops from a directed graph?

5 views (last 30 days)
I have directed graphs. The weights of the edges can either +1 or -1. Now I want to find cycles which are equivalent to positive feedback loop.
There are two kinds of regulation activation and inhibition
----| denotes inhibition
→ denotes activation
If there are two nodes both having ----| links then the cycle will be positive feebback loop. Similarly for three nodes and upto maximum number of nodes. The cycle will be positive feedback if there are all → links or even number of ----| links.
If kindly some one suggest me how to find positive feedback loop from a network it will be very helpful? The result should not be isomorphic.
Thanks in advance
Here I am posting my code of the graph.
s = [1 4 2 5 2 3 4 4 6 5 5 6 7 8];
t = [2 1 3 2 4 6 5 7 5 7 8 9 8 9];
w = [1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 1];
G= digraph(s,t,w);
plot(G,'Layout','force','EdgeLabel',G.Edges.Weight)

Answers (1)

Chunru
Chunru on 27 Aug 2021
s = [1 4 2 5 2 3 4 4 6 5 5 6 7 8];
t = [2 1 3 2 4 6 5 7 5 7 8 9 8 9];
w = [1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 1];
G= digraph(s,t,w);
plot(G,'Layout','force','EdgeLabel',G.Edges.Weight)
% find all cycles
[cycles, edgecycles] = allcycles(G)
cycles = 3×1 cell array
{[ 1 2 4]} {[2 3 6 5]} {[ 2 4 5]}
edgecycles = 3×1 cell array
{[ 1 3 5]} {[2 4 11 8]} {[ 3 6 8]}
positive_feedback = zeros(length(cycles), 1);
for i=1:length(cycles)
positive_feadback(i, 1) = prod(G.Edges.Weight(edgecycles{i}));
end
positive_feadback
positive_feadback = 3×1
-1 1 -1

Categories

Find more on Programming 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!