Next Article in Journal
Managing Human Factors to Reduce Organisational Risk in Industry
Previous Article in Journal
Fractal Behavior of a Ternary 4-Point Rational Interpolation Subdivision Scheme
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Metrics for Single-Edged Graphs over a Fixed Set of Vertices

1
School of Mathematics and Statistics, Baise University, Baise 533000, China
2
School of Mathematics and Finance, Putian University, Putian 351100, China
Math. Comput. Appl. 2018, 23(4), 66; https://doi.org/10.3390/mca23040066
Submission received: 28 August 2018 / Revised: 21 October 2018 / Accepted: 21 October 2018 / Published: 24 October 2018

Abstract

:
Graphs have powerful representations of all kinds of theoretical or experimental mathematical objects. A technique to measure the distance between graphs has become an important issue. In this article, we show how to define distance functions measuring the distance between graphs with directed edges over a fixed set of named and unnamed vertices, respectively. Furthermore, we show how to implement these distance functions via computational matrix operations.
MSC:
68R10; 05C05; 90B10; 62H30

1. Introduction

When investigating the measurement of the distances between two sentences or structures, we feel it is necessary to first form a system to measure the distance for tree or graph structures. This was our initial motivation for developing this paper. This will provide a sound foundation and measurement technique for future applications. For example, if there are two separate English sentences, such as S 1 and S 2 , and we would like to measure the distance between these two sentences, we identify S 1 with one graph and S 2 with another graph. Their vocabularies in individual sentences can be associated with vertices in the graph. The distance between the vocabularies can be identified with edges of the graphs. Then, we would have constructed graphs for S 1 and S 2 . We would then be able to measure the distance between the two graphs. The main purpose of this article is to put forward an approach to define a metric for graphs on a fixed set of vertices.
Suppose V is a set of fixed vertices and E is a set of directed edges. Then, for each edge ( v , w ) , i.e., an edge from v to w, one can assign a value. Since most of the mathematical models can be formalized or represented via vertices and edges, studying the properties of the distances between any two graphs becomes a vital approach to explore the intrinsic properties of a mathematical structure or a real mathematical object [1,2], even being used on some fuzzy objects [3,4]. Some ingenious metrics for handling these fuzzy objects have been explored in depth [5,6]. In this article, we put forward two metrics for graphs with labelled vertices and unlabelled vertices, respectively. Nonetheless, we only consider the directed edges in this article. As for the indirected edges, one can simply treat them as pairs of two directed edges.

2. Definitions and Claims

We use R + to denote all the positive real numbers. For any real number α , we use | α | to denote its absolute value. For any set K, we use P ( K ) and | K | to denote the power set and the size of K, respectively. If both H and K are sets, we use H K to denote the set of all the functions from H to K. We use H K to denote ( H K ) ( K H ) (or H K K H ). We call G = ( V , E , W : E R + ) or in brevity G = ( V , E , W ) a generalized graph, in which W is a weight function satisfying following conditions:
  • For each v V [ ( v , v ) E and W ( v , v ) = 0 ] ;
  • For all ( v 1 , v 2 ) E [ v 1 v 2 W ( v 1 , v 2 ) > 0 ] .
Definition 1.
Let G G ( V ) denote the set of all the generalized graphs whose vertex sets are exactly V.
Let G 1 = ( V , E 1 , W 1 : E 1 R + ) , G 2 = ( V , E 2 , W 2 : E 2 R + ) , G 3 = ( V , E 3 , W 3 : E 3 R + ) G G ( V ) be arbitrary generalized graphs. For any G = ( V , E , W : E R + ) G G ( V ) and any a V , we use E ( a ) to denote the set of all the endpoints beginning from a, i.e.,
E ( a ) = { b V : ( a , b ) E } .
Furthermore, define the set of all the assigned values of E ( a ) as follows:
W ( a ) = { W ( a , b ) : b E ( a ) } .

3. Metric for Labelled Graphs

