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

3 次查看(过去 30 天)
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)

回答(1 个)

Chunru
Chunru 2021-8-27
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

类别

Help CenterFile Exchange 中查找有关 Programming 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by