A Matrix Approach for Analyzing Signal Flow Graph

: Mason’s gain formula can grow factorially because of growth in the enumeration of paths in a directed graph . Each of the ( n − 2)! permutation of the intermediate vertices includes a path between input and output nodes. This paper presents a novel method for analyzing the loop gain of a signal flow graph based on the transform matrix approach. This approach only requires matrix determinant operations to determine the transfer function with complexity O( n 3 ) in the worst case, therefore rendering it more efficient than Mason’s gain formula. We derive the transfer function of the signal flow graph to the ratio of different cofactor matrices of the augmented matrix. By using the cofactor expansion, we then obtain a correspondence between the topological operation of deleting a vertex from a signal flow graph and the algebraic operation of eliminating a variable from the set of equations. A set of loops sharing the same backward edges, referred to as a loop group, is used to simplify the loop enumeration . Two examples of feedback networks demonstrate the intuitive approach to obtain the transfer function for both numerical and computer-aided symbolic analysis, which yields the same results as Mason’s gain formula. The transfer matrix offers an excellent physical insight, because it enables visualization of the signal flow.


Introduction
A signal flow graph set up directly after inspecting a physical system without first formulating the associated equations is one of the most common tools for representing a complicated linear control system. It offers a visual structure upon which causal relationships among several variables can be compared. In the past several decades, flow graph analysis has been widely used in electrical engineering [1][2][3][4][5][6], computer science, biological science [7], and for solving economic problems. Furthermore, the applications of graph theory in conjunction with symbolic network analysis [8,9] and the computer-aided simulation of electronic circuits [10] have been widely encountered in recent years.
Mason's gain formula [11,12], or Mason's rule, is a systematic method for obtaining the transfer function of a signal flow graph between input and output nodes, especially for complex and highdimensional systems. Mason evaluated the determinant of a signal flow graph and proved the rule by considering the determinant value. The advantage of Mason's rule is that it can be drawn directly from the physical system without setting up the equations in matrix form or requiring any reduction procedure for the flow graph [13][14][15]. Coates described an alternative representation of the flow graph [16,17] that is derived from algebraic equations written in terms of the incidence and weight matrices of the graph. Coates' gain formula can be used to find the transfer function algebraically by labeling each signal, writing the equation for how that signal depends on other signals, and then solving multiple equations for the output signal in terms of the input signal.
Mason's and Coates' gain formulas are classics in flow graph theory [18]. These two formulations are closely related in terms of both the manipulations and topological formulas. Mason's rule not only retains the intuitive character of the block diagram, but also enables determination of the gain between input node and output nodes of a signal flow graph through inspection. Mason's graph is a more natural representation of a physical system than Coates graph. Coates' gain formula, by contrast, computes the output directly regardless of the number of inputs present in the system. Mason's graph reduction rules cannot be applied directly in Coates' gain formula because the direct computation of a given output used in this method is not focused on the same cause and effect formulation of equations as in the case of Mason's rule [18]. Mason's rule involves dividing a signal flow graph into several independent loop gains and analyzing the inputoutput transfer function. The existence of non-touching loops increases the complexity of the formula. Neither determining the exact number of independent loop gains nor recognizing the touching loops in a complex system is easy. In general, Mason's gain formula is complicated to implement without making mistakes.
This paper proposes a systematic method called the transfer matrix method [19] to determine the transfer function of a system, and it presents a physical insight into the transfer matrix. As an alternative to Coates' gain formula for solving the system, a solution can be obtained by considering the eigenvector of the transfer matrix for a signal flow graph. A recursive reduction of a signal flow graph is performed using cofactor expansion, which successively eliminates nodes to obtain a subgraph layer analysis and merges the results obtained on the submatrices. Each cofactor expansion reduces the order of the associated matrix by one. The system is then separated into several loop groups including backward and forward paths. From the viewpoint of loop groups, the new method provides an excellent physical insight through visualization of the signal flow.
The organization of the report is as follows. First, in Section 2, the theoretical foundations of the transfer matrix and its representation in the signal flow graphs are described. In Section 3, it is explained that the transfer function overcomes the difficulty of implementing the traditional Mason's gain formula. The augment matrix is performed recursively through cofactor expansion to systematically obtain all possible non-touching loop combinations and represent them compactly. The pseudocode has been constructed to determine the transfer function and calculate the loop group gain. In Section 4, a graph decomposition method is introduced to calculate the forward path gain between two nodes with feedback layers. The method in graph decomposition can give an excellent visualization to the signal flow. Compared with the traditional Mason's gain formula, two examples have been presented to illustrate the methods of calculating the loop group gains. The fact that determinant of the cofactor matrix is the same as the loop group gain is discussed in Section 5. When a virtual backward edge from the output node to the input node is added in Section 6, the numerator of the transfer function can be regarded as the forward path gain. The next section discusses the complexity analysis of the algorithm. Finally, Section 8 concludes the report.

