8
Profile minimisation algorithm for sparse matrix TAKEO TANIGUCHI Department of Civil Engineering, School of Engineering, Okayama University, Okayama, Japan NARUHITO SHIRAISHI Department of Civil Engineering, Faculty of Engineering, Kyoto University, Kyoto, Japan KYOHEI ITOH Department of Civil Engineering, School of Engineering, Okayama University, Okayama, Japan In this paper a new renumbering method for mini- mising the profile of sparse matrices is proposed and its efficiency is surveyed through a number of numerical experiments. The characteristics of the new method are (1) it is effective only for the purpose of the profile minimisation; (2) it does not order nodes in accordance with the level structure constructed from the starting node; and (3) it is applicable for any kind of two-dimensional system. Key Words: minimisation, profile, sparse matrices, starting node, two-dimensional systems INTRODUCTION The application of numerical methods like the finite element method or the finite difference method induces a set of linear equations with large and sparse coefficient matrix, and anaong the solvers for the equations Band Matrix Method and Profile Method are most commonly used. However, the actual efficiency of the above solvers is wholly governed by the renumbering method which re- arranges the input-data so as to be able to show the property of the selected solver sufficiently, and, therefore, a number of renumbering methods are already proposed.l-7 On the other hand, the results of the theoretical investiga- tion clarified the complexity of the design of the effective renumbering algorithm, s'9 and the reasons of the complexity are physically explained by use of the graph concepts.7'a0'11 According to the results, the design of effective algorithm for minimising the profile is rather easier than that of the bandwidth minimisation and main factors which give influence to the value of the profile are also listed in the previously mentioned papers. Cuthill-McKee algorithm (RCM) and Gibbs-Poole- Stockmeyer algorithm (GPS) among a number of renum- bering methods are most commonly in use, 5'6 and both of them are applied not only for the profile minimisation but also for the bandwidth minimisation. The differences can be calculated between these two minimisation problems, and, therefore, the renumbering method for the profile minimisation should be newly proposed. Accepted August 1983. Written discussion closes September 1984. The main purpose of this investigation is the proposal of a newly renumbered algorithm which is effective only for the profile minimisation, and for this purpose the results in ref. 10 are effectively introduced. Also the efficiency of the new algorithm is surveyed through a number of numerical examples. BASIC TERMINOLOGY AND SOME DEFINITIONS First, we present some terminology of the graph theory. 12 An undirected graph G = (X,E) consists of a finite set X of nodes together with a set E of lines, which are un- ordered pairs of distinct nodes of X. A subgraph G'= (X',E') of G is one for which X' C X andE' _CE. A graph is complete when every pair of nodes in G are adjacent. A clique of G is G' C_G which is complete. The degree of a node, namely v i, is equal to the number of lines gathered to the node and it is denoted by deg. v i. The distance between two nodes, namely v i and vj, is the number of lines on the shortest path connecting them, and it is denoted by d(v i, v/). If d(vi, v/) < oo for every pair of nodes in G, G is a connected one. A cycle is a path which begins and ends at the same node. A mesh graph is the one with cycles, and a tree graph is a connected graph with no cycles. Nodes with deg. v~>3 and deg. v= 1 in tree graphs are called bifurcation node and end node, respectively, and a simple path locating between the above two kinds of nodes is called a branch. A level structure of G is a partition: L = {Lo,LI,L2 ..... L l} of the node set X such that: adj. Li~Li_l ULi+l,0<i<l adj. Lo C L1, adj. LtC-Ll_l where 'adj.' is the abbreviation of 'adjacent'. Let Ax = b (1) be an N*N sparse, symmetric nonsingular system of linear equations. The profile p of the coefficient matrix A is defined by the following equation: N p = ~. max (i--j) (2) i=1 ai]V-O i>~/ 0141-1195/84/030156-08 $2.00 156 Adv. Eng. Software, 1984, VoL 6, No. 3 © 1984 CML Publications

Profile minimisation algorithm for sparse matrix

Embed Size (px)

Citation preview

Page 1: Profile minimisation algorithm for sparse matrix

Profile minimisation algorithm for sparse matrix

TAKEO TANIGUCHI

Department o f Civil Engineering, School o f Engineering, Okayama University, Okayama, Japan

NARUHITO SHIRAISHI

Department o f Civil Engineering, Faculty o f Engineering, Kyoto University, Kyoto, Japan

KYOHEI ITOH

Department o f Civil Engineering, School o f Engineering, Okayama University, Okayama, Japan

In this p a p e r a new r e n u m b e r i n g method for mini- mising the prof i le o f sparse matrices is proposed and its e f f i c iency is surveyed t h rough a n u m b e r o f numer i ca l expe r imen t s . The characteristics of the new method are (1) it is effective only for the p u r p o s e o f the prof i le min imisa t ion ; (2) it does not order nodes in a cco rdance with the level structure constructed from the starting node; and (3) it is appl icab le fo r any k ind o f two-d imens iona l system.

Key Words: minimisation, profile, sparse matrices, starting node, two-dimensional systems

INTRODUCTION

The application of numerical methods like the finite element method or the finite difference method induces a set of linear equations with large and sparse coefficient matrix, and anaong the solvers for the equations Band Matrix Method and Profile Method are most commonly used. However, the actual efficiency of the above solvers is wholly governed by the renumbering method which re- arranges the input-data so as to be able to show the property of the selected solver sufficiently, and, therefore, a number of renumbering methods are already proposed.l-7 On the other hand, the results of the theoretical investiga- tion clarified the complexity of the design of the effective renumbering algorithm, s'9 and the reasons of the complexity are physically explained by use of the graph concepts.7'a0'11 According to the results, the design of effective algorithm for minimising the profile is rather easier than that of the bandwidth minimisation and main factors which give influence to the value of the profile are also listed in the previously mentioned papers.

Cuthill-McKee algorithm (RCM) and Gibbs-Poole- Stockmeyer algorithm (GPS) among a number of renum- bering methods are most commonly in use, 5'6 and both of them are applied not only for the profile minimisation but also for the bandwidth minimisation. The differences can be calculated between these two minimisation problems, and, therefore, the renumbering method for the profile minimisation should be newly proposed.

Accepted August 1983. Written discussion closes September 1984.