In this section, we assume all the vertices in V are labelled. We show how to define a distance between G 1 and G 2 as follows:
Definition 2.
(distance function: labelled vertices, single directed edge) Define d 1 : G G ( V ) × G G ( V ) R + by
d 1 ( G 1 , G 2 ) : = a V [ c E 1 ( a ) E 2 ( a ) W 1 ( a , c ) + c E 2 ( a ) E 1 ( a ) W 2 ( a , c ) + c E 1 ( a ) E 2 ( a ) | W 1 ( a , c ) W 2 ( a , c ) | ] .
Example 1.
Suppose V = { v 1 , v 2 , v 3 } is a fixed set of vertices and graph G 1 = ( V , E 1 , W 1 ) , and G 2 = ( V , E 2 , W 2 ) , where their vertices assigned to the edges E 1 , E 2 and the values for weights W 1 , W 2 are given as follows:
E 1 = { ( v 1 , v 2 ) , ( v 1 , v 3 ) , ( v 3 , v 1 ) , ( v 3 , v 2 ) } , E 2 = { ( v 1 , v 2 ) , ( v 2 , v 1 ) , ( v 2 , v 3 ) , ( v 3 , v 2 ) , ( v 3 , v 1 ) } , W 1 ( v 1 , v 2 ) = 4 , W 1 ( v 1 , v 3 ) = 3 , W 1 ( v 3 , v 1 ) = 1 , W 1 ( v 3 , v 2 ) = 7 , W 2 ( v 1 , v 2 ) = 3 , W 2 ( v 2 , v 1 ) = 5 , W 2 ( v 2 , v 3 ) = 3 , W 2 ( v 3 , v 2 ) = 4 , W 2 ( v 3 , v 1 ) = 6 .
Then, the end vertices originating from v 1 via edges in E 1 could be depicted as E 1 ( v 1 ) = { v 2 , v 3 } . Others follow:
E 2 ( v 1 ) = { v 2 } , E 1 ( v 2 ) = , E 2 ( v 2 ) = { v 1 , v 3 } , E 1 ( v 3 ) = { v 1 , v 2 } , E 2 ( v 3 ) = { v 1 , v 2 } .
Henceforth, by Definition 1, one could compute the distance for G 1 and G 2 as follows: d 1 ( G 1 , G 2 ) =
c E 1 ( v 1 ) E 2 ( v 1 ) W 1 ( v 1 , c ) + c E 2 ( v 1 ) E 1 ( v 1 ) W 2 ( v 1 , c ) + c E 1 ( v 1 ) E 2 ( v 1 ) | W 1 ( v 1 , c ) W 2 ( v 1 , c ) | + c E 1 ( v 2 ) E 2 ( v 2 ) W 1 ( v 2 , c ) + c E 2 ( v 2 ) E 1 ( v 2 ) W 2 ( v 2 , c ) + c E 1 ( v 2 ) E 2 ( v 2 ) | W 1 ( v 2 , c ) W 2 ( v 2 , c ) | + c E 1 ( v 3 ) E 2 ( v 3 ) W 1 ( v 3 , c ) + c E 2 ( v 3 ) E 1 ( v 3 ) W 2 ( v 3 , c ) + c E 1 ( v 3 ) E 2 ( v 3 ) | W 1 ( v 3 , c ) W 2 ( v 3 , c ) | = [ W 1 ( v 1 , v 3 ) + 0 + | W 1 ( v 1 , v 2 ) W 2 ( v 1 , v 2 ) | ] + [ 0 + W 2 ( v 2 , v 1 ) + W 2 ( v 2 , v 3 ) + 0 ] + [ 0 + 0 + | W 1 ( v 3 , v 1 ) W 2 ( v 3 , v 1 ) | + | W 1 ( v 3 , v 2 ) W 2 ( v 3 , v 2 ) | ] = [ 3 + 0 + 1 ] + [ 0 + 5 + 3 + 0 ] + [ 0 + 0 + 5 + 3 ] = 20 .
Hence we have the result that the distance for G 1 and G 2 is 20 by metric d 1 .
Claim 1.
For all a V , one has
[ ( E 1 ( a ) E 2 ( a ) ) ( E 1 ( a ) E 2 ( a ) ) ] [ ( E 2 ( a ) E 3 ( a ) ) ( E 2 ( a ) E 3 ( a ) ) ] [ ( E 1 ( a ) E 3 ( a ) ) ( E 1 ( a ) E 3 ( a ) ) ] .
Proof. 
It follows immediately from the fact that
( E 1 ( a ) E 2 ( a ) ) ( E 2 ( a ) E 3 ( a ) ) ( E 1 ( a ) E 3 ( a ) ) .
 □