Transfer Matrix Method
As shown in Figure 1, a node-ordered signal flow graph that contains the set of nodes X and the directed edge set E can be related by the associated equation [19]  and , denotes the directed edge (or gain) from source node to sink node .
The nodes are arranged in a descending order. The edges may be classified as forward, backward, and self-loop edges. When the elements are located below the main diagonal, the associated edges pointing from a source node to sink node satisfy the node ordering, namely that node is numbered prior to node . These edges are called forward edges. Against the edge direction, the elements located above the main diagonal are called backward edges. The elements on the diagonal are self-loop edges that consist of only one node. Because the self-loop edge is also one type of backward edge, the elements that are located above the diagonal are called strictly backward edges.
The determinant of the augmented matrix is expressed as the sum of the cofactor of the first row of the matrix multiplied by the corresponding entry in the first row. In other words, The cofactor equals (−1) det( , ( )) , where (−1) , ( ) is the cofactor matrix, a signed version of a minor , ( ) defined by deleting the first row and the j+1th column from the augmented matrix . The ratio between the cofactor attributable to the cofactor satisfies the equilibrium relation between the output node and the input node . For a single input multiple output (SIMO) system, the transfer function G is then expressed as follows.

Mason's Gain Formula
Mason's gain formula [11,12] is a method for finding the transfer function that associates the input and output of a linear signal-flow graph with many variables and loops. The Mason's gain formula is where is the input-node variable is the output-node variable is the transfer function between and ∆ is the determinant of the graph is path gain of the kth forward path between and ∆ the cofactor value of Δ for the kth forward path, with the loops touching the kth forward path removed is loop gain of each closed loop in the system is product of the loop gains of any two non-touching loops is product of the loop gains of any three pairwise non-touching loops Consider a signal flow graph with nested loops. The implement procedures of the Mason's gain formula first list all forward paths with corresponding gains and all loops. Once all loops have been generated, they should be combined in all possible ways so that all loops in a combination are nontouching. Make a list of all pairs of non-touching loops taken two, three, four, etc. at a time until no more contact, and multiply their gains ( , , … ). Calculate the determinant ∆ and the cofactor ∆ , and then apply the formula. Lu et al. [20] proposed an algorithm combined with Johnson method for generating the combinations of the non-touching loops. If there are too many variables in the signal flow graph, this method will make the expression of the transfer function very complicated and difficult to analyze. Prasad [15] used tree structure and/or factoring technique to generate and represent non-touching combinations of paths and loops. The tree structure is suitable for the small graph size and most loops are touching. When most loops are non-touching, the factoring method is better to remove combinations of touching loops from all combinations of loops. Beillahi et al. [21] proposed a higher-order logic formation of signal flow graph in HOL Light theorem prover. The touching loop is detected by pre-checking each loop with a higher rank loop than the loop considered in the given loops list. However, these methods are not to generate and represent non-touching combinations of paths and loops systematically and efficiently.
We reduce the signal flow graph recursively through cofactor expansion to systematically obtain all possible non-touching loop combinations and represent them compactly. We also use a set of loops that share the same backward edges, referred to as a loop group, to simplify the loop enumeration. The determinant of the cofactor matrix is equivalent to the loop group gain associated with the backward edges. It provides an excellent physical insight of the signal flow. Although the numerator and denominator of the Mason's gain formula have different forms, our method shows that the numerator maybe regarded as the loop group gain when the unit virtual backward edge from output node to input node is added. The transfer function G of the internal node with respect to input node for the SIMO system may be directionally calculated by using matrix determinant according to Equation (4). This method helps to improve clarity and understand the interrelations between entire system and subsystems. Our method is simple and useful enough to teach students the subject of Mason's formula as a part of courses in control systems, digital signal processing, graph theory, and applications.
The pseudocode showing Algorithm 1 is implemented using the transfer matrix method. The pseudocode calculates the transfer function as well as the loop group gain. It takes as an input, the system matrix determined in Equation (1) and produces the output as per the requirements. The augmented matrix is calculated using the operation ( − ) The transfer function method consists of a numerator and a denominator term. The numerator term is (−1) det( , ( ) where j represents the output node index and , ( ) is determined by deleting the first row and j+1 column from . The denominator term on the other hand is determined by det( , ( )), where , ( ) is obtained by deleting the first row and the first column of the matrix.
The loop group gain between to is calculated by multiplying the forward path gain from to by the backward edge gain , . The forward path gain is determined by det ( ) ) as discussed in Section 4, where the arguments from to in descending order denote that the deleted columns are associated with the nodes from to , ) given in Section 4 loop group grain= ← , • return

