find_edge

PURPOSE ^

FIND_EDGE Reports which loops in a loop list contain a certain edge.

SYNOPSIS ^

function[loop_ind]=find_edge(loop_list, source_node, target_node)

DESCRIPTION ^

 FIND_EDGE Find loops in a loop list that contain a certain direct 
 regulation (edge).

 LOOP_IND = FIND_EGDE(LOOP_LIST, SOURCE_NODE, TARGET_NODE) 
 The function returns a list of indices LOOP_IND within the provided
 list of feedback loops LOOP_LIST of the loops containing the edge from 
 SOURCE_NODE to TARGET_NODE. 

 Example 
 This call would extract the indices of all loops in which variable 2 is
 regulated by variable 1:
 loop_edge_ind=find_edge(loop_list,1,2)
 loop_list(loop_edge_ind,:) %returns the loops containing the regulation
 from variable 2 to variable 1
 
 See also: find_loops(), find_loops_noscc(), find_loops_vset()

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function[loop_ind]=find_edge(loop_list, source_node, target_node)
0002 % FIND_EDGE Find loops in a loop list that contain a certain direct
0003 % regulation (edge).
0004 %
0005 % LOOP_IND = FIND_EGDE(LOOP_LIST, SOURCE_NODE, TARGET_NODE)
0006 % The function returns a list of indices LOOP_IND within the provided
0007 % list of feedback loops LOOP_LIST of the loops containing the edge from
0008 % SOURCE_NODE to TARGET_NODE.
0009 %
0010 % Example
0011 % This call would extract the indices of all loops in which variable 2 is
0012 % regulated by variable 1:
0013 % loop_edge_ind=find_edge(loop_list,1,2)
0014 % loop_list(loop_edge_ind,:) %returns the loops containing the regulation
0015 % from variable 2 to variable 1
0016 %
0017 % See also: find_loops(), find_loops_noscc(), find_loops_vset()
0018 
0019 
0020 %search source_node and its index in all loops, determine the following
0021 %node index and check whether this is the target_node
0022 loops_follow_source_node_is_target_node=cellfun(@(z) isequal(z(find(z==source_node,1)+1),target_node),loop_list.loop);
0023 
0024 %this outputs a logical array of length loop_list whose entries are
0025 % - 1 if the loop contains source_node and the consecutive node is
0026 % target_node
0027 % - 0 if the loop does not contain source_node or if the loop contains
0028 % source_node and the consecutive node is not target_node
0029 
0030 %transfer the logical array to indices of the loops (i.e. indices where
0031 %the previous array is 1
0032 loop_ind=find(loops_follow_source_node_is_target_node);
0033     
0034 end

Generated on Wed 24-Jun-2020 09:38:33 by m2html © 2005