Claim 2.
(semi-metric)
1. 
d 1 ( G 1 , G 2 ) 0 ;
2. 
d 1 ( G 1 , G 2 ) = d 1 ( G 2 , G 1 ) ;
3. 
d 1 ( G 1 , G 2 ) = 0 iff G 1 = G 2 .
Proof. 
By the definition, the first and second statements follow immediately. Here we show the third statement. Suppose G 1 = G 2 . Then,
d 1 ( G 1 , G 2 ) = a V [ c E 1 ( a ) E 2 ( a ) | W 1 ( a , c ) W 2 ( a , c ) | ] = 0 .
On the other hand, if d 1 ( G 1 , G 2 ) = 0 , then a V [ E 1 ( a ) = E 2 ( a ) ] and W 1 = W 2 , i.e., G 1 = G 2 .  □
From above inferences, if one allows W ( v , w ) = 0 for some v w , then d 1 ( G 1 , G 2 ) = 0 G 1 = G 2 might not hold in some particular G 1 and G 2 . Similarly, if one allows W ( v , v ) = 0 , then for all v V [ ( v , v ) E ] is a requirement.
Theorem 1.
( G G ( V ) , = , d 1 ) is a metric space.
Proof. 
Since we have shown in Claim (2) that d 1 is a semi-metric, it suffices to show d 1 satisfies the triangle property:
d 1 ( G 1 , G 2 ) + d 1 ( G 2 , G 3 ) d 1 ( G 1 , G 3 ) .
On the basis of Claim (1), we have the following inferences. Let a V be arbitrary. Firstly, if c E 1 ( a ) E 3 ( a ) , then c E 1 ( a ) E 2 ( a ) or c E 1 ( a ) E 2 ( a ) . If c E 1 ( a ) E 2 ( a ) , then it preserves the inequality of Equation (2). If c E 1 ( a ) E 2 ( a ) , then c E 2 ( a ) E 3 ( a ) , i.e.,
c E 1 ( a ) E 2 ( a ) and c E 2 ( a ) E 3 ( a ) .
It follows that
| W 1 ( a , c ) W 2 ( a , c ) | + W 2 ( a , c ) W 1 ( a , c ) ,
i.e., the inequality of Equation (2) is preserved. Secondly, if c E 3 ( a ) E 1 ( a ) , by the same analogy, the inequality of Equation (2) is also preserved. Lastly, if c E 1 ( a ) E 3 ( a ) , then [ c E 1 ( a ) E 2 ( a ) or c E 1 ( a ) E 2 ( a ) ] and [ c E 3 ( a ) E 2 ( a ) or c E 2 ( a ) E 3 ( a ) ], i.e.,
c E 1 ( a ) E 2 ( a ) and c E 3 ( a ) E 2 ( a )
or
c E 1 ( a ) E 2 ( a ) and c E 2 ( a ) E 3 ( a ) .
It follows that
W 1 ( a , c ) + W 3 ( a , c ) | W 1 ( a , c ) W 3 ( a , c ) | ,
| W 1 ( a , c ) W 2 ( a , c ) | + | W 2 ( a , c ) W 3 ( a , c ) | | W 1 ( a , c ) W 3 ( a , c ) | .
Hence, we have shown
c E 1 ( a ) E 2 ( a ) W 1 ( a , c ) + c E 2 ( a ) E 1 ( a ) W 2 ( a , c ) + c E 1 ( a ) E 2 ( a ) | W 1 ( a , c ) W 2 ( a , c ) |
+ c E 2 ( a ) E 3 ( a ) W 2 ( a , c ) + c E 3 ( a ) E 2 ( a ) W 3 ( a , c ) + c E 2 ( a ) E 3 ( a ) | W 2 ( a , c ) W 3 ( a , c ) |
c E 1 ( a ) E 3 ( a ) W 1 ( a , c ) + c E 3 ( a ) E 1 ( a ) W 3 ( a , c ) + c E 1 ( a ) E 3 ( a ) | W 1 ( a , c ) W 3 ( a , c ) | ,
and this completes our proof of Equation (2).  □

4. Metric for Unlabelled Graphs