Graph Decomposition
The recursive reduction of a signal flow graph proceeds by cofactor expansion. Each cofactor expansion reduces the order of the associated matrix by one. Layered (or hierarchical) graph drawing is a type of graph drawing in which the vertices of a directed graph are drawn in horizontal rows or layers with the edges generally directed downward. The number of feedback layers correlates to the number of strictly backward edges that form feedback loops during the reduction process. An alternative matrix form, as defined below, reveals the multiple feedback layers of the signal flow graph.
shift right j columns delete nodes Figure 2. A signal flow graph for example 1. Figure 3 shows the intuitive approach to find each minor in the matrix of minors. The matrix of minors represents the signal flow diagram beside each cofactor calculations done in Figure 3. The loop group consists of the strictly backward edge and the forward path. This graph includes two strictly backward edges: , and , . As shown in Figure 2b, the forward path gain that traverses paths from the input node to the node in the direction of the graph flow is The determinant of the graph may be expressed in Mason's gain formula by alternating the sign of the two touching loop groups.
The traditional Mason's gain formula includes seven simple loops with loop gains: Two of these seven loops touch each other. Thus, the determinant of the graph yields The loop group approach around the associated backward edges and traditional simple loop approach yield the same result.  Figure 4a. The matrix , ( ) obtained by eliminating the first row and first column of the augmented matrix is  Figure 4b shows five strictly backward edges: , , , , , , , , and , in the signal flow graph. The forward path gains for the first four backward edges are , , , , , , and , , respectively. Supposing that ( ) (9)| (8,9) (1,2) be a matrix of one feedback layer, which results from the elimination of the first row and the last column of the matrix , ( ), the mathematical expression of ( ) (9)| (8,9) (1,2)

Example 2. Consider the signal flow diagram shown in
is shown as ( ) (9)| (9,9) (1,2) The determinant of ( ) (9)| (9,9) (1,2) is the gain for the possible forward paths from node No combination exists of more than two non-touching loop groups. According to Mason's gain formula, the determinant of the graph may be rewritten as which is identical to Equation (13). Figure 5 shows the approach to calculate the minors at each decomposition.

Forward Path Gain
The explanations of Figure 5  resulting from the elimination of the incoming branches of the sink node and outgoing branches of the source node with one feedback layer is.
As shown in Figure 4b, consider Mason's gain formula of the possible forward paths with the associated backward edge , for Example 2, which involves two forward paths with path gains.

Transfer Function
In Mason's gain formula, the transfer function is expressed as a ratio of the numerator terms to the denominator terms. The numerator and denominator terms are located in the forward paths and feedback loops, respectively. According to Equation (4), the numerator term of the transfer function for Example 2 can be obtained by determining the cofactor matrix of the augmented matrix , at entry (1,10). Figure 6 shows the original signal flow diagram by adding a virtual backward edge , from output node to input node . The determinant of the matrix − , ( ) having one feedback layer for the coordinate of the characteristic element shifting to the right by one column at the first row is equivalent to directly obtaining the forward gain with the virtual backward edge , . The forward gain is = det( − , ( )) det , ( ) Figure 6. The forward path gain of the virtual loop group around the entire system for example 2.

Complexity Analysis
Mason's rule can increase factorially because the enumeration of paths in a directed graph grows dramatically. Consider a complete directed graph on n vertices, with an edge between every pair of vertices. The paths from to are (n − 2)! permutations of the intermediate vertices. Mason's graph formula describes the transfer function of an interconnected system, which is divided into several independent loops and forward paths, and simultaneously performs algebraic and combinatorial operation. According to Equation (4), the transfer function may be calculated by using the determinant of an n × n matrix. Given an n × n determinant to be calculated, we can either use the cofactor method recursively with a runtime of O(n!), or use Gaussian elimination method to simplify the matrix, track the influence on the determinant, and then multiply it by the diagonal entries at the end. This will be O(n 3 ), the order of Gaussian elimination.

Conclusions
The loop group approach presented in this paper yields the same results as Mason's gain formula. In addition, we reduced the signal flow graph recursively through cofactor expansion to systematically obtain all possible non-touching loop combinations. A set of loops were used to share the same backward edges, referred to as a loop group, can simplify the loop enumeration. Each cofactor expansion reduces the order of the augmented matrix by one. The determinant of the cofactor matrix is equivalent to the loop group gain associated with the backward edge. It can also provide a physical insight of the signal flow.
An augmented matrix is used to represent the signal flow graph. The determinant of the cofactor matrix of the augmented matrix at the first entry containing no feedback layer is the denominator term of the transfer function. The numerator term that directs the forward path gain from the input node to the output node can be obtained by determining the cofactor matrix of the augmented matrix at the top-right entry. The matrix contains one feedback layer, and the determinant is the associated forward path gain of the outer virtual loop group. Two examples of feedback networks are used to demonstrate the intuitive approach to obtain the transfer function for both numerical and computeraided symbolic analysis. The transfer matrix offers an excellent physical insight because it enables visualization of the signal flow.

Conflicts of Interest:
The authors declare no conflict of interest