The main purpose of this investigation is the proposal of a newly renumbered algorithm which is effective only for the profile minimisation, and for this purpose the results in ref. 10 are effectively introduced. Also the efficiency of the new algorithm is surveyed through a number of numerical examples.

BASIC TERMINOLOGY AND SOME DEFINITIONS

First, we present some terminology of the graph theory. 12 An undirected graph G = (X,E) consists of a finite set

X of nodes together with a set E of lines, which are un- ordered pairs of distinct nodes of X. A subgraph G ' = (X ' ,E ' ) of G is one for which X' C X andE ' _C E. A graph is complete when every pair of nodes in G are adjacent. A clique of G is G' C_ G which is complete. The degree of a node, namely v i, is equal to the number of lines gathered to the node and it is denoted by deg. v i. The distance between two nodes, namely v i and vj, is the number of lines on the shortest path connecting them, and it is denoted by d(v i, v/). If d(vi, v/) < oo for every pair of nodes in G, G is a connected one. A cycle is a path which begins and ends at the same node. A mesh graph is the one with cycles, and a tree graph is a connected graph with no cycles. Nodes with deg. v~>3 and deg. v = 1 in tree graphs are called bifurcation node and end node, respectively, and a simple path locating between the above two kinds of nodes is called a branch. A level structure of G is a partition:

L = {Lo,LI ,L2 . . . . . L l}

of the node set X such that:

adj. L i ~ L i _ l U L i + l , 0 < i < l

adj. Lo C L1, adj. LtC-Ll_l

where 'adj.' is the abbreviation of 'adjacent'. Let

Ax = b (1)

be an N * N sparse, symmetric nonsingular system of linear equations. The profile p of the coefficient matrix A is defined by the following equation:

N p = ~. max ( i-- j) (2)

i=1 ai]V-O i>~/

0141-1195/84/030156-08 $2.00 156 Adv. Eng. Software, 1984, VoL 6, No. 3 © 1984 CML Publications

Page 2: Profile minimisation algorithm for sparse matrix

For the matrix A in equation (1), prepare, at first, N nodes labelled from '1 ' to 'N ' , respectively, and connect two nodes, namely v i and v i, by a line for every nonzero i , j element (ai/:/= 0) in the upper triangular matrix of A. By this procedure we obtain a graph G = (N ,M) from A(N*N) .

By the introduction of this graph the definition of the prof'de is replaced by:

N p = ~ max ( i - f ) (3)

i=1 v ie adi.vj

The aim of this investigation is to renumber all nodes in G so as to minimise p of equation (3).

Now the vertex elimination for a graph is introduced instead o f the elimination for a matrix. 13

The ith row of A modifies the value ofaik as follows:

ajiaik a-/k = ajk - - - - , (4)

aii

where ' - ' indicates the value of ajk after the elimination. Equation (4) indicates that any zero element ajk becomes nonzero, if both of aji and aik are not zero. This new non- zero element is called 'fill-in'.

This elimination is explained by use of a graph. Since every row is expressed by a node, the ith row elimination of A is equivalent to the elimination of v i in G which replaces the subgraph G ' = {adj. v i } C G to a clique, because a/k(¢ 0) is equivalent to the existence of a line between v/ and Vk, and equation (4) indicates that every pair of nodes in G ' are connected. Therefore, a fill-in is equal to a line newly introduced by a vertex elimination.

Let G be a graph whose i nodes are already eliminated. Then, G is subdivided into the eliminated area G~ and non- eliminated area G~.

G = G~ h) G~¢

Among nodes in Gjv those nodes which are adjacent to G~ construct generally several cliques, and known here as FRONTs. On the contrary, those nodes which are adjacent to G~ also consist of several connected subgraphs, known here as LINEs.

Let u and v be nodes in FRONT and LINE, respectively. Then, the number of nodes in LINE which are adjacent to v is called out-degree of v. On the contrary, the number of nodes in FRONT which are adjacent to u is called in-degree o fu .

If the successive vertex elimination is always continued for v E FRONTs, the number of FRONTs never increase. If a node which belongs to several FRONTs is eliminated, these FRONTs are united into one FRONT. A new FRONT appears only when any node v ~ FRONTs is eliminated for the first time.

From the definition of the profile p generally includes not only all nonzero elements of A but also a number of zeros denoted by Loss. That is:

p = M + Loss (5)

Since the number of nonzeros (M) is constant, the minimisation o f p is replaced by the following expression:

min p = min Loss (6)

That is, the profile minimisation problem is replaced by the minimisation problem of zeros in the profile area.

Due to the elimination process some zeros are lost, and so:

rain p - min ( F + Z ) , (7)

where F and Z are the number of fill-ins and zeros after the elimination process, respectively.

PROFILE MINIMISATION METHOD

The purpose of this section is to propose how to renumber nodes in G for equation (7). The following equation is treated first instead of equation (17):

rain P -= rain Z (8)

The graph must satisfy the condition that there always exists a clique in G~¢ at each vertex elimination, and one of the graphs satisfying this condition is tree graph. This indi- cates that graphs obtained from engineering problems may generally suffer fill-ins through the elimination process.

On the contrary, it is easy to find out the node elimina- tion ordering which keeps Z = 0, and for this case use the following equation instead of equation (7):

min p = min F (9)

In order to keep Z = 0 through the elimination, we succes- sively select a node among the members of FRONT. That is, the elimination process requires the appearance of only one FRONT.

Consider the renumbering method for tree graphs. Z appears only at the bifurcation nodes, and the value of Z is evaluated by the following equation:

z = y z j i=1

= ~ { j -- m(v/) -- ID(v/)) , (1 O) i = l '

where a is the number of bifurcation nodes, v/is a bifurca- tion node labelled ' j ' , and ID(vj) and m(vi) are the number of nodes adjacent to v /and having a smaller label than 7 ' and the smallest label among them, respectively. Therefore, the procedure for minimising Z in equation (10) consists of the following steps.

A LGOR ITHM 1

Step 1: Set I = 0. Select a bifurcation node which is the nearest one from an arbitrarily selected end node.

Step 2: Count the number of nodes in each branch gather- ing at the bifurcation node, and give label '1' to the biggest two branches and ' I + 1' to the residuals.

Step 3: If the branches labelled ' I ' contain other bifurca- tion nodes, go to Step 2. Otherwise, go to Step 4.

