You are on page 1of 10

Networks

INTRODUCTION
These notes provide an informal introduction to network processing techniques. Network techniques have gained wide acceptance as a tool in civil engineering software. Their use is a direct
result of the increased dependence on discrete methods of analysis using computers.
The following table illustrates civil engineering applications commonly represented by networks. The table summarizes the physical significance of branches and nodes. In the first
five areas listed, the branches are termed line elements, i.e., they are represented via a line with
a node at each end. The sixth area, the finite element method, does not have this restriction,
where elements often have from two to twenty nodes.

Civil Engineering
System

Significance of the
Branches

Significance of the
Nodes

Framed Structures

Structural Members

Structural Joints

Hydraulic Systems

Pipes

Junctions

Surveying Systems

Traverse Sides

Bench Marks

Transportation Systems

Transportation Links

Intersection of Load Points

Construction Scheduling

Logical Interconnections or Activities or


Activities
Events in time

Finite Elements

Representation of Solids

Interconnect Solids

For pedagogical reasons, these notes discuss only networks consisting of line elements. Data
structures and computational processes for more complex networks follow easily from the current presentation.

NETWORK TERMINOLOGY
The study of relationships between quantities in a network is called graph theory. Entire
courses in abstract mathematics are devoted to the subject. For our purposes, we need only a
few very basic concepts. Consider the simple network shown in the figure.
A node defines the initial and terminal point of one or more branches. Every branch must
have a starting and ending node. A graph which can be drawn without crossing branches is
termed planar.

CEE-490, CSE-491 Class Notes

Network Processing

Branch #

Branch Direction

1
2

Node #

3
3

In this simple graph, branch 1 is incident on nodes 1 and 2. Similarly, node 3 is incident on
branches 2 and 3. A loop defines a closed set of 2 or more branches. The above network has one
loop. In this oriented graph, each branch has an assigned (positive) direction as indicated by
the arrowhead at one end of each branch. Thus, branch 3 is positively incident on node 2. In
simple, planar graphs the number of branches = number of nodes + number of loops --1.

PROCESSING NETWORK DATA


The idealization of a continuous civil engineering application as a discrete network is covered
in the courses for the various disciplines. Consequently, only the common approaches to processing networks after the problems have been formulated are discussed here. Consider, for example, the network shown in the following figure, which consists of six nodes (nn), nine
branches (nb) and four loops.
This network represents a discrete model for a structure, a pipe network, a surveying traverse, etc. The physical meaning of the branches and nodes in the network have no significance
in the present discussion. The pipe network application is used for illustrative purposes. In
processing a system of this type four questions frequently occur:
1)

which nodes are incident (connected) on a given branch?

2)

which branches are incident on a given node?

3)

which branches are included in a given closed loop?, and

4)

in which loops is a given branch included?

The information to answer each of these questions is found in the two fundamental connectivity matrices, termed A and C, as shown below. The A matrix relates nodes and branches.
The matrix C relates branches and loops. The following matrices describe the network above.
A is an nbnn matrix specifying the connectivity of the branches and nodes. The rows correspond to the branches, the columns to the nodes.

CEE-490, CSE-491 Class Notes

Network Processing

Branch #

Branch Direction

3
2
1

Node #

2
5

Loop # and
Direction

4
6

5
7
9

A Matrix
Node No.
1
2
3
4

0
0
0
0

0
0
+1
0

0
+1
0
+1

+1
-1
-1
0

-1
0
0
-1

0
0
0
0

5
6
7

0
+1
-1

+1
-1
0

-1
0
0

0
0
0

0
0
+1

0
0
0

8
9

0
+1

-1
0

0
0

0
0

0
0

+1
-1

+1
0
The element A i,j =
1

C Matrix

only 2 nonzero terms


on each row

Loop No.
1
2
3
4
5
6
7
8
9

Branch No.

Branch No.

column lists
branches
connected
to node

column lists
branches in
the loop

if branch i is

positively
not
negatively

+1
+1
0
-1
0
0
0
0
0

0
-1
+1
-1
0
0
0
0

0
0
0
+1
+1
+1
+1
0
0

0
0
0
0
0
-1
0
+1
+1

row lists
loops in
which the
branch
appears

incident on node j.

Similarly, the relationship between branches and loops is described by an nbnl matrix C.

CEE-490, CSE-491 Class Notes

Network Processing