In this section, we show how to define a distance between graphs with unlabelled vertices. Let V be a set of distinct unlabelled vertices with | V | = n . Let G G ( V ) be the set of generalized graphs whose vertex set is V . First of all, we show how to formalize unlabelled graphs. Let M = { m 1 , m 2 , , m n } be a set of dummy vertices for V . Then, each G G G ( V ) could be modeled via this set of dummy vertices as G = ( M , E M , W M ) . Let G 1 = ( M , E M 1 , W M 1 ) , G 2 = ( M , E M 2 , W M 2 ) G G ( V ) be arbitrary. Let N = { v 1 , v 2 , , v n } be a set of names. Now fix the domain M and assign each dummy vertex a name via a naming function ρ : M N . Let M N denote the set of all the naming functions. Now each unlabelled graph G could be formalized via naming functions as follows:
G = { ( ρ ( M ) , E ρ ( M ) , W ρ ( M ) ) : ρ M N } ,
where ρ ( M ) = { ρ ( m ) : m M } ; E ρ ( M ) and W ρ ( M ) denote the named edges and weights via ρ for E M and W M , respectively. G 1 and G 2 could be formalized as
G 1 = { { ( ρ ( M ) , E ρ ( M ) 1 , W ρ ( M ) 1 ) } : ρ M N } ,
G 2 = { { ( ρ ( M ) , E ρ ( M ) 2 , W ρ ( M ) 2 ) } : ρ M N } .
Since the modeling of unlabelled graph is not unique, we define an equivalence relation on G G ( V ) .
Definition 3.
G 1 G 2 iff ρ 1 , ρ 2 M N such that ( ρ 1 ( M ) , E ρ 1 ( M ) 1 , W ρ 1 ( M ) 1 ) = ( ρ 2 ( M ) , E ρ 2 ( M ) 2 , W ρ 2 ( M ) 2 ) .
Example 2.
Let M = { m 1 , m 2 , m 3 } , N = { v 1 , v 2 , v 3 } . Then, (in a corresponding form) M N consists of
ρ 1 m 1 m 2 m 3 v 1 v 2 v 3 , ρ 2 m 1 m 2 m 3 v 1 v 3 v 2 , ρ 3 m 1 m 2 m 3 v 2 v 1 v 3 , ρ 4 m 1 m 2 m 3 v 2 v 3 v 1 , ρ 5 m 1 m 2 m 3 v 3 v 1 v 2 , ρ 6 m 1 m 2 m 3 v 3 v 2 v 1 .
Suppose G 1 = ( M 1 , E M 1 , W M 1 ) , G 2 = ( M 2 , E M 2 , W M 2 ) , where
E M 1 = { ( m 1 , m 2 ) , ( m 2 , m 1 ) , ( m 2 , m 3 ) , ( m 3 , m 1 ) } E M 2 = { ( m 2 , m 3 ) , ( m 3 , m 2 ) , ( m 3 , m 1 ) , ( m 1 , m 2 ) } W M 1 ( m 1 , m 2 ) = 8 , W M 1 ( m 2 , m 1 ) = 3 , W M 1 ( m 2 , m 3 ) = 2 , W M 1 ( m 3 , m 1 ) = 4 W M 2 ( m 2 , m 3 ) = 8 , W M 2 ( m 3 , m 2 ) = 3 , W M 2 ( m 3 , m 1 ) = 2 , W M 2 ( m 1 , m 2 ) = 4
Hence G 1 consists of the following elements:
  • ( ρ 1 ( M ) = { v 1 , v 2 , v 3 } , E ρ 1 ( M ) 1 = { ( v 1 , v 2 ) , ( v 2 , v 1 ) , ( v 2 , v 3 ) , ( v 3 , v 1 ) } , W ρ 1 ( M ) 1 = { ( ( v 1 , v 2 ) , 8 ) , ( ( v 2 , v 1 ) , 3 ) , ( ( v 2 , v 3 ) , 2 ) , ( ( v 3 , v 1 ) , 4 ) } )
  • ( ρ 2 ( M ) = { v 1 , v 2 , v 3 } , E ρ 2 ( M ) 1 = { ( v 1 , v 3 ) , ( v 3 , v 1 ) , ( v 3 , v 2 ) , ( v 2 , v 1 ) } , W ρ 2 ( M ) 1 = { ( ( v 1 , v 3 ) , 8 ) , ( ( v 3 , v 1 ) , 3 ) , ( ( v 3 , v 2 ) , 2 ) , ( ( v 2 , v 1 ) , 4 ) } )
  • ( ρ 3 ( M ) = { v 1 , v 2 , v 3 } , E ρ 3 ( M ) 1 = { ( v 2 , v 1 ) , ( v 1 , v 2 ) , ( v 1 , v 3 ) , ( v 3 , v 2 ) } , W ρ 3 ( M ) 1 = { ( ( v 2 , v 1 ) , 8 ) , ( ( v 1 , v 2 ) , 3 ) , ( ( v 1 , v 3 ) , 2 ) , ( ( v 3 , v 2 ) , 4 ) } )
  • ( ρ 4 ( M ) = { v 1 , v 2 , v 3 } , E ρ 4 ( M ) 1 = { ( v 2 , v 3 ) , ( v 3 , v 2 ) , ( v 3 , v 1 ) , ( v 1 , v 2 ) } , W ρ 4 ( M ) 1 = { ( ( v 2 , v 3 ) , 8 ) , ( ( v 3 , v 2 ) , 3 ) , ( ( v 3 , v 1 ) , 2 ) , ( ( v 1 , v 2 ) , 4 ) } )
  • ( ρ 5 ( M ) = { v 1 , v 2 , v 3 } , E ρ 5 ( M ) 1 = { ( v 3 , v 2 ) , ( v 2 , v 3 ) , ( v 2 , v 1 ) , ( v 1 , v 3 ) } , W ρ 5 ( M ) 1 = { ( ( v 3 , v 2 ) , 8 ) , ( ( v 2 , v 3 ) , 3 ) , ( ( v 2 , v 1 ) , 2 ) , ( ( v 1 , v 3 ) , 4 ) } )
  • ( ρ 6 ( M ) = { v 1 , v 2 , v 3 } , E ρ 6 ( M ) 1 = { ( v 3 , v 2 ) , ( v 2 , v 3 ) , ( v 2 , v 1 ) , ( v 1 , v 3 ) } , W ρ 6 ( M ) 1 = { ( ( v 3 , v 2 ) , 8 ) , ( ( v 2 , v 3 ) , 3 ) , ( ( v 2 , v 1 ) , 2 ) , ( ( v 1 , v 3 ) , 4 ) } )
