Semirings for Social Networks Analysis
Vladimir Batagelj
Department of Mathematics, University of Ljubljana
Jadranska 19, 61 111 Ljubljana, Slovenia
E–mail: VLADIMIR.BATAGELJ@UNI-LJ.SI
Abstract
In the paper four semirings for solving social networks problems are constructed.
The closures of the matrix of a given signed graph over balance and cluster semirings
can be used to decide whether the graph is balanced or clusterable.
The closure of relational matrix over geodetic semiring contains for every pair of vertices ✁ and ✂ the length and the number of ✁ -✂ geodesics; and for geosetic semiring the
length and the set of vertices on ✁ -✂ geodesics. The algorithms for computing the geodetic
and the geosetic closure matrix are also given.
Key words : balanced signed graphs, clusterable signed graphs, closed semirings, closure,
geodesic, Freeman’s centrality indices, Boyle’s operation.
Math. Subj. Class. (1991) : 05 C 50, 05 C 12, 05 C 75, 16 Y 60, 68 R 10, 92 H 30
There ✄✆are
several applications of semirings in social networks analysis. For example, the
☎✞✝✠✟☛✡☞✟✍✌✎✟✑✏✓✒✔✟✖✕✘✗✚✙✛✟✖✕✢✜✤✣✠✥
can be applied to determine the connectedness
matrix [19,
p.
semiring
✄✆☎✞✝✠✟✧✦★✟✧✩✪✒✔✟✖✕✘✗✚✙✫✟✖✕✢✜✤✣✠✥✬✟✭✝✯✮✰✦✱✮✰✩
✦
✩
133]. Similar semiring
( 0 – no link, – uniplex links, –
multiplex links) can be used to analyse the connectivity of social networks [12].
In this paper we shall construct four new semirings for solving social networks analysis
problems:
✲
balance and cluster semirings which can be used to decide whether the graph is balanced
or clusterable;
✦
✲
✴
✲
geodetic
semiring to determine for every pair of vertices and ✳ the length and the number
✦
of -✳ geodesics;
geosetic
semiring for computing Boyle’s operation
– to determine for every pair of ver✦
✦
tices and ✳ the length and the set of vertices on -✳ geodesics.
Supported in part by the Ministry of Science and Technology of Slovenia.
1
1 Semirings
An algebraic structure
✄✶✵✷✟✍✸✹✟✻✺✤✟✑✝✎✟✻✡✚✥
✵
on the set
✲
✄✶✵✷✟✍✸✹✟✑✝✼✥
✲
✄✶✵✷✟✻✺✤✟☛✡✚✥
✲
multiplication distributes over addition
✝
is an abelian monoid with neutral element (zero);
✡
is a monoid with neutral element (unit);
✺
✺✓✄✶✾❂✸❃✿❄✥❆❅
✽
is a semiring [1, 5, 6, 22] iff:
✽
✺✚✾❇✸
✺✚✿
✽
✗❈✣❊❉
✸
✄
✽
; for all ✽
✟✖✾✚✟✖✿❁❀✪✵
✸❋✾❄✥❇✺✚✿●❅
✺❍✿❆✸❋✾■✺✚✿
✽
In the expressions we assume precedence of multiplication over addition.
✄❏✵❑✟✍✸✹✟✻✺▲✟✑✝✠✟✻✡❍✥
is complete iff the addition is well-defined also for countable sets
The semiring
of elements and the (generalized) commutativity, associativity (for addition) and distributivity
hold also in this case.
❀▼✵
✸
❅
✵
If the addition is idempotent, for every ✽
:✽
✽
✽ , the semiring over a finite set
is complete.
✄✶✵❑✟✑✸✯✟☛✺✤✟❖◆P✟✑✝✠✟✻✡❍✥
◆
The ❀✪
semiring
is closed iff for the (unary) closure operation it holds for
✵
every ✽
◆ ❅◗✡■✸
◆ ✺
✺ ◆ ❅◗✡■✸
✽
✽
✽
✽
✽
There can exist different closures over the same semiring.
The complete semiring is always closed for the closure defined by
◆ ❅
✽
❚
❙❘
✽
❚✖❯❊❱
In the sequel we shall refer by the term closure to the operation defined by this expression. In a
closed semiring we can define also a strict closure ✽ by
Suppose that for a given graph ❲
value function
❅
✺ ◆
✽
✽ ✽
❅❳✄❩❨❆✟✑❬❭✥✍✟●❬❫❪❴❨❴❵❛❨
and a semiring
✄✶✵❑✟✑✸✯✟☛✺✤✟✑✝✠✟☛✡✚✥
a
❜✢❝ ❬❡❞❢✵
is given.
❅
❱ ✟ ✳✼❤ ✟ ✳✞✐ ✟✻❥✻❥✻❥❄✟ ✳✬❦❍❧✛❤ ✟ ✳✬❦ is a walk of length ♠ on ❲ iff
❣
✳
A
finite
sequence
of
vertices
❬
✟✖♦P❅◗✡☞✟✻❥✻❥☛❥❄✟
❬
❬
✟✖♦P❅s✡☞✟☛❥✻❥✻❥☛✟
on ❲ iff ✳♣♥✤❧✛❤ ✳✚♥✔qr✳✚♥ ✳✞♥▲❧✛❤
✳✞♥✤❧✛❤ ✳✞♥
♠ ; and is a semiwalk or chain
♠ . The
❅
❱
(semi)walk is closed iff its ends coincide, ✳
✳❄❦ . A walk in which no vertex appears twice is
called a path; and if only its ends coincide
it is called a cycle.
❜
We can extend the value function to walks and sets of walks on ❲ by
✲
let t✚✉ be a null walk in the vertex ✳
✲
✲
❅
✟
✟
✟✻❥✻❥✻❥❄✟
❀✈❨
then
✟
❜ ✄
t♣✉
✥❆❅◗✡
✳ ❤ ✳♣✐
✳❄❦✻❧✛❤ ❄✳ ❦ be a walk of length ♠①✇
let ❣ ❜ ✳ ❱ ✔
✄ ✭
✥ ❅ ❜ ✄ ❱ ✟ ✥❇✺ ❜ ✄ ✟ ✥②❥☛❥✻❥ ❜ ✄
✟ ✥
❣
✳ ✔
✳ ❤
✳✔❤ ♣
✳ ✐
✳✬❦✻❧✛❤ ✳✬❦
for the empty set of walks ③ we have
❜ ✄ ✭
✥ ❅④✝
③
2
✡
on ❲ then
✲
❅s☎
let ⑤ ❜
✄
✟ ✻✟ ❥✻❥✻❥⑦✒
be a set of walks on ❲
❣ ❤ ✫
⑥
❣ ✐
✥✭❅ ❜ ✄ ⑧
✥ ✸ ❜ ✄ ✥⑧✸⑨❥✻❥☛❥
⑤
❣⑥❤
❣ ✐
✫
then
✦
❦
◆
⑩
We denote by ⑤ ⑩ ✉ the
✦ set of all walks of length ♠ from vertex to vertex ✳ ; by ⑤ ✉ the set of all
✳ ; and by ⑤ ⑩ ✉ the set of all nontrivial (different from t ⑩ ) walks
walks from vertex
to
vertex
✦
from vertex to vertex ✳ .
The value matrix of a graph is a matrix ❶ defined by
❶▼❷
✦❸✟
❜ ❼✄ ✄✶✦❸✟ ✥✧✥
✳
✝
❅❻❺
✳✼❹
✄✶✦❸✟ ✥■❀✈❬
❽❈❾✖❿❊✳ ➀❄➁❼➂●✜▲➃✧➀
❀✪✵
In the following we shall assume that in the semiring for every ✽
✺✚✝✷❅➄✝❭✺
✽
✽
❅④✝
❨s❅◗☎
✟
✟✻❥☛❥✻❥❄✟
◆ ❅
❚
❙❘
❶
❚✖❯❊❱
✒
holds and that the set of vertices is finite
✳✎❤ ✳♣✐
✳✞➅ . Then the addition and multiplication can be extended in the usual way to square matrices of order ➆ which themselves form a
semiring.
The matrix semiring over complete semiring is also complete and therefore closed for
❶
There are two well known theorems [1, 6, 22] connecting values of walks in graphs and their
matrices:
THEOREM 1. Let ❶
THEOREM 2. Let ❶
closure matrix then
❦
be the ♠ -th power of value matrix ❶
❜ ✄
❦ ✥✭❅
⑤ ⑩ ✉
❶
✦ ✟
❦ ❸
❷ ✳✼❹
be a value matrix over complete semiring, ❶
❜ ✄
◆ ✥➇❅
⑤ ⑩ ✉
❶
◆ ❸
✦ ✟
❷ ✳✼❹
and
◆
❜ ✄
To compute the closure matrix ❶ of a given matrix ❶
we can use the Fletcher’s algorithm [14]:
➊ ❱
then
❝❅
⑤ ⑩ ✉
✥❆❅
❶➈❷
◆
its closure and ❶
✦❸✟
✳✼❹
over a complete semiring
❝ ❅s
❶ ✡;
for ➋ ♦ ❝ ❅s
to✡ ➆ do begin ❝ s
❅ ✡
for ✿ ♦✧✟ to
to♦❼➆ ✟ do✺✓✶✄ ✿
❝ ❅④
➆ ✿ do for
➌
✟ ✥➎◆➏✺✚✿ ❚
✟
❚ ❷ ❝ ➌☞❹
❚ ❧✛❤✬❷ ♦✧✟ ➌☞❹ ✸❋✿ ❚ ✛
❚ ✛
❧ ❤✍❷ ➋✓❹
❧ ❤✍❷➍➋ ➋✓❹
❧✛❤✬❷➍➋ ➌✼❹ ;
✿ ❚ ✟
❅◗✡■✸❃✿ ❚ ✟
❷➉➋ ➋✓❹
❷➉➋ ➋✔❹ ;
end;
◆ ❝❅ ➊
❶
➅ ;
3
its strict
✄❏✵❑✟✍✸✹✟✻✺▲✟✑✝✠✟✻✡❈✟➉◆②✥
✿
❝
✟
❅❫✡➐✸➄✿
✟
❚ ❷➉➋ ➋✔❹ we obtain the algorithm for computing the
If we delete the statement ❚ ❷➍➋ ➋✓❹
strict closure ❶ .
If the addition is idempotent we can by this algorithm compute the closure matrix in place
➊
– we omit the subscripts in matrices .
There is a bijection between semiwalks on graph ❲ and walks in the graph ❲ ➑ which is the
sum of the graph ❲ and its inverse – graph ❲ with reversed directions of its arcs. We have
✄
❶
✥✭❅
❲➑
✄
❶
❲
✥⑧✸
❶
✄
❲
✥➓➒
➒
where ❶
denotes the transpose of matrix ❶ . Let us define the symmetric closure of the value
matrix by
❅→✄
✸
➒②✥ ◆
❶①➔
❶
❶
2 Balance and cluster semirings
2.1 Balanced and clusterable signed graphs
✄
✟✖➣⑧✥
A signed graph is an ordered pair ❲
❅
✄↔❨✭✟✑❬❭✥
❲
❬◗❪⑨❨↕❵➙❨
✲
➣
✲
❝
❬④❞
☎
♠
where
is a directed graph (without loops) with set of vertices
❨
and set of arcs
✟
;
➆
✒
is a sign function. The arcs with the sign ♠ are positive
and the arcs with
❬✷➛
the sign ➆ are negative.
We
denote
the
set
of
all
positive
arcs
by
and
the set of all
❬ ❧
negative arcs by
.
The case when the graph is undirected can be reduced to the case of directed graph by replacing
each edge ➜ by a pair of opposite arcs both signed with the sign of the edge ➜ .
The signed graphs were introduced in [18] and later studied✄ by✟✖several
authors [7, 8, 10, 11,
➣❸✥
19, 20, 21]. Following Roberts [21, pp. 75–77] a signed graph ❲
is:
❨
✲
✲
balanced iff the set of vertices can be partitioned into two subsets so that every positive
arc joins vertices of the same subset and every negative arc joins vertices of different
subsets.
❨
clusterable iff the set of can be partitioned into subsets, called clusters, so that every
positive arc joins vertices of the same subset and every negative arc joins vertices of
different subsets.
The (semi)walk on the signed graph is positive iff it contains an even number of negative arcs;
otherwise it is negative.
The balanced and clusterable signed graphs are characterised by the following theorems
[9, 10, 19, 20, 21].
✄
THEOREM 3. A signed graph ❲
✄
✟✖➣❸✥
THEOREM 4. A signed graph ❲
exactly one negative arc.
✟✧➣❸✥
is balanced iff every closed semiwalk is positive.
is clusterable iff ❲
4
contains no closed semiwalk with
Table 1: Balance semiring
✸
✺
0
0
0
➆
➆
♠
➆
♠
✽
➆
♠
✽
➆
✽
✽
0
✽
♠
✽
✽
✽
➆
♠
✽
✽
◆
0
0
0
0
0
♠
✽
✽
➝
➆
♠
0
0
♠
0
➆
➆
➝
✽
0
✽
➆
♠
✽
✽
✽
♠
✽
♠
✽
♠
✽
✽
Table 2: Cluster semiring
✸
✺
0
0
0
➆
➆
♠
➆
♠
✽
➞
➆
♠
✽
➞
➆
✽
♠
✽
✽
✽
➞
✽
➆
♠
0
➆
✽
✽
➞
✽
♠
➆
♠
✽
♠
✽
✽
✽
◆
0
0
0
0
0
0
➞
➞
➝
➆
♠
✽
0
➞
0
➆
➆
0
0
➞
✽
✽
➞
0
➆
♠
➆
➝
➞
➆
➞
✽
➞
✽
♠
♠
✽
➞
➞
♠
➞
✽
➞
♠
2.2 Balance and cluster semirings
✵
To construct a semiring corresponding to the balance problem we take the set
elements [11, 19]:
with four
✝
no walk;
all walks are negative;
all walks are positive;
at least one positive and at least one negative walk.
➆
♠
✽
Now it is easy to produce the Cayley tables for balance semiring (see Table 1). The balance
semiring is idempotent closed semiring with zero and unit .
For construction of the cluster semiring corresponding to the clusterability problem we need
the set with five elements:
✝
♠
✵
✝
➆
♠
✽
➞
no walk;
at least one walk with exactly one negative arc;
no walk with only positive arcs;
at least one walk with only positive arcs;
no walk with exactly one negative arc;
at least one walk with only positive arcs;
at least one walk with exactly one negative arc;
each walk has at least two negative arcs.
The Cayley tables for cluster semiring are given in Table 2. The cluster semiring is idempotent
closed semiring with zero and unit .
✝
♠
Combining the Theorem 2 with Theorems 3 and 4 we get.
5
➟8
.
.
..
....
.
.
.
.
9 ➟ ....
➟7
...
.
.
. .... ......
.
.
.
. . .
... ..... .......➟
.
.
...
6
...
...
...
.
.
...
...
...
...
.
.
.
...
.
.
.
➟ 5
...
..
1 ➟ ..
.
.
.
... ......
....
.
.
.
.... ...
... ....
.... ....
. ..
➟ ...
➟
➟ ......
2
3
4
1
2
3
4
5
6
7
8
9
1
0
2
➆
0
0
♠
0
♠
0
0
0
♠
0
♠
♠
0
0
0
3
0
➆
➆
0
0
4
0
0
5
0
0
♠
0
0
0
0
0
0
6
0
0
0
0
♠
➆
0
➆
0
➆
0
0
7
0
➆
0
➆
0
♠
0
♠
0
0
0
8
0
0
0
0
0
0
➆
0
➆
0
0
0
0
0
♠
0
♠
0
♠
0
♠
9
♠
➆
0
➆
Figure 1: Chartrand’s example – graph
✄
✟✖➣❸✥
THEOREM 3’. A signed graph ❲
is balanced iff the diagonal of its balance-closure matrix
❶ ➔➠ contains only elements with value ♠ .
✄
✟✖➣⑧✥
THEOREM 4’. A signed graph ❲
is clusterable iff the diagonal of its cluster-closure
matrix ❶ ➔➡ contains only elements with value ♠ .
The balance-closure matrix of balanced signed graph contains no element with value ✽ ,
since in this case the corresponding diagonal elements should also have value ✽ . Similary the
cluster-closure matrix of clusterable signed graph contains no element with value ✽ .
A block is a maximal set of vertices with equal lines in matrix ❶ ➔ .
In balance-closure of balanced signed graph and in cluster-closure of clusterable signed
graph all the entries between vertices of two blocks have the same value. The value of entries
between vertices of the same block is ♠ .
In both cases different partitions of the set of vertices correspond to the (nonequivalent)
colorings of the graph with blocks as vertices in which there is an edge between two vertices iff
the entries between the corresponding blocks in matrix ❶ ➔ have value ➆ .
There is another way to test the clusterability of a given signed graph:
✄
THEOREM 4”. A signed graph
❲
✄✆☎✞✝✎✟✻✡❈✒✔✟
is computed in the semiring
q
✟✖➣❸✥
is clusterable iff
✟✍➤➏✟✑✝✠✟☛✡✚✥
.
✄❩❬
➛ ✥
➔P➢
❬
❧
This form of the Theorem 4 is interesting
because the intersection
✄
✟✖➣❸✥
arcs which prevent the signed graph ❲
to be clusterable.
❅
③
✄❩❬
, where the closure ➔
➛ ✥
➔❂➢
❬
❧
consists of
2.3 Examples
EXAMPLE 1. In Figure 1 the graph from [9, page 181] and its value matrix are given. The
positive edges are drawn with solid lines, and the negative edges with dotted lines.
6
1
2
3
4
5
6
7
8
9
1
2
3
4
5
6
7
8
9
✽
✽
✽
✽
✽
✽
✽
✽
✽
✽
✽
✽
✽
✽
✽
✽
✽
✽
✽
✽
✽
✽
✽
✽
✽
✽
✽
✽
✽
✽
✽
✽
✽
✽
✽
✽
✽
✽
✽
✽
✽
✽
✽
✽
✽
✽
✽
✽
✽
✽
✽
✽
✽
✽
✽
✽
✽
✽
✽
✽
✽
✽
✽
✽
✽
✽
✽
✽
✽
✽
✽
✽
✽
✽
✽
✽
✽
✽
✽
1
p
1
2
3
4
5
6
7
8
9
✽
✽
➆
➆
➆
2
➆
p
p
p
p
p
p
p
p
p
➆
➆
➆
➆
➆
➆
➆
➆
➆
➆
➆
➆
5
p
6
p
➆
➆
9
p
➆
➆
➆
➆
➆
➆
➆
➆
➆
➆
➆
7
➆
p
8
➆
➆
➆
p
p
➆
➆
➆
4
➆
p
p
p
3
➆
➆
➆
➆
➆
➆
p
p
➆
➆
p
➆
➆
p
p
➆
p
p
➆
p
p
➆
➆
➆
p
Table 3: Chartrand’s example – closures
u
w
y
v
x
z
Figure 2: Roberts’s example – graph
On the left side of Table 3 the corresponding balance-closure is given – the graph is not
balanced. From the cluster-closure on the right side of Table 3 we can see that the graph is
clusterable and it has the clusters
❨
❤
❅➥☎✔✡☞✟✑➦✎✟✑➧✠✟✑➨✓✒✔✟
❨
✐
❅s☎♣✌✎✟✑✏✠✟✧➩✠✒✔✟
❨✫➫➭❅s☎♣➯✎✟✑➲✓✒
EXAMPLE 2. The signed graph from [21, page 77, exercise 16] is presented in Figure 2, and its
value matrix on the left side of Table 4. In this case the balance-closure and the cluster-closure
are equal (right side of Table 4). The corresponding partition is
❨
❤
❅s☎ ✟ ➝ ✟✧➳➵✒✔✟
✳
❨
7
✐
❅s☎✚✦❸✟✖➸✷✟✑➺✎✒
u
0
u
v
w
x
y
z
v w
0 ♠
0 0
0 0
0
♠
0 0
0 0
➆
0
0
0
0
x
y
0
0
➆
0
➆
z
0
0
0
➆
0
0
0
0
♠
➆
u
v
w
x
y
z
♠
➆
0
u
p
w
p
y
➆
v
➆
x
➆
z
p
➆
p
➆
p
p
➆
p
➆
p
➆
➆
p
➆
➆
➆
p
p
p
p
➆
➆
p
p
p
➆
p
➆
➆
p
➆
Table 4: Roberts’s example – value matrix and its closure
3 Geodetic semiring
3.1 Construction of geodetic semiring
Another example of a semiring we found reading the book [17, p. 34-38, 111-112]. In 1977
Freeman introduced the centrality index of a vertex based on betweenness [15, 16]:
➻
➠
❙
✄➽➼❼✥✭❅
❙
⑩
➆ ⑩✚➾ ✉
✄➽➼❼✥
➆ ⑩✚➾ ✉
✉
✦
✄➽➼❼✥
where ➆ ⑩✚➾ ✉ is the✦ number of geodesics from
vertex to vertex ✳ ; and ➆ ⑩❍➾ ✉
is the number of
➼
geodesics from to ✳ that
contain
vertex
.
✄➽➼❼✥
➻
For computing ➠
he proposed the methods given in Harary, Norman, Cartwright [19, p.
134-141].
✄➽➼❼✥
➻
Here we present an alternative approach to computing ➠
. Suppose that we know a
matrix
❜
✄
✟
✥
❷
❜
⑩❍➾ ✉
➆ ⑩❍➾ ✉
✦
where ⑩✚➾ ✉ is the length of ✄➽➼❼✥ -✳ geodesics and
also easy to determine ➆ ⑩❍➾ ✉ :
⑩ ➾✉
➆ ❍
✄
❜
✟
➆ ⑩❍➾ ➚
✝
✄❏➼❼✥❆❅❻❺
✺
⑩ ➾✉
➆ ❍
❹
✦
is the number of -✳ geodesics. Then it is
❜
➆ ➚➪➾ ✉
⑩❍➾ ➚
❜
✸
➚➪➾ ✉
❜
❅
⑩❍➾ ✉
otherwise
✥
Matrix ❷ ⑩❍➾ ✉ ➆ ⑩❍➾ ✉ ❹ can be obtained by computing the closure of relation matrix over the
❜
following geodetic semiring. ❬
❅
✄ ✟ ✥
➆ ⑩✚➾ ✉✑❹ which has for entries pairs defined
First we transform relation to a matrix R ❷
by
✄✆✡☞✟✻✡✚✥
✄❏✦★✟ ✥➭❀✪❬
✄
❜
✟
➆
✥
⑩❍➾ ✉
❅❻❺
✄❩➶④✟✑✝✼✥
✄❏✦★✟
❜
✳
✳
✥❭✪
➹❀ ❬
where is the✵➄
length
of
path and
➆ is the number of shortest paths.
➛ a shortest
❅→✄
☎♣➶➄✒♣✥➭❵➷✄
☎♣➶➄✒♣✥
➴
❱
➘
➘
IR
IN
we define two operations: addition:
In the set
✄
♦
✽
✟✖♦➎✥⑧➬➮✄❩✾❍✟
➌
✥✭❅➱✄✶✕✢✜✤✣②✄
✽
✟✑✾✬✥✍✟➭❒ ✃❐
❐❮
♦➵✸
8
➌
✮❰✾
➌
✽
❅④✾
✽
✽✢Ï
✥
✾
and multiplication:
✄ ✖✟ ♦➓✥❸Ð❡✄✶✾❍✟ ✥➇❅→✄ ✸❋✾❍✟✖♦⑧✺ ✥
✽
➌
✽
➌
✄✶✵✷✟✍➬✯✟✍Ð✷✥
✄❩➶④✟✑✝✼✥
✄❩✝✠✟✻✡❍✥
It is easy to verify that
is indeed a semiring with zero
and identity
.
The verifications of semiring properties are straightforward. We present only the less trivial
verifications of associativity of addition and of distributivity:
Associativity:
✄✧✄ ✟✖♦➓✥⑧➬❡✄✶✾❍✟ ✥✧✥⑧➬➮✄❩✿✚✟ ✥✭❅→✄ ✟✖♦➓✥⑧➬➮✄❼✄❩✾❍✟ ✥⑧➬❡✄✶✿✞✟ ✥✧✥
Since the addition
➬
✽
➌
➋
✽
➌
is commutative we can assume that ✽➴Ñ
case
Ó✷ß▼Ø❄ÔÜØ■ß➈Ú➇àáÓ❑ß➙Ú
Ó✷ß▼Ø❄ÔÜØ✭âÞÚ➇àáÓ❑ß➙Ú
Ó✷ß▼Ø❄ÔÜØ■å➈Ú
Óæâ❛Ø❄ÔÜØ■ß➈Ú➇àáÓ❑ß➙Ú
Óæâ❛Ø❄ÔÜØ✭âÞÚ
Óæâ❛Ø❄ÔÜØ■å➈Ú
Ò➓Ò➪Ó✎Ô➓Õ↔Ö➵×➷Ò➽Ø✬Ô✶Ù❈Ö➓Ö➵×❛Ò➪Ú☛ÔÜÛ✔Ö
Ò➪Ó✓Ô➓Õ↔ÖÝ×ÞÒ➪Ú☛ÔÜÛ✔Ö★â❰Ò➪Ó✎Ô➓Õ↔Ö
Ò➪Ó✓Ô➓Õ↔ÖÝ×ÞÒ➪Ú☛ÔÜÛ✔Ö★â❰Ò➪Ó✎Ô➓Õ↔Ö
Ò➪Ó✓Ô➓Õ↔ÖÝ×ÞÒ➪Ú☛ÔÜÛ✔Ö
Ò➪Ó✓Ô➓Õ✛ãçÙ♣Ö✫×➷Ò➪Ú❄ÔÜÛ✔ÖPâ❰Ò➪Ó✎Ô➓Õ❊ãçÙ❈Ö
Ò➪Ó✓Ô➓Õ✛ãçÙ♣Ö✫×➷Ò➪Ú❄ÔÜÛ✔ÖPâ❰Ò➪Ó✎Ô➓Õ❊ãçÙ➏ã✈Û✔Ö
Ò➪Ó✓Ô➓Õ✛ãçÙ♣Ö✫×➷Ò➪Ú❄ÔÜÛ✔ÖPâ❰Ò➪Ú☛ÔÜÛ✔Ö
✾
➋
.
Ò➪Ó✎Ô➓Õ↔Ö✫×➷Ò➓Ò➽Ø✬Ô✶Ù❈ÖÝ×ÞÒ➪Ú☛ÔÜÛ✔Ö➓Ö
Ò➪Ó✓Ô➓Õ➎Ö✫×❛Ò➽Ø❄Ô✶Ù♣ÖPâ❰Ò➪Ó✓Ô➓Õ➎Ö
Ò➪Ó✓Ô➓Õ➎Ö✫×❛Ò➽Ø❄Ô✶Ùäã✈Û✔Ö❸â✰Ò➪Ó✎Ô➓Õ↔Ö
Ò➪Ó✓Ô➓Õ➎Ö✫×❛Ò➪Ú☛ÔÜÛ✔Ö
Ò➪Ó✓Ô➓Õ➎Ö✫×❛Ò➽Ø❄Ô✶Ù♣ÖPâ❰Ò➪Ó✓Ô➓Õ✫ãrÙ♣Ö
Ò➪Ó✓Ô➓Õ➎Ö✫×❛Ò➽Ø❄Ô✶Ùäã✈Û✔Ö❸â✰Ò➪Ó✎Ô➓Õ✛ãçÙ➏ã✪Û✔Ö
Ò➪Ó✓Ô➓Õ➎Ö✫×❛Ò➪Ú☛ÔÜÛ✔Ö★â❰Ò➪Ú☛ÔÜÛ✔Ö
From the table we can see that in all possible cases➬ the value of the left side term equals the
value of the right side term. Therefore the addition is associative.
Distributivity:
✄ ✖✟ ♦➎✥⑧Ð❡✄✧✄✶✾❍✟ ✥⑧➬➮✄❩✿✚✟ ✥✧✥✭❅→✄ ✖✟ ♦➓✥⑧Ð➮✄✶✾❍✟ ✥⑧➬➮✄ ✟✖♦➓✥⑧Ð④✄❩✿✚✟ ✥
✽
➌
➋
✽
➌
✽
➋
➬
✾
✿
Because of the commutativity of the addition , we can assume that Ñ . We obtain for the
left side term
✄ ✖✟ ♦➓✥⑧Ð➮✄❼✄❩✾❍✟ ✥⑧➬➮✄❩✿✚✟ ✥❼✥✭❅→✄ ✟✧♦➓✥❸Ð❡✄❩✾❍✟ ❺
✽
➌
➋
✽
➌ ✸
➌
✾è✮❰✿
✾ä❅④✿
➋
✥❆❅→✄
✽
✸❃✾❍✟✖♦❸✺ ❺
➌ ✸
➌
➋
✾❁✮✰✿
✾●❅➄✿
✥
and for the right side term
✄ ✖✟ ♦➓✥⑧Ð➮✄✶✾✚✟ ✥⑧➬➮✄ ✟✖♦➓✥⑧Ð❡✄✶✿✞✟ ✥❆❅→✄ ✸❃✾❍✟✖♦❸✺ ✥⑧➬➮✄ ✸❃✿✚✟✖♦⑧✺ ✥✭❅➱✄ ✸❃✾❍✟❈❺
✽
➌
✽
➋
✽
➌
✽
➋
✽
♦⑧✺
♦ ✺ ➌ ❋
⑧
✸ ♦❸✺
➌
➋
We get the same value
sides. Therefore the distributivity holds.
✄✶✵❑✟✑➬éon
✟✍Ðêboth
✥
The semiring
is also complete and closed, with a closure
✄ ✖✟ ♦➎✥ ◆ ❅ë❺
✽
✄✶✝✠✟✍➶❰✥
✄✶✝✠✟✻✡✚✥
✽
❅➄✝✠✟✖♦➐❅⑨
ì ✝
otherwise
This can be easily verified
✄❩✝✎✟✻✡✚✥⑥➬❡✄ ✖✟ ♦➓✥❸Ð❡✄ ✟✧♦➓✥ ◆
✽
✽
❅
❅
✄❩✝✎✟✻✡✚✥⑥➬➮✄
❅
✸
✟✧♦★✺☛♦ ✥
◆
✽ ◆
✄✶✝✠✟✍➶❰✥
✄❩✝✎✟✻✡✚✥⑥➬ ❒ ❐✃ ✄✶✝✠✟✑✝✼✥
✄ ✸
✟✖♦⑧✺❍♦ ✥
◆
❮❐ ✽
✽ ◆
✄✶✝✠✟✍➶❰✥
❅➄✝✠✟✖♦➐❅⑨
ì ✝
❺
✽
✄✶✝✠✟✻✡✚✥
✽
otherwise
9
❅
✸
✽ ✸
✽ ✸
✽
❅➄✝✠✟✧♦í❅⑨
ì ✝
✽ ◆ ➄
❅ ✝✠✟✧♦❇❅⑨✝
✽ ◆
✝
✽ ◆ Ï
✄ ✟✧♦➓✥ ◆
✽
✾è✮✰✿
✾ä❅➄✿
✥
2ø î
û
4
ï
ïð
ï î
ï
ñ
ö
óô ö
î ö÷ ô
ô
ô
ô
6
ñ
ñ
ô
î
ñ
ïð
ô ï
ô
3
ö î
ö
ö ñ
ñ❼ò
û❴ü
ó
î
ö ❴
ù 5ú
ö
ô ö ö
ô
ö
ô
ö
ô
ñ
ö
ö
ö
óô ö ö
î ö÷ ô
ù
1
ô ô➎õ
ï î
ï
ó
7
ô ô➎õ
8
ñ❼ò
Figure 3: Example graph
✡
✡
✌
✏
➩
➦
➧
➯
➲
✌
✏
➩
✄✆✡☞✟✻✡✚✥
✄❩✌✎✟✍✌☞✥
✄↔✌✓✟✍✌☞✥❢✄❩✏✎✟✖➩✔✥❢✄❩✏✎✟✖➩✔✥❢✄✶➩✠✟✑➲✼✥
✄↔➶④✟✑✝✼✥❢✄❏➩❊✟✖➩✔✥❢✄❩➶④✟✑✝✼✥❢✄✆✡☞✟✻✡✚✥
✄Ü✡❈✟✻✡✚✥❢✄↔✌✓✟✍✌☞✥❢✄↔✌✓✟✍✌☞✥❢✄❩✏✎✟✖➩✔✥
✄↔➶④✟✑✝✼✥❢✄❏➩❊✟✖➩✔✥❢✄❩➶④✟✑✝✼✥❢✄✆✡☞✟✻✡✚✥
✄Ü✡❈✟✻✡✚✥❢✄↔✌✓✟✍✌☞✥❢✄↔✌✓✟✍✌☞✥❢✄❩✏✎✟✖➩✔✥
✄↔➶④✟✑✝✼✥❢✄✶✏✠✟✍✌☞✥❢✄❩➶④✟✑✝✼✥❢✄❏➩❊✟✍✌☞✥
✄✶➩✠✟✍✌☞✥❢✄Ü✡❈✟✻✡✚✥❢✄Ü✡❈✟✻✡✚✥❢✄↔✌✓✟✍✌☞✥
✄↔➶④✟✑✝✼✥❢✄✶✏✠✟✍✌☞✥❢✄❩➶④✟✑✝✼✥❢✄❏➩❊✟✍✌☞✥
✄Ü✡❈✟✻✡✚✥❢✄Ü✡❈✟✻✡✚✥❢✄Ü✡❈✟✻✡✚✥❢✄↔✌✓✟✍✌☞✥
✄↔➶④✟✑✝✼✥❢✄❩✌✎✟✻✡✚✥❢✄❩➶④✟✑✝✼✥❢✄✶✏✠✟✻✡✚✥
✄❩✏✎✟✻✡✚✥❢✄✶➩✠✟✍✌☞✥❢✄✶➩✠✟✍✌☞✥❢✄Ü✡❈✟✻✡✚✥
✄↔➶④✟✑✝✼✥❢✄❩✌✎✟✻✡✚✥❢✄❩➶④✟✑✝✼✥❢✄✶✏✠✟✻✡✚✥
✄❩✏✎✟✻✡✚✥❢✄✶➩✠✟✍✌☞✥❢✄✶➩✠✟✍✌☞✥❢✄Ü✡❈✟✻✡✚✥
✄↔➶④✟✑✝✼✥❢✄✆✡☞✟✻✡✚✥❢✄❩➶④✟✑✝✼✥❢✄❩✌✎✟✻✡✚✥
✄↔✌✓✟✻✡✚✥❢✄❩✏✎✟✍✌☞✥❢✄❩✏✎✟✍✌☞✥❢✄✶➩✠✟✖➩✔✥
✄↔➶④✟✑✝✼✥❢✄✆✡☞✟✻✡✚✥
➦
➧
➯
➲
Table 5: Geodetic closure
✄
✟✖♦➓✥
✝
✵
➛
A semiring element ✽
is positive iff ✽✘Ï . The set
of all positive elements is closed for
addition and multiplication. Note also that for positive elements the absorbtion property
✄❩✝✠✟☛✡✚✥⑥➬➮✄
✽
✟✖♦➎✥✭❅➱✄❩✝✎✟✻✡✚✥
holds.
3.2 Algorithm and example
✄
❜
✟✑✿❄✥
⑩❍➾ ✉ be the entry of the strict closure ý
Let ❜
of✦ relation matrix R over geodetic semiring.
Then
equals
to
the
length
of
a
shortest
nontrivial
-✳ path (a geodesic or a shortest cycle), and
✿
✦
equals to the number of different -✳ geodesics.
Using this algorithm we obtained for a graph represented in Figure 3. the strict geodetic
closure presented in Table 5.
To adapt the Fletcher’s algorithm for computing the strict geodetic closure we have to consider some properties of geodetic semiring. By the construction all entries of the relation ma-
10
trix
follows
✿ ❚ R ✟ are positive.
✄✶✿ ❚
✟ From
✥↔◆ the description of Fletcher’s ✄❩algorithm
✿❚
✟ ✥↔it◆➐❅→
✄❩✝✠✟✻✡❍✥ that also the entry
and we can omit it
❧✛❤✍❷➍➋ ➋✓❹ in ❧✛❤✬❷➍➋ ➋✓❹ is always positive. Therefore ❧✛❤✬❷➍➋ ➋✓❹
from the expression. A detailed analysis of the algorithm shows that we can compute the strict
➊
geodetic closure matrix in place – we omit the subscripts in matrices .
Representing the relation matrix R (and its geodetic closure) by two matrices: the shortest
➊
paths length matrix ❶ and the geodesics count matrix , we obtain the following adapted
version of Fletcher’s algorithm for computing the strict geodetic closure:
❝ ❅s✡
to✡ ➆ do begin ❝ ❅s✡
for ➋ ♦ ❝ ❅s
for ❜✓þ ➼ ❝ ❅➄to
❜ ➆ ✟ do✥ begin
✕✢✜✤➆ ✣②do
✄❩✾✑♦❩ÿ➵for
✟ ❜ ➌ ♦✧✟ ✸ to
❜ ♦❼✟
❜✓þ ➼
❷ ➋✓❹
❷➍➋ ➌☞❹ ;
if ❷ ✿ ➌☞➼ ❹❸❝ ❅④
✇ ✿ ♦✧✟ then✿ begin
✟
➆ ❜ ♦❼✟ ❷❅ ➋✓❜ ❹✁þ ➼ ❷➍➋ ➌☞✿ ❹ ; ♦✧✟ ❝ ❅④✿ ♦❼✟ ✸❃✿ ➼
❷ ➌☞✿ ❹ ➼✄✂ ❜ ♦❼❷ ✟ ➌☞❹ ❝ ❅ ❜✓➆ þ ➼
if ❷ ➌☞❹
✿ then
♦❼✟ ❝ ❅④
➆
❷ ➌☞❹
else begin ❷ ➌☞❹
end;
end;
end;
end;
The constant
✾✑♦❩ÿ
in the algorithm is a number representing the infinity
➶
.
4 Semiring for Boyle’s operation
4.1 Construction of geosetic semiring
In [4, 13] Boyle introduced the operation
✦
➭✳
❅
❨
set of vertices of a graph ❲ that belong to the shortest paths from
❅→✄↔❨✭✟✑❬❭✥✍✟
❬s❪⑨❨↕❵➙❨
✦
to ✳
over the set of vertices of a graph ❲
.
This operation has several interesting properties. For example:
✦
✦ ➭✳✆❅ ☎ ➸
➭✳
✦
➼✞✝
➼✠✝
➼
✦ ➼
✳✟✟✖✦❸✟✖➸✷
☎ ✟✧➼
,
✳
belong to the same cycle.
But, it is not associative. Nevertheless it is possible to embed it into a semiring in the following
way.
We start with quadruples of the form
✄✶✦❸✟☛ä
✡ ✟ ✟ ✥
✳ ♠
✦❛❀ ❨
❀❃❨
✡❴❪➱❨
with the interpretation:
– initial vertex, ✳
– terminal vertex,
vertices
✦
❀
☎✚✦❸✟ – ✒➙
❪☞✡ on
✳
the✮✍shortest
–✳ paths, ♠
IN – length of these paths.✄✶✦❸We
also
and
✌✻✗❈➁❼❉✎✡
✟☛☎✚✦⑧✒✔require
✟✖✦❸✟✑✝✼✥✍✟✖✦ç
❀➙❨ that
♠
. Quadruples with length 0 are of the form
. ❀
✏
We build the geosetic semiring over the set ✏ of finite sets of quadruples ✑
❅s☎ ✒✔✟
❅➱✄❏✦ ✟☛✡ ✟ ✟ ✥
✑
✽☞♥
✽✼♥
♥ ♥ ✳✚♥ ♠❊♥
11
which also satisfy the requirement that no pair of quadruples in ✑ has the same initial and
terminal vertices
✦
❅➄✦✓❂
✒ ➤
❅
✒ ✝❢♦❇❅
✔
♥
✳✞♥
✳
➌
Let us first consider one element sets
❅s☎
✑
✒✔✟
✽
❅➱✄✶✦❸☛
✟ ✡ä✟
✽
We can define addition as follows:
☎✎✄✶✦❸☛
✟ ✡
❒ ✃❐❐❐
➬✗✕➙❅
✑
✕✑
❐❐
✖é✟
➘
✥
♠
✟
✳
✕✈❅➥☎✞✾❍✒✔✟❇✾ä❅➱✄❏➸❑✟☛é
✖ ✟✧➼✍✟
✗♣✣❊❉
✥✑✒
♠
➘
➞
✮
➞
✕
✘
❅
♠
♠
✑
❐❮
✟
✳
✮
➞
❐✙ ✟❇✦r❅➄➸❑✟
✚❐
♠
➞
✥
❅⑨➼
✳
otherwise
✕➷❅
☎
✟✑✾✻✒
✽
Note that in the last case ✑ ➘
which is not a one element set so that the addition is
not closed over one element sets. To extend it to ✏ we first introduce the operation of reduction
Red ✑ , which from an arbitrary finite set of quadruples, ✑ , eliminates multiple occurrences of
quadruples with the same initial and terminal vertices. It is defined by
❅
Red ✑
❷
✄
✑✜✛
☎
✟
✽☞♥
✒✻✒♣✥
✽
➘
✄✆☎
✽☞♥
✒ä➬⑨☎
✒❍✒♣✥✬✟✖♦✭✮
✽
➌✼❹
or in a procedural form
❝
✕
❅
✑
✂
❝
♦✧✟
while ✢ ❝ ❅✥➌ ✕
Red ✑
✄✶♦➐ì❅
➌
➤
✦
✦✁✒❇➤
♥
❅
✳✚♥
❅
✳
✒❄✥
do
❝
✕
❅➱✄✣✕
☎
✛
✽☞♥
✟
✽
✒✻✒♣✥
➘
✄➓☎
✽✼♥
✒ä➬
☎
✒❍✒♣✥✤✂
✽
❀
✏ . Now it is easy to extend the addition to ✏ .
Evidently✟✦Red
✕▼❀ ✑
✏ then
Let ✑
➬✍✪
✕ ❅
✄
✕P✥
✑
Red ✑ ➘
✄
✏
✟✍➬é★
✟ ✧➭✥
is an idempotent Abelian monoid (semilattice) [3].
A neutral element for the addition is the empty set ③ which can also be represented by a
special element
✧❛❅➥☎✎✄✪✩✬✟ ✟☛✩✬✟✍➶❰✥✑✒
③
✩
where
represents a ”joker”-vertex, which matchs
any vertex. We could base the introduction
✧
✄✪✫❇✟✄✬✼✥
of also on the
theorem
that every semigroup
without a✭
neutral element can be extended
✄✪✫
☎ ✒✔✟☛✬✠✟ ✥
➹❀ ✫
➝ ❀
➘
❝
➜
➜
➜
✮
to
a
monoid
by
addition
of
a
new
element
satisfying
the
relation
✫
☎ ✒
✬ ➝ ❅ ➝ ✬ ❅ ➝
➘
➜
➜
➜
.
❅
☎✎✄✶✦❸☛
✟ ✡ä✟ ✟ ✥✑✒
✕❛❅
and
Now
we
can
also
define
the
multiplication
of
one
element
sets
✑
✳ ♠
☎✎✄✶➸❑✟✯✢
✖ ✟✧➼✍✟ ✥✑✒
:
➞
✑
Ð✰✕✈❅
❒ ❐❐❐
❐
✃❐❐
✕✑
☎✎✄✶✦❸✟☛✡
❐❐❮
❐❐
❐❐
✧
➘
✖é✟✧➼✍✟
♠
♠
✸
➞
✥✍✒
✘
❅④✝
➞
✦
❅➄✝
⑨
ì❅ ➼✍✟✱✡
✦r❅⑨➼✍✟✱✡
otherwise
12
➢
➢
✖➥❅➥☎
✖➥❅➥☎
✳
✳
✒
❐❐
❐✙
✟✖✦⑧✒✳✲
✳
➹❀
☎✚✦❸✟✧➼✑✒
✚ ❐❐❐
✳
❅➄➸
v=w
v=w
z
Q
P
t
u
Q
P
t
u
a
b
Figure 4: Geosetic multiplication
✕
Ð ✕
✑ ✴
✧
This definition needs some explanation. The
is different from only if
➸ product
coincide (see Figure 4a). Assume
that
the❀ ➹ terminal
vertex
☎✚✦❸✟✧➼✑✒
✦Þ❅⑨
ì ➼ ✳ of and the intial
➺é❀ vertex ☎ of
✒
✦ ➼
. If
and there exists ✦ ➼ ➢
✳
✳ then there also exists a shorter - path on
➘
(see
➺✷❅⑨Figure
✦
➺❑4b).
❅ ➼ Therefore the - paths through ✳ are not geodesics. This also covers
the case
or
. For example
✡
✑
✖
✞✡ ✖ ✛
☎✎✄✶✦❸✟☛☎✚✦❸✟ ➝ ✟ ✔
✒ ✟ ✟✑✌☞✥✍✒➇Ð
✳
✳
✵✧
☎✎✄ ☛✟ ☎ ✟✖➳➵✟✖✦❸✟✧➼✑✒✔✟✧➼✍✟✑✏✼✥✑✒➐❅
✳
✳
Other cases are dealt with similarly.
We extend the multiplication to by
✏
Ð ✕✈❅
✶ ☎✽
✑ ✍
✷☛✸✺❈✹ ➾ ✻✼✸✺✽
Since for
✄✏
✏
✄
t
✒➏Ð➄☎✞✾✻✒
❅➥☎✎✄ ❄✟ ☎ ✔
✒ ✟ ✟✖✝✼✥ ❝ ❀✈❨é✒
✳
✳
✳
✳
Ð
✟✍Ðé✟ ✥
➬
is
a
monoid
and
the
multiplication
distributes
over
the
addition
, the structure
t
✟✍➬é✟✑Ðé✟ ➐✟ ✥
t is an idempotent semiring; and since is finite it is also a complete semiring.
✾✧
✏
✧
The neutral element for addition is an absorptive element for multiplication – a zero: for
✑ ❀ ✏ we have
✧✈Ð ✑ ❅ ✑ Ð✰❛
✧ ❅✵✧
❅s☎✎✄❏✦★✟✯●
✡ ✟ ✳ ✟ ♠ ✥✍✒✔✟ ♠①Ï ✝ that
From the definition of multiplication it follows for ✑
✑ ✐ ❅ ✑ Ð ✑ ❅✿✧
❚ ❅✵➐
✧ ✟ ➋ ✇ ✌ and
Therefore, in this case, ✑
✑ ◆ ❅❀❚ ✶ ✸ ✑ ❚ ❅ t ➬ ✑
❅á☎✎✄ ✟☛ä
✡ ✟ ✳ ✟ ♠ ✥✑✒ (used in Fletcher’s algorithm) we have
✳
In the case
element” ✑
◆●❅ of a➬ “diagonal
❅
t
✑ t.
further ✑
IN
13
û❴ü
❑
❁
❁
❁
ó ❁❂ ❁
î ❃❅ ❃
❇❈ ❇ ❅
ù❴ú
✽
❁ î ❋■
❅
❅
❇
❃
❇
❅ ❅✪❆ î
❇
❋
ÿ
❋ î●❋
ó
î
❃ ❃✪❄
❃
❋
❏
❋
✾
ó
➜
❉
❇ ó ❉❊ ❉
î❜
❉
❉
❋
❉
❉
❋✪❍
❉ø î
❉
✿
Figure 5: Example graph
✄
✽
✾
✿
❜
➜
❑
ÿ
✽
✄
✄
③
✽
✾
✟✻✡❍✥
✟✑➶❰✥
❜
✿
✄
✾❍✟✻✡✚✥
✽
✄✶✾✬✿ ❑ ✟✖✏✼✥
✄
✟✑➶❰✥
✄✶✾✬✿ ❑ ✟✑✌☞✥
③
❜
✄ ✟✑➶❰✥
✄✶✾ ❑ ✟✍✌☞✥
③
❜
✄ ✟✑➶❰✥❢✄❩✾
❑ ✟✑✏✼✥
③
➜
✄ ✟✑➶❰✥
✄❩✾ ❑ ✟✻✡✚✥
③
✄ ÿ➵✟✻✡❍✥
✄ ✾✖ÿ➵✟✍✌☞✥
✽
✽
✾✍✿ ❑ ✟✍✌☞✥
✽
✄
✄✶✾✍✿✞✟✻✡❍✥
✽
✄❩✿ ❑
❜
✄❩✿ ❑
❜
✄✶✿
➜
✄❩✿ ❑
✾✍✿
✄❩✿
❜
✄✶✿
❑ ✟✖✏✼✥
✟✻✡✚✥
✄❩✿
❜➜
✟✍✌☞✥
✟☛✡✚✥
❑ ✟✑✏✼✥
✟✻✡✚✥
❜ ➜
✄✶✿
✄✶✿✍ÿ➵✟✻✡✚✥
❜ ➜
❜ ➜
✄
❑ ✟✖✏✼✥
❜ ➜
✄✶✾✬✿
✟✍✌☞✥
✟✑✌☞✥
❜
❑ ✟✍✌☞✥
ÿ➵✟✍✌❈✥
✄
✾
✽
➜
➜
ÿ
❑
❑ ✟✍✌❈✥
✄✶✾ ✻
✟ ✡✚✥
➜
✄❩✿ ❑ ✍
✟ ✌❈✥
❜ ➜
✄
❑ ✟✍✌❈✥
❜ ➜
✄
❑ ✟✑✏☞✥
➜
✄ ❑ ✟☛✡✚✥
➜
✄ ✾✍✿ ❑ ÿ➵✟✑✏☞✥❢✄
✽
➜
✄
❑ ✟☛✡✚✥
✽
✄❩✾✍✿ ❑ ✍
✟ ✌❈✥
✄
✄
✄❩✿ ❑ ✻
✟ ✡❍✥
❜
✄ ❑ ✟✻✚
✡ ✥
❜
✄
✍
✟
✌☞✥
❑
➜
✄❩✿ ❑ ✟✍✌❈✥
✽
✿ ❑ ÿÝ✟✑✌☞✥❢✄
✟✍➶❰✥
③
✟✍➶❰✥
③
✄
✟✍➶❰✥
③
✄
✟✍➶❰✥
③
✄
✟✍➶❰✥
✄
③
✟✍➶❰✥
③
③
✟✍➶❰✥
Table 6: Geosetic closure
4.2 Algorithm and example
This semiring can be used to compute Cayley’s table of Boyle’s operation for a given network
by computing a strict closure of ❬ a relation matrix over
it.
❅
✄✣✡●✟ ✥
❷
♠ ⑩❍➾ ✉✖❹ which has for the entries pairs
First we transform relation to a matrix R
defined by
✄✆☎✚✦❸✟ ✒✔✟✻✡✚✥
✄✶✦❸✟ ✥➭❀✈❬
✄✪✡ä✟
✡
♠
✥
⑩❍➾ ✉
❅ë❺
✄
③
✳
✟✍➶❰✥
✦
✄✶✦❸✟
✳
✳
✥❭✈
➹❀ ❬
where is the set of vertices on the shortest -✳ paths and ♠ is their length.
Since
the✟ addition
is idempotent we can apply the Fletcher’s algorithm [14] in place. The
✄✶✿
✥↔◆➐❅
❚
❧✛❤✬❷➍➋ ➋✓❹
t and therefore it can be omitted.
term
Representing the relation matrix R (and its strict closure) by two matrices: the matrix ▲ of
sets of vertices on the shortest paths, and the shortest paths lengths matrix ❶ , we obtain the
following adapted version of Fletcher’s algorithm:
14
❝ ❅s✡
for ➋ ♦ ❝ ❅s
to✡ ➆ do begin ❝ ❅s✡
to ➆ do begin
for ♦ ❝ ❅ to
þ ♦✧➆ ✟ do for
þ ➌✟
♠ ➞✄ ♦
❷ ♦ ➋✓✥❆❹▼❅ ❷➉➋ ➌☞❹ ;
if ♠ ✦ ➞❖◆⑨❝ ❅ ❷ ❹ þ ♦✧✟ ❷➍➋✔❹✸ then
þ ✟ begin
♠ ❜✓þ ➼ ➞ ❝ ❅ ❜ ❷ ♦✧✟ ➋✓❹ ✸ ❜ ❷➍➋ ✟ ➌☞❹ ;
➋ þ❹ ➼
❷➍➋ þ➌☞❹ ♦✧;✟ ❝ ❅ þ ♦✧✟ ✸ ✦
❜ ♦❼✟ ❅ ❷ ❜✓
❜✓þ ➼ ❷ ➌☞❹
❷ ➌☞❹ ♠ ➞
if ❷ ➌☞❜ ❹ ♦✧✟
then
else if ❷ þ ➌☞❹❸♦❼✟ Ï ❝ ❅ then
✦ ✂ ❜ ♦✧✟ ❝ ❅ ❜✎þ ➼
♠ ➞
❷ ➌✼❹
begin ❷ ➌☞❹
end;
end;
end;
end;
✸
Note, for sets in pascal denotes the union ➘ , and denotes the intersection ➢ .
Using this algorithm we obtained for a graph represented in Figure 5 a strict geosetic closure
presented in Table 6.
5 Conclusion
In the paper four semirings for solving social networks analysis problems were constructed.
For balance and cluster semirings Fletcher’s algorithm for computing the closure of a network
matrix can be applied directly; and for geodetic and geosetic semirings we have adapted versions of Fletcher’s algorithm. The algorithm for geodetic closure is more efficient than the
usual Harary, Norman, Cartwright algorithm [19]. We do not know any other algorithm for
computing Cayley’s table of Boyle’s operation (geosetic closure).
The embedding technique used in the construction of a geosetic semiring can be used also
as a general framework for path problems in valued graphs.
References
[1] A. V. Aho, J. E. Hopcroft, J. D. Ullman, The Design and Analysis of Computer Algorithms. Addison-Wesley, Reading, Massachusetts (1976).
[2] Batagelj V., “Signed Graphs and Closed Semirings.” Network Seminar, Department of
Sociology, University of Pittsburgh, December 1990, manuscript.
[3] Batagelj V., “Use of Mathematica in verifying the algebraic structure axioms – semirings.”
In preparation.
[4] Boyle R.: “Algebraic systems for normal and hierarchical sociograms.” Sociometry 32
(1969), 91-111.
[5] R.E. Burkard, R.A. Cuninghame-Greene, U. Zimmermann, eds., Algebraic and Combinatorial Methods in Operations Research. Annals of Discrete Mathematics 19 (1984).
[6] B. Carré, Graphs and Networks. Clarendon, Oxford (1979).
15
[7] D. Cartwright, F. Harary, On the coloring of signed graphs. Elemente der Mathematik
23(1968), pp. 85-89.
[8] D. Cartwright, F. Harary, Balance and Clusterability: An Overview, Holland P.W., Leinhardt S. (eds.) Perspectives on Social Network Research, Academic Press, New York
(1979), pp. 25-50.
[9] G. Chartrand, Introductory Graph Theory. Dover, New York (1985).
[10] J. A. Davis, “Clustering and structural balance in graphs.” Human Relations, 20(1967),
pp. 181-187.
[11] P. Doreian, Mathematics and the study of social relations. Weidenfeld and Nicolson, London (1970).
[12] P. Doreian, “On the connectivity of social networks.” Journal of Mathematical Sociology
3(1974), 248.
[13] Everett M. G.: “A graph theoretic blocking procedure for social networks”. Social networks 4 (1982), 147-167.
[14] J. G. Fletcher, “A more general algorithm for computing closed semiring costs between
vertices of a directed graph,” CACM (1980), pp. 350-351.
[15] L. C. Freeman, “Centrality in social networks: Conceptual clarification.” Social Networks,
1(1978/79), 215-239.
[16] R. V. Gould, “Measures of betweenness in non-symmetric networks. Social Networks,
9(1987), 277-282.
[17] P. Hage P., F. Harary F., Structural models in anthropology. Cambridge University Press,
Cambridge (1983).
[18] F. Harary, “On the notion of balance in signed graphs”. Michigan Mathematical Journal
(1953) 2, pp. 143-146.
[19] F. Harary, R. Z. Norman, D. Cartwright, Structural Models: An Introduction to the Theory
of Directed Graphs. John Wiley & Sons, New York (1965).
[20] J. E. Riley, “An application of graph theory to social psychology.” The Many Facets of
Graph Theory, Lecture Notes in Mathematics, 110, (G. Chartrand and S. F. Kapoor, eds.).
Springer-Verlag, Berlin (1969), pp. 275-280.
[21] F. S. Roberts, Discrete Mathematical Models. Prentice-Hall, Englewood Cliffs, New Jersey (1976).
[22] U. Zimmermann, Linear and Combinatorial Optimization in Ordered Algebraic Structures. Annals of Discrete Mathematics 10 (1981).
16