The element C i,j =


+1
0
1

if branch i is

positively
not
negatively

incident on loop j.

A positive incidence value implies the direction of the loop arc in the figure. Most engineering
formulations utilize the branch node matrix A, as opposed to C. No further discussion of the C
matrix is included here.
As shown in the figure, each branch is assigned a positive direction. A branch is then negatively incident on the node from which it emanates and positively incident on the node to which
it points.
By specifying a sign for each branch, we establish a convention for physical quantities associated with the branch. For example, when the network represents a pipe flow problem, the
positive direction of the branch indicates the direction of positive flow. If a problem is solved
and a negative flow results in some branches, the flow in those branches is opposite to the direction of the branch (as indicated by the arrows). In structural problems, the direction of the
branch usually implies the positive direction for the longitudinal axis of the member. This determines the direction of positive forces associated with each end of the member.
Nodes also have physical quantities associated with them. In structural problems, they include nodal displacements, applied nodal forces, reactions, etc. In flow problems, nodal values
include the potential (or pressure head). Both potential and displacements must be measured
with respect to some reference condition. If the value of the nodal quantities is fixed by physical
constraints, as for example the supports on a beam, these nodal quantities are said to be
constrained. They may or may not be zero. If they are zero, we often just drop those quantities
from the problem formulation and the other values are then just measured relative to these
nodes.
Because of the the possible appearance of constrained nodes, columns in the matrix A are
often separated (vertically) into two parts. The entire matrix is usually denoted the augmented
incidence matrix; the one without the constrained degrees of freedom is then called the incidence matrix. We denote them as A and a, respectively.
Use of [A] Matrix
Let us now consider how the A matrix is utilized in the solution of engineering problems
expressed in network form. Let U be a vector of nodal quantities, e.g. pressure head, measured
with respect to a global reference point external to the network. Let H be a vector of corresponding branch quantities, for example, the change in pressure over the length of a pipe. Let u be
a vector of nodal pressures measured with respect to some absolute reference (e.g. a reservoir).
It becomes evident (study the structure of A and the previous figure with the example network)
that
H=A U
Examination of this matrix multiplication shows that each element hi in H is formed using
exactly two non-zero terms during computation of the product AU. At the same time, the determination of each element, hi , via the matrix multiply AU requires nn multiplications and nn
additions. Thus, matrix operations in network problems may be very inefficient relative to
computing time.
Inefficiency also arises from a computer memory utilization point of view. In the A matrix
there are exactly 2nb non-zero terms. However, the total number of elements in A is nnnb.

CEE-490, CSE-491 Class Notes

Network Processing

Thus, we need 500,000 memory locations (2MB) to store A for a network with 1000 branches
and 500 nodes (not a very large network!). This is a very large array, containing mostly zeros.
We need an improved method to store the information contained in A.
The NODE Array
Instead of generating the formal A matrix, we generate a more compact table called NODE
to specify only the non-zero terms in A. The NODE array contains one row for each branch in
the network. Each row contains two columns. The elements of NODE are defined in the following way. NODE(i,1) contains the column number of the +1 in row i of the A matrix. NODE(i,2)
contains the column number of the --1 in row i.

Branch No.

The NODE array shown below for our example network illustrates a basic technique called
indexing into an array.
NODE
(+) (--)
4 5
3 4
2 4
3 5
2 3
1 2
5 1
6 2
1 6

Index

u1
u2
u3
u4
u5
u6
u7
u8
u9

1
5

Entries of the NODE array provide locations (or indexes) into the U vector. Given both U
and NODE, the following code fragment computes the H vector:
for( pipe=1; pipe<=nb; pipe++ )
{
node_end
= node(pipe,1);
node_strart = node(pipe,2);
h(pipe)
= u(node_end) - u(node_start);
}

where the node array and u, h vectors are previously defined using the vector and array classes
described in class. Indexes start 1 at 1 not 0. The ( ) operator is overladed by the classes to provide indexing services.
The total number of operations reduces to just nb subtractions. (In reality that is not a completely fair assessment. There are subscript calculations and loop calculations.) Use of the
NODE array significantly reduces not only the required memory but also the number of computations performed.
The LINK Array
The NODE array does not provide a direct answer to the question: Which branches are incident on a particular node? This question arises whenever a nodal quantity must be computed
from quantities associated with branches attached to the node. For example, to calculate the
net outflow Sj for node j in a piping network, we sum algebraically the flow from the branches