Similarly, one could list all the graphs in G 2 , in particular,
( ρ 3 ( M ) = { v 1 , v 2 , v 3 } , E ρ 3 ( M ) 2 = { ( v 1 , v 3 ) , ( v 3 , v 1 ) , ( v 3 , v 2 ) , ( v 2 , v 1 ) } , W ρ 3 ( M ) 2 = { ( ( v 1 , v 3 ) , 8 ) , ( ( v 3 , v 1 ) , 3 ) , ( ( v 3 , v 2 ) , 2 ) , ( ( v 2 , v 1 ) , 4 ) } ) .
Therefore,
( ρ 2 ( M ) = { v 1 , v 2 , v 3 } , E ρ 2 ( M ) 1 = { ( v 1 , v 3 ) , ( v 3 , v 1 ) , ( v 3 , v 2 ) , ( v 2 , v 1 ) } , W ρ 2 ( M ) 1 = { ( ( v 1 , v 3 ) , 8 ) , ( ( v 3 , v 1 ) , 3 ) , ( ( v 3 , v 2 ) , 2 ) , ( ( v 2 , v 1 ) , 4 ) } ) = ( ρ 3 ( M ) = { v 1 , v 2 , v 3 } , E ρ 3 ( M ) 2 = { ( v 1 , v 3 ) , ( v 3 , v 1 ) , ( v 3 , v 2 ) , ( v 2 , v 1 ) } , W ρ 3 ( M ) 2 = { ( ( v 1 , v 3 ) , 8 ) , ( ( v 3 , v 1 ) , 3 ) , ( ( v 3 , v 2 ) , 2 ) , ( ( v 2 , v 1 ) , 4 ) } ) ,
i.e., G 1 G 2 .
Claim 3.
≡ is an equivalence relation on G G ( V ) .
Proof. 
The result follows immediately from the definition.  □
Definition 4.
(distance function: single edge, unlabelled) Define d 2 : G G ( V ) × G G ( V ) R + by
d 2 ( G 1 , G 2 ) : = m i n { d 1 ( ( ρ ( M ) , E ρ ( M ) 1 , W ρ ( M ) 1 ) , ( η ( M ) , E η ( M ) 2 , W η ( M ) 2 ) ) : ρ , η M N } .
It is obvious that if G 1 G 2 , then d 2 ( G 1 , G 2 ) = 0 . Let us look a simple example that G 1 is not equivalent to G 2 in the following.
Example 3.
Let M = { m 1 , m 2 , m 3 } . Suppose G 1 = ( M , E M 1 , W M 1 ) , G 2 = ( M , E M 2 , W M 2 ) , where
E M 1 = { ( m 1 , m 2 ) , ( m 1 , m 3 ) } E M 2 = { ( m 1 , m 3 ) , ( m 1 , m 2 ) , ( m 2 , m 3 ) } W M 1 ( m 1 , m 2 ) = 4 , W M 1 ( m 1 , m 3 ) = 7 W M 2 ( m 1 , m 3 ) = 3 , W M 2 ( m 1 , m 2 ) = 8 , W M 2 ( m 2 , m 3 ) = 1
Following the same procedures in Example (2), we could gain all the elements of G 1 and G 2 . By measuring the distances of their respective pairs (there are 36 pairs), and by Equation (4), one has the minimal one d 2 ( G 1 , G 2 ) = d 1 ( ( M , E ρ i ( M ) 1 , W ρ i ( M ) 1 ) , ( M , E ρ j ( M ) 2 , W ρ j ( M ) 2 ) ) = | 4 3 | + | 7 8 | + 1 = 3 , where ρ i = m 1 m 2 m 3 v 1 v 2 v 3 and ρ j = m 1 m 2 m 3 v 1 v 3 v 2 .
Claim 4.
d 2 is a semi-metric.
Proof. 
It is obvious that d 2 ( G , G ) 0 and d 2 ( G 1 , G 2 ) = d 2 ( G 2 , G 1 ) . Suppose G 1 G 2 . Then, there exist ρ 1 , ρ 2 M N such that E ρ 1 M 1 = E ρ 2 M 2 and W ρ 1 M 1 = W ρ 2 M 2 , i.e., d 2 ( G 1 , G 2 ) = 0 . On the other hand, suppose d 2 ( G 1 , G 2 ) = 0 . Then, there exist ρ 1 , ρ 2 M N such that
d 1 ( ( ρ 1 ( M ) , E ρ 1 ( M ) 1 , W ρ 1 M 1 ) , ( ρ 2 ( M ) , E ρ 2 ( M ) 2 , W ρ 2 M 2 ) ) = 0 ,
i.e., ( ρ 1 ( M ) , E ρ 1 ( M ) 1 , W ρ 1 M 1 ) = ( ρ 2 ( M ) , E ρ 2 ( M ) 2 , W ρ 2 M 2 ) , i.e., G 1 G 2 .  □
Claim 5.
d 1 ( ( ρ ( M ) , E ρ ( M ) 1 , W ρ ( M ) 1 ) , ( η ( M ) , E η ( M ) 2 , W η ( M ) 2 ) ) = d 1 ( ( ζ ρ ( M ) , E ζ ρ ( M ) 1 , W ζ ρ ( M ) 1 ) , ( ζ η ( M ) , E ζ η ( M ) 2 , W ζ η ( M ) 2 ) .
for all bijective function ζ N N .
Proof. 
It suffices to show
d 1 ( ( V , E 1 , W 1 ) , ( V , E 2 , W 2 ) ) = d 1 ( ( V , E ζ ( V ) 1 , W ζ ( V ) 1 ) , ( V , E ζ ( V ) 2 , W ζ ( V ) 2 )
for all ζ N N , where E ζ ( V ) 1 denotes the relabelled edges via ζ of E 1 and W ζ ( V ) 1 denotes the weight function over the relabelled edges E ζ ( V ) 1 .
Let a V be arbitrary. Suppose
E 1 ( a ) = { a 1 1 , a 2 1 , . . . , a k 1 1 } ,
E 2 ( a ) = { a 1 2 , a 2 2 , . . . , a k 2 2 } .
Then,
E 1 ( ζ ( a ) ) = { ζ ( a 1 1 ) , ζ ( a 2 1 ) , . . . , ζ ( a k 1 1 ) } ,
E 2 ( ζ ( a ) ) = { ζ ( a 1 2 ) , ζ ( a 2 2 ) , . . . , ζ ( a k 2 2 ) } .
Hence, one has
c E 1 ( a ) E 2 ( a ) W 1 ( a , c ) + c E 2 ( a ) E 1 ( a ) W 2 ( a , c ) + c E 1 ( a ) E 2 ( a ) | W 1 ( a , c ) W 2 ( a , c ) |
= c E 1 ( ζ a ) E 2 ( ζ a ) W 1 ( ζ a , ζ c ) + c E 2 ( ζ a ) E 1 ( ζ a ) W 2 ( ζ a , ζ c ) + c E 1 ( ζ a ) E 2 ( ζ a ) | W 1 ( ζ a , ζ c ) W 2 ( ζ a , ζ c ) | ,
where ζ a denotes ζ ( a ) and ζ c denotes ζ ( c ) . Hence, we have shown
d 1 ( ( V , E 1 , W 1 ) , ( V , E 2 , W 2 ) ) = d 1 ( ( V , E ζ ( V ) 1 , W ζ ( V ) 1 ) , ( V , E ζ ( V ) 2 , W ζ ( V ) 2 ) .
 □
Theorem 2.
( G G ( V ) , , d 2 ) is a metric space.
Proof. 
Owing to Claim (4), it suffices to show the triangle transitivity property holds.
d 2 ( G 1 , G 2 ) + d 2 ( G 2 , G 3 ) = d 1 ( ( ρ 1 M , E ρ 1 M 1 , W ρ 1 M 1 ) , ( ρ 2 M , E ρ 2 M 2 , W ρ 2 M 2 ) ) + d 1 ( ( ρ 3 M , E ρ 3 M 2 , W ρ 3 M 2 ) , ( ρ 4 M , E ρ 4 M 3 , W ρ 4 M 3 ) ) ,
where ρ j M denotes ρ j ( M ) . Then, by Claim (5), one has
d 2 ( G 1 , G 2 ) + d 2 ( G 2 , G 3 ) = d 1 ( ( ρ 1 M , E ρ 1 M 1 , W ρ 1 M 1 ) , ( ρ 2 M , E ρ 2 M 2 , W ρ 2 M 2 ) ) + d 1 ( ( ρ 2 M , E ρ 2 M 2 , W ρ 2 M 2 ) , ( ζ ρ 4 M , E ζ ρ 4 M 3 , W ζ ρ 4 M 3 ) ) = d 1 ( ( ρ 1 M , E ρ 1 M 1 , W ρ 1 M 1 ) , ( ρ 2 M , E ρ 2 M 2 , W ρ 2 M 2 ) ) + d 1 ( ( ρ 2 M , E ρ 2 M 2 , W ρ 2 M 2 ) , ( ρ 5 M , E ρ 5 M 3 , W ρ 5 M 3 ) ) d 1 ( ( ρ 1 M , E ρ 1 M 1 , W ρ 1 M 1 ) , ( ρ 5 M , E ρ 5 M 3 , W ρ 5 M 3 ) ) d 2 ( G 1 , G 3 ) .
where ζ N is the bijective function satisfying ζ ρ 3 = ρ 2 and where ρ 5 = ζ ρ 4 .  □

5. Computations

In this section, we show how to implement the above-mentioned metrics. Suppose V = { v 1 , v 2 , v 3 , v 4 } . To begin with, we implement d 1 . Let e i j denote the edge from node i to node j.

5.1. Labelled Vertices with Single Directed Edge

Given the two graphs G 1 and G 2 in Figure 1 and their respective adjacent matrices, in which the symbol ∞ (represented by a sufficient large real number) denotes there is no connection between the two nodes and represents a predetermined sufficiently large real number, in Table 1 (a pair α , β denote the weights of the directed edges e i j and e j i , respectively, where i < j ).
One obtains E 1 ( v 1 ) = { v 1 } , E 1 ( v 2 ) = { v 1 , v 2 , v 4 } , E 1 ( v 3 ) = { v 1 , v 3 , v 4 } , E 1 ( v 4 ) = { v 1 , v 2 , v 3 , v 4 } ; moreover, one also obtains E 2 ( v 1 ) = { v 1 , v 2 } , E 2 ( v 2 ) = { v 1 , v 2 , v 3 , v 4 } , E 2 ( v 3 ) = { v 1 , v 2 , v 3 , v 4 } , E 2 ( v 4 ) = { v 2 , v 4 } . The representation of these graphs via partial functions could be demonstrated by Table 2.
By Equation (1), one has d 1 ( G 1 , G 2 ) = 5 + [ | 6 5 | + | 2 7 | + 4 ] + [ | 4 4 | + | 4 7 | + 8 ] + [ 5 + 6 + | 5 3 | ] = 39 . To simplify the whole computation, alternatively, this distance could also be obtained via the following matrix representation of Equation (1) and computation.
Definition 5.
δ i j n = 1 , i f W n ( i , j ) , 0 , o t h e r w i s e ,
where n { 1 , 2 } .
Definition 6.
(distance between edges) Define each element e i j of the distance matrix [ W 1 , W 2 ] between W 1 and W 2 by
e i j = δ i j 1 · δ i j 2 · | e i j 1 e i j 2 | + ( 1 δ i j 1 ) · δ i j 2 · e i j 2 + δ i j 1 · ( 1 δ i j 2 ) · e i j 1 .
where e i j 1 and e i j 2 denote element of i’th row, j’th column in W 1 and W 2 , respectively.
On the basis of this definition, one has
[ W 1 , W 2 ] = 0 5 0 0 1 0 4 5 0 8 0 3 5 2 6 0 .
Definition 7.
For any square matrix S = ( s i j ) , define | | S | | = i , j = 1 | S | s i j .
Then, Equation (1) could be represented and computed via the following matrix operation:
d 1 ( G 1 , G 2 ) : = | | [ W 1 , W 2 ] | | = 39 .

5.2. Unlabelled Vertices with Singled Directed Edge

In this section, we show how to implement d 2 defined in Definition (4). Assume V is unlabelled. G 1 and G 2 are shown in Figure 2.
Let N = { v 1 , v 2 , v 3 , v 4 } be the arbitrary names of the vertices of both G 1 and G 2 . Let P E R M ( n ) denote all the permutations of the identity matrix with dimension n. By Equation (3), the distance between two unlabelled graphs could be represented and computed via the following matrix operations:
d 2 ( G 1 , G 2 ) : = m i n { | | [ W 1 , P t W 2 P ] | | : P P E R M ( | N | ) } ,
where each P t represents the transpose of the permutation matrix P. By computation, we have | N | = 4 , | P E R M ( | N | ) | = 24 and the distances between W 1 and each permutation of W 2 are listed as follows:
{ | | [ W 1 , P t W 2 P ] | | : P P E R M ( 4 ) } = { 39 , 31 , 41 , 29 , 27 , 27 , 43 , 29 , 53 , 29 , 35 , 27 , 45 , 33 , 57 , 31 , 35 , 23 , 43 , 43 , 53 , 33 , 49 , 33 } .
Among which, the optimal permutation matrix is P ¯ = [ 0 0 1 0 0 0 0 1 0 1 0 0 1 0 0 0 ] and thus d 2 ( G 1 , G 2 ) = | | [ W 1 , P ¯ t W 2 P ¯ ] | | = 23 , where P ¯ t W 2 P ¯ = 0 3 7 0 4 8 0 5 7 4 5 0 . The corresponding minimal pair of graphs could be shown in Figure 3.
This could be interpreted as the complexity of the overlap of these two graphs based on corresponding vertices, i.e., this overlap yields the minimal complexity of the graphs.

6. Conclusions

In this article, we have shown how to define distances between graphs over either a set of labelled or unlabelled vertices via metrics d 1 and d 2 , respectively. We also give a computational approaches to implement the computation of d 1 and d 2 via adjacent matrix operations. This implementation gives an efficient and fast computation of the distance between any two such graphs. This type of distance could then be applied in measuring the distance between networks or tree structures.

Acknowledgments

This work is supported by Natural Science Foundation of Fujian Province [Grant No. 2017J01566].

Conflicts of Interest

The author declares no conflict of interest.

References

  1. Pawlak, Z. Rough Sets: Theoretical Aspects of Reasoning about Data; Kluwer Academic Publishers: Dordrecht, The Netherlands, 1991. [Google Scholar]
  2. Xu, C. Improvement of the distance between intuitionistic fuzzy sets and its applications. J. Intell. Fuzzy Syst. 2017, 33, 1563–1575. [Google Scholar] [CrossRef]
  3. Zadeh, L.A. Fuzzy Sets. Inf. Control 1965, 8, 338–353. [Google Scholar] [CrossRef]
  4. Liu, X. Entropy, distance measure and similarity measure of fuzzy sets and their relations. Fuzzy Sets Syst. 1992, 52, 305–318. [Google Scholar]
  5. Sarwar, M.; Akram, M. An algorithm for computing certain metrics in intuitionistic fuzzy graphs. J. Intell. Fuzzy Syst. 2016, 52, 2405–2416. [Google Scholar] [CrossRef]
  6. Akram, M.; Waseem, N. Certain Metrics in m-Polar Fuzzy Graphs. New Math. Nat. Comput. 2016, 12, 135–155. [Google Scholar] [CrossRef]
Figure 1. Labelled graphs: G 1 and G 2 .
Figure 1. Labelled graphs: G 1 and G 2 .
Mca 23 00066 g001
Figure 2. Unlabelled graphs: G 1 and G 2 .
Figure 2. Unlabelled graphs: G 1 and G 2 .
Mca 23 00066 g002
Figure 3. Optimal pair of graphs: G 1 and G 2 .
Figure 3. Optimal pair of graphs: G 1 and G 2 .
Mca 23 00066 g003
Table 1. Adjacent Matrices for G 1 and G 2 .
Table 1. Adjacent Matrices for G 1 and G 2 .
Mca 23 00066 i001
Table 2. Representing Directed Graphs via Partial Functions.
Table 2. Representing Directed Graphs via Partial Functions.
V W 1 ( . ) W 2 ( . )
v 1 { ( v 1 , 0 ) } { ( v 1 , 0 ) , ( v 2 , 5 ) }
v 2 { ( v 1 , 6 ) , ( v 2 , 0 ) , ( v 4 , 2 ) } { ( v 1 , 5 ) , ( v 2 , 0 ) , ( v 3 , 4 ) , ( v 4 , 7 ) }
v 3 { ( v 1 , 4 ) , ( v 3 , 0 ) , ( v 4 , 4 ) } { ( v 1 , 4 ) , ( v 2 , 8 ) , ( v 3 , 0 ) , ( v 4 , 7 ) }
v 4 { ( v 1 , 5 ) , ( v 2 , 5 ) , ( v 3 , 6 ) , ( v 4 , 0 ) } { ( v 2 , 3 ) , ( v 4 , 0 ) }

Share and Cite

MDPI and ACS Style

Chen, R.-M. Metrics for Single-Edged Graphs over a Fixed Set of Vertices. Math. Comput. Appl. 2018, 23, 66. https://doi.org/10.3390/mca23040066

AMA Style

Chen R-M. Metrics for Single-Edged Graphs over a Fixed Set of Vertices. Mathematical and Computational Applications. 2018; 23(4):66. https://doi.org/10.3390/mca23040066

Chicago/Turabian Style

Chen, Ray-Ming. 2018. "Metrics for Single-Edged Graphs over a Fixed Set of Vertices" Mathematical and Computational Applications 23, no. 4: 66. https://doi.org/10.3390/mca23040066

Article Metrics

Back to TopTop