Step 4: Remove all branches labelled T from the graph. If all branches in the residuals are already labelled, go to Step 5. Otherwise, set 1 = I + 1 and search the first bifurcation node in the branch connected to the removed one for each connected subgraph, and go to Step 2. Repeat this procedure as often as the number of connected subgraphs. (By this procedure all branches in the graph are classified i n t o I = 0, 1, 2 . . . . . )

Step 5 : Search an end node in '0 ' labelled branch, and give the label "N' to the node. Successive ordering is continued for nodes in the branch until the first bifurcation node is labelled.

Step 6: Take one connected subgraph at the bifurcation node, and continue the reverse ordering from one

Adv. Eng. Software, 1984, Vol. 6, No. 3 157

Page 3: Profile minimisation algorithm for sparse matrix

1 2 3 4 5 6 O O O O O O

(a) F =0, Z = 0 , P = 6

I'3 1 2 1 4 5 6 7 0 0 (~ 0 0 0

(b) F = O , Z = O , P = 6

f, 2 3 [ 4 5 6 7 0 0 # ) 0 0 0

(c) F = O , Z = I , P = 7

f, 7 6 ~5 4 3 2 0 0 ~ 0 0 0

(d) F = O , Z = 2 , P = 8

1 2 3 4 5 6 7

(e) F = 5, Z = O , P = 1 1

3•4, 5 6 7 1 2 ""..., C 0 C 0

(f) F = I , Z = O , P = 7

(g) F = 2 , Z = O , P = 8

6 7 0 0

7 O

If a node and a line in a tree graph are replaced by a subgraph and a set of fines respectively (see Fig. 2), the above procedure may give the outline of the renumbering scheme for mesh graphs, and in the following discussion this procedure is directly introduced for the proposal of a new renumbering method for mesh graphs. The property of this introduction is given in ref. 10. Therefore, the renmn- bering method is given for a graph with rather simple surrounding configuration, because if it has a complex surrounding configuration, it is subdivided again into sub- graphs with simpler configuration. How to divide a graph and how to give successive ordering between subgraphs are considered later.

For mesh graphs with simple configuration we may treat equation (9) instead of equation (7), that is the node being eliminated is always selected among the members of FRONT.

Let F i be the number of fill-ins appearing by the elimi- nation o f v i E FRONT. Then, obtain:

f i = OD(vi)* { IFRONT(v i ) [ - 1} --6(vi) (11)

where OD(vi) is the number of nodes in the set {vjlv i C adj. v i, vj¢~ FRONT(vi)}, [FRONT(v/)[ is the number of nodes in FRONT except v i, and 6(vi) is the number of lines in the subgraph {FRONT(vi) U adj. v i} except the connectivities to v i.

Above expression indicates that (1) the starting node for the successive eliminations must be carefully selected and (2) [FRONT] should be kept small through the elimi- nation process. With the first item several effective methods can be found and in this paper the method used is shown in ref. 11.

From the characteristics of the profile the reverse order- ing in this paper is also assumed. Then, from the definition of FRONT and LINE we select a node among the member of LINE. But in order to keep ]FRONT] small, (1) those nodes in LINE adjacent to nodes with minimum out- degree in FRONT should be ordered firstly, and (2) those nodes with maximum in-degree should be selected among them. (See Fig. 3.)

Summarising above considerations the profile minimisa- tion method for mesh graphs becomes as follows:

t 2 f f "\

4 3 I / [1 \ \ 5 6 7 ¢... ~ b .,~ c o

(h) F = 4 , Z =O ,P = IO

Figure 1. Elimination for tree graphs. Note: dotted lines indicate fill-ins

end node of the lowest level branch in the sub- graph. This step is repeated for each bifurcation node, and all nodes are successively and reversely ordered. This ordering is terminated at another end node o f ' 0 ' level branch. Figure 2.

(a)

I I I I II

I !- ~ fll I I I i !

I i I

(b)

Graphs obtained from tree graphs

158 Adv. Eng. Software, 1984, Vol. 6, No. 3

Page 4: Profile minimisation algorithm for sparse matrix

Figure 3.

X X X

LINE X X

IX f-Out-degree IX ~~In-degree

XXXxx

FRONT X X

Out- and in-degree in matrix

ALGORITHM 2 Step 1" Set 1 = 1. Search the starting node and give the

ordering ' I ' to the node. Put v1 in FRONT. Step2: Set / = 1 + 1 and select a node among nodes

adjacent to FRONT arbitrarily, and give the ordering ' I ' to the node.

Step 3: Put v I in FRONT, and put all nodes adjacent to the members of FRONT in LINE.

Step4: Search nodes among FRONT which have the minimum out-degree.

Step 5: Select all nodes (in LINE) which are adjacent to nodes obtained in Step 4, and find out a node with maximum in-degree.

Step 6: Set I = I + 1. Give the label ' I ' to the node. I f / is less than the total number of nodes, go to Step 3. Otherwise, go to Step 7.

Step 7: Stop.

Now, consider the design and detail of the new renum- bering algorithm which is applicable for general mesh graphs.

In the design of ALGORITHM 2 the starting node is assumed to be obtained independently. Moreover, the tree graph which shows the skeleton of the general mesh graph is expected to be simple, that is, it includes only several bifurcation nodes. By using these two facts the new renum- bering algorithm is largely simplified compared to ALGO- RITHM 1.

In the case of tree graphs bifurcation branches are con- nected to a node, but in the mesh graph branches are connected to a subgraph. In order to solve this problem we apply the following treatment. For any kind of mesh graphs ALGORITHM 2 is applied until FRONT includes, at least, three boundary nodes which are not adjacent to each other. (See Fig. 4.) FRONT at this stage is assumed to be the dissection line of bifurcation branches.

In the next section a new reordering algorithm is pro- posed by using the above two algorithms and the additional results in this section.

NEW REORDERING ALGORITHM FOR DECREASING PROFILE

According to the results in the previous section the ordering algorithm must include the following three procedures:

1. Selection of the starting node. 2. Judgement whether the graph contains the bifurcation

branches.

3. Ordering of nodes in each branch, and ordering of branches.

These three procedures are shown as ALGORITHM START, BREAK and PROF, respectively, and the former two are introduced in the third one.

The input-data are summarised as follows:

N: Total number of nodes M: Expected maximum degree NLE: Number of nodes located on the surrounding

boundary MZAS: Node-node incidence matrix

ALGORITHM PR OF Step 1: Set ISUB = 0. Determine the starting node IN by

use of ALGORITHM START, and set IRE(L)= IN for L = 1.

Step 2: Set FRONT(I) = IRE(l) and LINE(I) = adj.vn~ for I = 1,2 . . . . . deg. v~ .

Step 3: Set IRE(L) = LINE(l) for L = 2. Delete IRE(L) from LINE.

Step 4: Add IRE(L)and {vlvEadj . IRE(L)} to FRONT and LINE, respectively.

Step 5: Calculate out-degree of all nodes ( r E FRONT) and set IOUT(FRONT(K))=out-deg.v. If out- deg. v = 0, then delete the node from FRONT and count the number, IJK, of nodes in FRONT.

Step 6: I f l JK > 0, go to Step 8. Otherwise, go to Step 7. Step 7: Set ISUB= ISUB+ 1. Construct new FRONT

and LINE for a new bifurcation branch from the members of KFRONT and KLINE obtained in ALGORITHM BREAK, respectively. Calculate lOUT for the member of the new FRONT.

Step 8: I f IRE(L) is one of the boundary nodes, go to Step 9. Otherwise, go to Step 12.

Step 9: If any one of the boundary nodes adjacent to IRE(L) is not ordered in IRE, go to Step 11. Otherwise, go to Step 10.

Step 10: (Assume that the ordered node is found at K in IRE.) If I IRE(L)--IRE(K)I < I P , go to Step 11. Otherwise go to Step 12.

Step 11: Call ALGORITHM BREAK. (Judgement whether the graph is bifurcated at the node IRE(L).)

Step 12: Search such nodes as to have the minimum out- degree among all members of FRONT, and set them in MOUT(I), I = 1, 2 . . . . . II.

Y ~ f u rcation node

Figure 4. New strategy for ordering

Adv. Eng. Software, 1984, VoL 6, No. 3 159

Page 5: Profile minimisation algorithm for sparse matrix

Step 13:

Step 14:

Step 15: Step 16:

Step 17:

Step 18:

If 1I = 1, set KLM = MOUT(1) and to to Step 15. Otherwise, go to Step 14. Select such nodes in LINE which are adjacent to the member of MOUT, and search any node which has the maximum in-degree among them. Put the node KLM. Set L = L + 1 and IRE(L)= KLM. If L < N , then go to Step 4. Otherwise, go to Step 17. If ISUB=0, go to Step 18. Otherwise, calculate the number of nodes in each branch, and order them successively from the smallest branch. Return.

ALGORITHM BREAK Step 1 : Reorder the member of FRONT from a node with

the shortest distance to IRE(L) until one boundary node, namely Vx, is obtained. Let the distance between Vx and IRE(L) be X.

Step2: Count the number of boundary nodes which locate between Vx and IRE(L), and let it be Y.

Step 3: If Y< IP*X, then return to ALGORITHM PROF. Otherwise go to Step 4.

Step 4: Find a boundary node (~ LINE) which is adjacent to v X .

Step 5: Select and order nodes (E LINE) from the node obtained in Step 4 until another boundary node adjacent to IRE(L) is obtained. And set them in JLINE.

Step 6: Select and order nodes among nodes in FRONT by using the ordering in JLINE, and set them in JFRONT.

Step 7: Set the residual nodes of FRONT and LINE in KFRONT and KLINE, respectively.

Step 8: Set JFRONT and JLINE as FRONT and LINE, respectively, and return to ALGORITHM PROF.

ALGORITHM START Step 1: Select a node among boundary nodes C0, and set

the node as Nj. And, select three other boundary nodes N2, N:~, and N4 which locate at NLE/4 and NLE/2 from N~, respectively.

Step 2: Construct four level structures from these nodes, and calculate Y, IL/I 2 for these level structures. Select one of N i whose S, ILjl 2 has the minimum value among them, and set the node as N1.

Step3: Se tALFA=3 . Step 4: Obtain two nodes N2 and N3 in Co which locate

from N 1 by NLE/(2 ** ALFA). Step 5: Construct three level structures from Ni, and

search for the node which has the minimum value of 22 ILjl 2, and set it as K. If NLE/(2 ** ALFA)/> 12, set N~ = K and ALFA= ALFA+ 1, and go to Step 4. Otherwise, set A L F A = A L F A + 2 . If K :~N1, go to Step 6, and ifK = NL, go to Step 7.

Step 6: Search a node in Co which locates at NLE/ (2.* ALFA) from K toward N> and reset the node as N~ and K as N2. Calculate ~ [Ljl 2 for N1 and N2. Go to Step 8.

Step 7: Select one node among N2 and N3 which has less value of ZILi 12 and set the node as N 3. Search a node on Co which locates at NLE/(2**ALFA) from N~ toward N3, and set the node as N2. Calculate ~ IL i [ 2 from N2.

Step 8: Select the node whose Y, ILjl 2 is less than another, and set it IN. Return to ALGORITHM PROF.

'IP' used in ALGORITHM PROF and BREAK is the parameter for the decision whether a subgraph, for example

59 58 56 53 47 46

57 ~ -

50 ~49 32 33 36 B9 44V "N~'~ 29 26 23 22

/~BY 28 25

2 0 ~ 1 9

1 7~7~16

11 ~ i 0

5 ' 4

9 1

Figure 5.

2 1 3 ii 6 8

19~27 7 5 I0 18 25 ~,

21 26 33 ~]N/<'[ 35 39 ~ i 2

41 ~5

44~ ~48

47 c, 51

5C ZT----~ 54 \

5 - ~ 57

56 / N 5 9

New Method Modified RCM Loss=63 Loss:215 T 3 : 0 . 0 0 6 9 5 Tl=0.00161

T3/T 1 =4.32

An example of the reordering results by three methods

32 24

44 39 34

7 14

27 20

38 324228~361

46~__

49

52

~ l 5

t8 ~_4 273

31 29 37

47

55 • ~ %

57 " 59 GPS

Loss=l 36 T2=0.00845

T2/Tl=5.25

17 12 11

21

160 Adv. Eng. Software, 1984, Vol. 6, No. 3

Page 6: Profile minimisation algorithm for sparse matrix

area 1I or III in Fig. 4, should be treated as a bifurcation branch, and IP=3 is used in the following numerical experiments.

The actual program list of the above algorithms except ALGORITHM START is given in the Appendix and the numerical examples are presented in the successive section. For the selection of the starting node the user may apply the algorithm by Gibbs et al. 6 instead of ALGORITHM START in this paper.

NUMERICAL EXPERIMENTS

In order to survey the efficiency of the proposed algorithm a number of test examples are solved by using the above procedure, RCM and GPS methods, and their results are compared for the profile value and the execution-time. The reasons of the usage of RCM and GPS for the com- parison are that (1) they may be one of the most com- monly used methods and (2) are one of the fastest algorithms. But, since RCM lacks the procedure to select an appro- priate starting node and it constructs a number of level structures, it may often require long execution-time. Therefore, for the comparison of the execution-time we use the execution-time for constructing one level structure.

One of the applications of the above three algorithms is illustrated in Fig. 5, and the comparison of their results is also given in the same figure. Loss indicates the number of zero elements in the profile area. Results of the application of RCM, GPS and the present method are illustrated in Fig. 5, and the comparison of their results is also given in the same figure, and T1, /'2 and /'3 are the execution-time by RCM, GPS and the new method, respectively. N indi- cates the number of nodes. The value of T3/tl, for example 4.32 in this case, indicates that the new method requires as long execution-time as RCM constructs more than four- level structure.

The results of 10 examples are summarised in the table, and the comparison of the execution-time and loss for these test examples are illustrated in Figs. 6 and 7, respectively.

These results may lead to following conclusions:

1. New method can generally give the best reordering results compared to the ones by RCM and GPS.

2. New method requires longer execution-time for the reordering compared to RCM and GPS, but it requires only 1.5 times of the execution-time by GPS. There- fore, it is faster than the original RCM algorithm.

T(sec.

0.08

0.06

0.04

0.02

0

Figure 6.

LOSS

8000

6000

4000

2000

0

Figure 7.

• NEW o RCM

× GPS

~ X

~_l s ~ - ~'- -O

~o-o- - w "-'°'- I I I I

100 200 300 400

Comparison of the execution-time

| NEW

D GPS

1oo 260

Comparison of loss

N

300 400 N

Table.

Case No.

N

Loss RCM

Tl(Sec.)

Loss GPS

T2(sec.)

Ratio T2/T 1

Loss NEW

T3(sec.)

Ratio T3/T 1

Comparison of results

1

42

183

0.00122

108

0.00839

6.88

* 101

0.00545

4.47

2 3 4 5

99 136 193 59

632 807 2228 215

0.00259 0.00361 0.00513 0.00161

*490 642 1738 136

0.01248 0.01245 0.01620 0.00845

4.82 3.35 3.16 5.25

537 * 547 "1423 * 63

0.01341 0.01719 0.02889 0.00695

5.18 4.76 5.63 4.32

6 7 8 9 i0

163 148 232 374 414

1978 1603 2748 4908 6720

0.00552 0.00694 0.00606 0.00937 0.01297

"1529 1162 2353 4738 6589

0.02192 0.02188 0.02267 0.02188 0.04506

3.97 3.15 3.74 2.34 3.47

2427 * 923 "1856 *4279 *5867

0.03339 0.02120 0.03772 0.06948 0.07997

6.05 3.05 6.22 7.42 6.17

* = Greatest reduction

Adv. Eng. Software, 1984, Vol. 6, No. 3 161

Page 7: Profile minimisation algorithm for sparse matrix

These conclusions suggest that the new method becomes effective for systems with complex boundary configura- tions, and that GPS is effective for rather simple ones.

All numerical experiments shown in this paper are done by using an ACOS 700 machine at Okayama University Computer Centre.

CONCLUDING REMARKS

In the present algorithm the judgement of the existence of bifurcation branches is done at every selection of the boundary node. This procedure is improved as follows: (1) Order all nodes in G without regard to the existence of bifurcation branches. (2) Reorder the results from the last node in each branch by using the node-node incidence. (3) Exchange the ordering of branches by comparing the number of nodes in them. Among these three procedures the first two are for minimising the fill-ins and the last one for minimising Z. This improvement may save the execu- tion-time, and, furthermore, it makes possible the design of algorithm valid for three-dimensional structural systems.

REFERENCES

1 Cuthill, E. and McKee, J. Reducing the bandwidth of sparse symmetric matrices. In Rose, D. and Willoughby, R. (eds.), Sparse Matrices and Their Applications, Plenum Press, 1972

2 Collins, R. J. Bandwidth reduction by automatic renumbering, Int. J. Num. Meth. Engn. 1973, 6,345

3 Patter, S. V. The use of linear graphs in Gauss elimination, SIAMRev. 1961, 3, 364

4 Cheng, K. Y. Minimizing the bandwidth of sparse symmetric matrices, Computing 1973, 11, 103

5 George, A. Computer implementation of the finite element method, Stanford Computer Science Dept., Technical Report, Stanford, 1971

6 Gibbs, N. E., Poole, W. G. and Stockmeyer, P. K. An algorithm for reducing the bandwidth and prof'de of a sparse matrix, SIAMJ. Numer. Anal. 1976, 13, 236

7 Shiraishi, N. and Taniguchi, T. New renumbering algorithm for minimizing the bandwidth of sparse matrices, Adv. Eng. Software 1980, 2 (4), 173

8 Papadimitriou, Ch. H. The NP-completeness of the bandwidth minimization problem, Computing 1976, 16,263

9 Garey, M. R., Johnson, D. S. and Stockmeyer, L. Some simpli- fied NP-complete problems, 6th Annual ACM Symposium on Theory of Computing, 1974, pp. 47-63

10 Taniguchi, T. Complexities of the design of the bandwidth and profile minimization algorithms. Adv. Eng. Software 1984, 6 (1), 22

11 Shiraishi, N. and Taniguchi, T. Reducing the bandwidth and profile of a sparse matrix. In Absi, E., Glowinski, R., Lascaux, P. and Veysseyre, H. (eds.), Numerical Methods for Engineer- ing GAMNI2, Vol. 1, DUNOD, 1980, pp. 18%96

12 George, A. Solutions of linear systems: Direct methods for finite element problems. In Barker, V. A. (ed.), Sparse Matrix Techniques. Lecture Note in Mathematics 572, Springer- Veflag, 1976, pp. 52-101

13 Rose, D. J. A graph-theoretic study of the numerical solution of sparse positive-definite systems of linear equations. In Read, R. C. (ed.), Graph Theory and Computing, Academic Press, 1972, pp. 183-217

APPENDIX

Programming list

CCEC SUBROUTINE FOR PRO~IL M IN IMIZAT ION SUBROUTINE PROF(N,M,NLE,MZAS,JRE) DIMENSIOH ~ Z A S ( 6 0 0 , 2 0 ) , I D E G ( 6 0 0 ) . I R E ( 6 0 0 ) , I F R O N T ( ~ O O ) , L I N E ( 1 0 0 ) DIMEHSION M A P ( 6 0 0 ) , I M A P ( 6 0 0 ) . K F R O H T ( I O , I O O ) , K L I N E ( 1 0 , 1 0 0 ) D I M E H S I O N K Y ( % O ) , K Z ( I O ) , I S T A R T ( I O ) , I E N D ( I O ) , 1 0 U T ( 6 0 0 ) , K R E ( ~ O ) ~IMEHSION M O U T ( 6 0 0 ) , I N D ( 6 O O ) , J ~ E ( 6 0 0 )

CCEC THIS PROGRAM IS VALID ~OR 2-D[~ENSIONAL SYSTEM g ITH LESS THAN CC 600 NODES. LESS THAN 20 OEGREE AND LESS THAN 10 BRANCHES, CC I N STARTING V E R I E X CC N TOTAL NUMBER OF NODES

55 56 57 58 59 6O 6~

62 6 ] 6~

65 66 6 t 68 69 70 Z l 72 75

z s ; 6 t ? 78 79 80 81

82 83

g s 8~

88 89 90 91 9~ 93 9c 95 9~ 9 z 9B 9~

1 0 0 I 0 1

l o 3

1 0 s ~06 107 108 1 0 9 ~10

115

115

117

120 121 322

127 1 2 8

~3o 151 n32 133

135 136

138 159 1~0

l t , 7

cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc CC CE CE CC CC CC CC CC CC CE CE CC CC cccc

rl MZAS NLE [PEG IRE IFRONF LINE IX iY { z MAp

IMAR

lOUT KRE FIOUT [ND JRE ~CFRONI KLINE KY KZ I S T A R r ~END JX [P ~ SUB JSUB

EXPECTED MAX-DEGREE NODE-NODE INCIDENCE NUMBER OE BOUNDARY NODES ~EGREE OF NODES REVERSE ORDERING RESULT gRONT LINE NUMBER OF NODES ALREADY ORDERED NUMBER OF NODES IN FRONT NUMBER OF NODES IN LINE

I NOT ORDERED 0 [N LINE

-1 I H FRONT =2 ALREADY ORDERED

1 INNER NODES 0 ALL BOUNDARy NODES I BOUHDARY NODES IN FRONT

-2 BOUNDARY NODES ALREADY ORDERED OUTOEG OF NODES IN FRONT BIFURCATION NODES NODES I H FRONT V/ITH M I N OUT-DEGREE IN-DEGREE OF NODES IN FLOUT FINAL ORDERING (EL IMINATION ORDER[NG) FRONT OF UNTREAIED BRANCHES L I N E OF UNTREATEa BRANCIIES NUMBER OF NODES IN KFRONT NUMBER Of NODES IN KLINE [ N I T I A L LOCATION I N IRE OF NODES FINAL LOCATION OF EACH BRANCH IN I R E I N I T I A L LOCATION [N IRE OF NODES PARAt'IETER FOR JUDGEMENT OF BIFURCAf lON NODE NUMBER OR BRANCHES IN PRESENT TOTAL NUITBER OF ~RANCIlES

I N I T I A L S E T T I N G I S U B = O JSUB=O ~P=3

CCEC D E T E R M I N A T I O N OF S T A R T I N G NODE CALL S T A R T ( M Z A S , N , M , N L E , I O E G , I N )

CCCE CALCULATION OF DEGREE DO 8 0 0 I = I , N I D E G ( I ) = O

M A P l l ) = I D o 8XO J = I , 2 0 [F(MZAS(I.J))800.800,820

8 2 0 [ D E G ( 1 ) = I D E G ( 1 ) ~ I a i d CONTINUE 8 0 0 CONTINUE

o o g [ = I , N 8 LMAP(I)=I

DO 9 [ = I , N L E 9 [MAPI I )=O

CCC£ REORDERING OF " I " ANO " 2 " NODES tX=~ I R E ( I X ) = I N

[ F R O N T ( I y ) = [ N t l A P ( I N ) = - I I r l A P ( { N ) = - I NDK=IDEG(IN) DO 10 I=I,NDK L L N E I I I = I $ I A S ( I N , [ )

10 M A P ( L I N E ( [ ) ) = O { O U T ( I N ) : N D K IZ=NDK I X = I X * I I R E ( I X I = M / A S ( I N , I )

CCCE CONSTRUCTION OF FRONT AND LINE 20 [Y=IY~I

[ F R O H T ( I Y ) = I R E ( [ X ) M A P ( I R E ( I X ) ) = - I DO 25 I=1,1Z IF(MAP(LINE(1)))30,25,E5

25 CONTINUE 30 IF(I-IZ132,34.3& 32 DO 35 J=I,IZ-I 35 L I N E ( J ) = L I N E ( J .1 ) 34 i Z = I Z - 1

N D K = I D E G ( I R E ( I X ) ) [ O U F I l R E ( I X I ) = N O K

EC CALCULATION OF OUTOEG IJK=O DO CO I=I,NOK K K = M Z A S ( I R E ( I X ) , I ) [F(fIAP(RK))~2,40,45

45 i z = i z * l L I N E ( I Z ) = K K MAP(KK)~O GO TO ~O

&2 { O U T ( I R E ( I X I ) = I O U T ( I R E K I X ) ) - I I O U T ( K K ) = I O U T ( K K ) - I IF(IOUT(KK))43,&3,&O

45 MAP(KK)~-2 IF(IMAP(KK))36.36,SI

36 IMAP(KK)=-2 37 IJK=IJK+I

~0 CONTINUE I F ( I O U T ( I R E ( I X ) ) ) 4 ~ , A A . 4 6

~ MAP(IRE(IX))=-2

I F ( [ M A P ( I R E ( I X ) l ) 3 8 , 3 8 , 3 9 38 I M A P ( I R E ( I X ) ) = - 2 59 IJK=IJK*I

CE f4ODIFICATION OF FRONT c I . r K > O * ~ * MUST MODIFy C {JK:O * * * NOT MODIFY

C6 IF(IJK)52,52,47

4Z IJK=0 DO 48 i = l , l Y [ F ( M A P ( I F R O N T ( 1 ) ) ÷ E 1 4 9 . 4 g , k 9

~9 I J K : I J K ~ I I F R O N T ( I J K ) = I F R O N T ( I )

~8 [ONTINUE Iy:IJK

CC JUDGEMENT WHETHER A BRANCH IS ORDERED C [ Y : O " 1 . TO NEW BRANCH E IY>O * * * To SAME BRANCH

IF(IY)55,53,52 53 DO 200 I = I , K Y ( I S U B )

I F R O N T ( 1 ) = K F R O N T ( I S U B , I ) 2 0 0 N A P ( I F R O N T ( I ) ) : - I

I Y : K Y ( I S U B ) DO 2 1 0 [ ~ I , I Z ( I S U B ) L I N E ( 1 ) = K L I N E ( I S U B . [ )

210 M A P ( L I N E ( 1 ) ) = O I Z = K Z ( I S U B ) NDK=IOEG(KRE( ISUB)) DO 20S ] ~ I , N D K K K = M Z A S ( K R E ( I S U B ) . I ) [ F ( M A P ( K K ) ) 2 0 5 , 2 0 6 , 2 0 6

206 t F R O N T ( I Y ' I I = K R E ( I S U B ) IY= Iy+~ MAP(KREKISUB))= 1 GO TO 2 n 7

2DS CONTINUE 207 ISUB:ISUB 1

IF(ISUBlE20*220,250 220 JSUB:JSUB+I

162 Adv. Eng. Software, 1984, Vol. 6, No. 3

Page 8: Profile minimisation algorithm for sparse matrix

149 150 151 152 153 154 155 156 157 158 159 160 161 ~62 163

165

168 169 170 171 172 173

176 177 178 179 ~80 181 182 183

186 187

189 190 191 192 193 194 195 ]96 197 198 199 200 201 20~ Z03 20~ 2O5 206 2QZ

208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 2~5 236 2~7 238 239 2&O 24I 242 243 244 2~5 2/.6 247 248 249

ISTART(JSUB)=JX IEND(JSUB)=IX

230 oo 2 ~ o I = I , IY KK=IFRONT(1) IOUT(KK)=O NDK=IDEG(KK) DO 250 J=],NOK KLM=MZAS(KK,J) IF(HAP(KLH))250,260,250

260 [OUT(KK)=IOUT(KK)+I 250 C O N T I N U E 2 ~ o CONTINUE

GO TO 5~ CCCC JUDGEMENT OF THE EXISTENCE OF BIFURCATION NODE

52 IF ( IMAP( IRE( IX ) ) ) 5~ ,21 ,54 21 NBK=IDEG( IREI IX ) )

Do 2 2 [ = I . N D R KK=HZAS( IRE( IX ) , I ) IF(Ii'IAP(KK))SI,~2,~2

57 KLM=IABS(IRE(IX)-KK) [F(~LM-2)23.~3,58

58 [F(KLM-NLE/2)22,23,23 2 2 C O N T I N U E

[MAP( IRE( IX ) )=~ I &CALL BREAK(MZAE,NLE, IOEG. IRE. IFRONT,LINE, IX, [Y, I I ,MAP, IMAP,IP,

ISUB,KFRONT,KLINE,KY.KZ,JX, IOUT,KRE) 23 I t ' IAP ( IRE( IX ) )= - I

£CCC SEARCH NODES WITH MIN-OUTDEG 5~ M I N : 1 0 0 0

DO 50 I : I . I Y KK=IOUT(IFRONT(1)) IF(HIN-KK)SO.55,60

55 IJK=[JK+I I4OUT([JK)=IFRONT(1) GO TO 50

6 0 IJK=I MOUT(IJK)=[FRONT(1) M I N = K K

50 CONTINUE IF(IJK-1)65,110,65

65 LMN=U DO 7 0 I=I,IJK KK=HOUT(1) NDK=[DEG(KK) DO 7~ J = I , N D K IF(MAP(MZAS(KK,J)~)TS,RO,75

80 LMN=LMN+I INDfLMN)=MZAS(KK,J) MAP(HZAS(KK,J))=I

75 CONTINUE 70 CONTINUE

CCCC SEARCH A NODE WITH MAX-INDEG r~AX=O DO 85 I = I , L M N NDK=[OEG([ND(1)) IjK=O M A P ( I N D ( 1 ) ) = 0 DO 9 0 J=%INDK KK=MZAS( IND( I ) , J ) IF (MAR(KK) )D5 .90 .90

95 IJK=IJK*I 9 0 C O N T I N U E

[F(MAX-IJK)100,BS,B5 100 MAX=IJK

KLM=IND(I) BS C O N T I N U E

GO r o 125 1 1 0 NDK=IDEG(MOUT(1))

DO 1 1 5 [ = I , N D K KK=~ZAS(MOUT(1).I) [ F ( M A P ( K K ) ) 1 1 S , 1 2 0 , 1 1 5

115 CONTINUE 120 KLM=KK

CCCC O R D E R I N G OF S E L E C T E D N O O E ( K L M ) IN I R E 1 2 5 I x = I X + l

IRE( IX)=KLH CCCC J U D G E M E N T WHETHER O R D E R I N G IS FINISHED

I F (N - IX )150 ,150 ,20 CCCC B L O C K - R E O R D E R I N G OF HOPES IN B R A N C H E S EC JUDGEMENT WHETHER THE GRAPH CONTAINS BIFURCATION C JSUB>O * * - WITll BIFURCATION C JSUB=0 * - * WITHOUT BIFURCATION 150 IF(JSUB)190.190,152 152 IS=ISTART(JSU8)

IE=IEND(JSUB) I JK= IX - IE KL~= IE - IS lF(IJK-KLM)155,190.190

155 DO 160 I = I S ÷ I , I E 160 JRE(1 )= IRE( I )

IJK=IS DO 162 [ = [E÷ I , IX | J K = [ J K * I

162 IRE ( I JK )= tRE( I ) DO 1 0 4 [ = I S * I , I E I J K = I J K + ]

164 [ R E ( I J K ) = J R E ( I ) 1 9 0 ~O 9 0 0 I = I , N 900 J R E ( N - I * I ) = [ R E ( [ )

RETURN EN~

I

2 3 4

S 6 7 8 9

10 11 12 13 T~ 15 16 17 18 19 20 21 22 23 2c 25 26 27 28 29 30 31 32 33 3~ 35 36 37 38 39

l,?

1,3 4~

~5 46 41 ~g

~9 50 5~ 52 53 5~ 55 56 57 Pg ~9 6O 61 62 65 64 6S 66 67 68 69 70 71 ?2 73

7S 76 ?7 78 79 RO R1 82 83 8~ 8 5 8 6 8 7 88 89 90 91 92 93 94 95 96 97 98 99

100

102 103

105 106 107 108 109 110

112 113

115 116 117

CCCC SUBROUTINE BREAK SUBROUTINE BREAK(MZAS,NLE,IDEG, IRE . IFRONT,L INE , IX , IY , IZ ,MAP, IMAP

g IP, ISUB,KFRONT,KLINE.KY,KZ,JX. IOUT.KRE) D[MENSION MZAS(OOO,20) . IOEG(6OO) . IRE(600) I IFRONTI100) ,L INE(100) DIMENSION MAP(600) , IMAP(600) ,KFRONT(10 ,100) ,KL INE(10 ,100) DIMENSION KY( IO) ,KZ ( IO ) , IOUT(6OO) ,KRE(10 ) DIMENSION IEVG(SO,5) ,JFRONT(100) ,JL INE(100)

CCCC CONSTRUCTION OF LEVEL SIRUCTURE FROM BIFURCATION NODE(KK) IJK=O LMN=I KK=IRE( IX) ND=IOEG(KK) DO 1 0 I = I . N D LL=MZAS(KK.I) I F I~RP(LL )÷ I ) 10 ,15 , IO

l S I JK= IJK+ I IEVG(LMN,IJK)=LL I F ( I I A A P ( L L ) ) 3 5 . I ? , l ?

17 MAP(LL)=0 1 0 C O N T I N U E 16 KLM=O

~o 20 I = I , I J K KK=IEVG(LMN,I) NDK=IDEG(KK) DO 25 J=I,NDK LL=MZAS(KK,J) IF(~AP(LL)~I)25,~O.2S

30 KLM=KLM+I IEVG(LMN+I,KLM)=LL MAP(LL)=O

EC JUDGEMENT WHETHER ANOTHER BOUNDARY NODE IS OBTAINEQ IN FRONT [F(IMAP(LL)+I)25.35,25

25 C O N T I N U E 20 CONTINUE

IJK=KLM c LMN N U M B E R OF L E V E L S T R U C T U R E

LMN=LMN÷I GO TO 16

cccc JUDGEMENT WHETHER THE GRAPH SHOULD BE DISSECTED 35 DO 40 l=1,1Y 40 MAP(IFROHT(1))=-I

C IJK HUMBER OF BOUNDARY NODES I JK= IABS( IRE( IX ) -LL ) INLE=NLE/2 IF(IJK-INLE)55.55,45

~S IJK=NLE-IJK 55 IF(IP*LMN-IJK)50,50.200 5 0 NDK=IDEG(LL)

[EUB=ISUB*I CCCC CONSTRUCTION OF JFRONT AND JLINE

JX=IX DO 60 I=I,NOK KK=MZAS(LL,I) IF(IMAP(KK))60,65,60

6 0 C O N T I N U E 65 Jz=~

J L I N E ( J Z ) = K K MAP(KK)=I JY~I JFRONT(JY)=LL MAP(EL)=1

72 N O K = t D E G ( J L I N E I J Z ) ) lJ~=O KLM=JLINE(JZ) DO ?0 I=I,NDK KK=MZAS(KLN,I) IF(MAP(KK))75,80.?O

75 JY=JY+I J F R O N T ( J Y ) = K K MAP(KK)=I I J K = I J K + I GO r o l o

8 0 J Z = J Z , 1 J L I N E ( J Z ) = K K

I J K = I J K + I 7 0 C O N T I N U E

I F ( I JK )BS ,SS ,72 CECC CONSTRUCTION OF KFRONT AND KLINE

85 IJK=O DO 90 I= I , IY I F ( M A P ( I F R O N T ( 1 ) ) ) 9 5 , ? 0 . 9 0

95 IJK=IJK+I KFRONT(ISUB,IJK)=IFRONT(I) MAP(IFRONT(1))=I

9 0 C O N T I N U E KY(ISUB)=IJK l J ~ = O DO 1 0 0 I = l , I Z I F ( M A P ( L I N E ( 1 ) ) ) I O 0 , 1 0 5 , 1 0 0

105 I J K = I J K + I KL INE( ISUB , [ J~ )=L INE(1 ) M A P ( L I N E ( I ) ) = 1

1 0 0 CONTINUE KX(ISUB)=IJK KRE( ISUB)=|RE( IX) O0 1 1 0 I = I , J Y IFRONT(I)=JFRONT(1)

1 1 0 NAP( IFRONT( I ) )= - I IY=Jy p o 1 1 5 I = l , J Z L I N E ( I ) = J L I N E ( I )

115 MAP(LINE(1))=O CCCC CALCULATION OF IOUT

I Z = J Z o o 210 I = I , I Y K K = I F R O N T ( | ) IOUTIKK)=O NDK=IDEG(KK) DO 220 J = I , N D K K L M = t 4 Z A S ( K K , J ) IF(MAP(KLM))220,230,220

2 3 0 IOUT{KK)=IOUT(KK]+I 2~0 C O N T I N U E 210 CONTINUE 200 RETURN

END

Adv. Eng. Software, 1984, VoL 6, No. 3 163