CEE-490, CSE-491 Class Notes

Network Processing

attached to the node.

fl

fm

Sj = f l + f m f k

j
Sj

S = AT F

fk

Sj > 0
means flow is
out of network

By inspection, the flow from all nodes in a network is calculated from S=ATF, where F denotes a vector of branch flows. However, the same argument which demonstrates that use of
the A matrix is inefficient for calculating branch quantities also applies to the utilization of AT.
The alternative to use of AT involves an array called LINK. One possible form of the LINK array associated with the example network is:

Node #

LINK

6
-7
9
0

3
5
-6
-8

2
4
-5
0

1
-2
-3
0

-1
-4
7
0

8
-9
0
0

KOUNT

every branch appears exactly twice


no. rows = max
connectivity

Each column of LINK contains the list of branches attached to the corresponding node.
However, a potentially large number of zeros must still be stored to accommodate the differences in number of branches connected to the various nodes. The LINK array can be dynamically allocated at run time for nn columns and the required number of rows based on the maximum connectivity; however, this does not remedy the storing of zeros. We really would like to
define a data structure at run time that exactly represents the actual number of nodes and
whatever level of connectivity exists for the network. The fixed, 2-D LINK data structure does
not fit this problem very well as, for example, in the following network where 1 node touches
all branches:

worst case example for the


LINK array. One node touches
all other nodes.

CEE-490, CSE-491 Class Notes

Network Processing

The LINK and IPT Vectors


An alternative to the two dimensional LINK array is shown in the figure below. This data
structure eliminates the objections described above. LINK becomes a dynamically allocated
vector of length 2nb. The dynamically allocated IPT vector contains nn+1 locations, and indexes into the LINK vector. The last entry in IPT is initialized to IPT(nn+1)=2 nb + 1. This
data structure is sometimes called an inverted list. The beginning location of the nodal incidences for node j in LINK, is found via IPT( j ). Thus IPT( j ) contains an index (location) into
the LINK array at which the branch numbers connected to node j are found. The number of
branches, k, incident on node j, is determined from the difference [ IPT( j+1 ) -- IPT( j ) ]. Note
that to find the number for the last node, nn, it is necessary to use IPT( nn+1). That is why
IPT for our example network has 7 entries for a 6 node network.
LINK

Node #

IPT
1
2
3
4
5
6

1
4
8
11
14
17
19

nn+1

2nb

6
-7
9
3
5
-6
-8
2
4
-5
1
-2
-3
-1
-4
7
8
-9

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

Index

This improved formulation does not bias the data structure towards a particular number
of branches on a node, but rather allocates a total space of 2nb locations for the entire network. No zeroes are stored. The disadvantages of the inverted list include: a) we must build
it, and b) data accesses require lookups through IPT. The following example program segment utilizes LINK and IPT to generate the net outflow, S(node), for node in a network:
first_link_pos = ipt(node);
last_link_pos = ipt(node+1) - 1;
sum
= 0.0;
for( link_pos=first_link_pos; link_pos<=last_link_pos; link_pos++ )
{
pipe = link(link_pos);

CEE-490, CSE-491 Class Notes

Network Processing

if ( pipe > 0 )
sum += flow(pipe);
else
sum -= flow(-pipe);
}
s(node) = sum;

We can calculate the net outflow for all nodes by adding an outer loop for node=1, 2, ..., nn.
To generate the net outflow for all nodes, it is not necessary to the use the LINK vector as
demonstrated below. The entire S vector is cleared and then the contribution of each branch
is added to two locations in S. After passing over all branches one time, S is complete.
for( node=1; node<=num_nodes; node++ )
s(node) = 0.0;
for( pipe=1; pipe<=num_pipes; pipe++ )
{
end_node
= node(pipe,1);
start_node
= node(pipe,2);
s(start_node) -= flow(pipe);
s(end_node)
+= flow(pipe);
}

In this approach, we obtain the entire S vector because it is not possible to generate a single
element of the S vector directly from the NODE array without a selective search.
Comparison of Methods to Generate S
Let us return now to generation of the S vector, using either the NODE or the LINK vector
and examine the two methods from the point of view of memory access into the S vector. This
becomes a critical consideration when memory is limited and/or when the problems are large.
When using the LINK approach, computation and storage (access) into the S vector is sequential. We completely generate the value of S1 then S2, etc. Now examine the alternate method
of computing S, i.e., using the NODE array. Access into the F vector (of pipe flows) is sequential
while the access/storage into the S vector (of nodal flows) becomes random. The decision as to
which method should be used then lies with the structure of the data, i.e., whether it is easier
to access S or F in a random fashion. For small problems, all the data fits into memory and
neither method has an advantage. However, as the size of the network increases, it is highly
probable that both F and S will not fit simultaneously into memory, and that segmentation
becomes necessary. For structural problems, the two approaches correspond to generating the
structural stiffness matrix row-by-row, or an element at a time. In the matrix analysis class,
we always teach the element at a time approach to assemble the structure stiffness as it is most
easily visualized and does not require construction of the LINK and IPT data structures. However, the row-by-row method has strong advantages to assemble the stiffness matrix directly
in sparse format without storage of zeros.

GENERATING THE LINK & IPT VECTORS


Most software using network representations of physical models require that the user input
the NODE array directly, i.e., for each branch list the nodes on which the branch is connected.
The procedure to generate the one-dimensional version of the LINK and IPT data structures is
fairly complex and is described further below.

CEE-490, CSE-491 Class Notes

Network Processing

The LINK vector contains entries in a specific sequence. For example, all of the branches
attached to node 1 appear first, followed by the branches attached to node 2, etc... Note that
there is no specific ordering for the branches attached to a node (this is not required in most
applications). Thus, to know where to place the branches for node 2 in LINK, it is first necessary to know how many branches are attached to node 1. To store the branches for node 3, we
must know how many branches are attached to nodes 1 and 2 etc...
Several ways exist to determine the number of branches attached to node 1. We could scan
each entry in NODE, counting all appearance of 1 entries. Repeating this for each node in
succession determines the KOUNT vector indicated in the previously shown, 2-dimensional
form of LINK. Unfortunately, this approach requires nn complete scans (or passes) over the
NODE array. Each pass finds only a few useful numbers. For a large network, this approach
requires a very large amount of not very useful memory accesses and comparisons.
A better way to develop the KOUNT vector is: 1) initialize it to zero, 2) pickup each entry
in NODE and increment the corresponding row in KOUNT. After one pass over NODE, the
KOUNT vector is complete. From KOUNT we can determine the starting position in LINK
for each node. The following sketches show the sequence of data structures.

NODE
1
2
3

4
3

5
4

KOUNT
1
2
3

3
2

TIPT
1
2
3

1
2
3

4
6

IPT

LINK

1
4
6

6
-7
9

num_pipes
num_nodes

num_nodes+1

num_nodes+1

2*num_pipes

Let TIPT define a temporary vector such that TIPT(i)=the starting position in LINK of
the entries for node i+1. The code to build TIPT is as follows.
tipt(1) = kount(1) + 1;
for( node=2; node<=num_nodes; node++ )
tipt(node) = tipt(node-1) + kount(node);
tipt(num_nodes+1) = tipt(num_nodes);

CEE-490, CSE-491 Class Notes

Network Processing

Given the TIPT vector, the following code segment generates LINK. TIPT is converted
to IPT in the process. Study this carefully with reference to the figure showing the sequence
building data structures.
for( node_column=1; node_column<=2; node_column++ )
{
for( pipe=1; pipe<=num_pipes; pipe++ )
{
if( node_column == 2 )
pipe_id = -pipe;
else
pipe_id = pipe;
now_node = node(pipe,node_column);
--tipt(now_node);
link(tipt(now_node)) = pipe_id;
}
}

When all branches are processed, the TIPT vector will have been converted to the final
form, IPT.
A function is normally employed to perform the above computations. A suitable calling sequence for such a function is
int linkup( vector <int> &link, array <int> &node, int num_pipes,
int num_nodes, vector <int> &ipt) )

The remaining data structures are dynamically allocated inside the function via the vector
class, used and deleted before returning. The algorithm is summarized with this steps:
S

dynamically allocate and zero KOUNT(num_nodes)

generate KOUNT

dynamically allocate TIPT(num_nodes+1)

generate TIPT using KOUNT; release KOUNT

generate LINK and transform TIPT as in code fragment above

copy TIPT into IPT

release TIPT and return

CEE-490, CSE-491 Class Notes

10

You might also like