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

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.


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.

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 Definition 1.Let GG(V) denote the set of all the generalized graphs whose vertex sets are exactly V.
be arbitrary generalized graphs.For any G = (V, E, W : E → R + ) ∈ GG(V) and any a ∈ V, we use E(a) to denote the set of all the endpoints beginning from a, i.e., Furthermore, define the set of all the assigned values of E(a) as follows:

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: 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: Then, the end vertices originating from v 1 via edges in E 1 could be depicted as Henceforth, by Definition 1, one could compute the distance for G 1 and G 2 as follows: 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 Proof.It follows immediately from the fact that Proof.By the definition, the first and second statements follow immediately.Here we show the third statement.Suppose G 1 = G 2 .Then, 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: On the basis of Claim (1), we have the following inferences.Let a ∈ V be arbitrary.Firstly, 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. .
Hence, we have shown and this completes our proof of Equation (2).

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 GG(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 ∈ GG(V − ) could be modeled via this set of dummy vertices as .., 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: 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 Since the modeling of unlabelled graph is not unique, we define an equivalence relation on GG(V − ).
, where Hence G 1 consists of the following elements: Similarly, one could list all the graphs in G 2 , in particular, Therefore, Claim 3. ≡ is an equivalence relation on GG(V − ).
Proof.The result follows immediately from the definition.
Let us look a simple example that G 1 is not equivalent to G 2 in the following.
, where 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 for all bijective function ζ ∈ N → N.
Proof.It suffices to show Then, Hence, one has where ζa denotes ζ(a) and ζc denotes ζ(c).Hence, we have shown Proof.Owing to Claim (4), it suffices to show the triangle transitivity property holds.

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 ij denote the edge from node i to node j.

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 ij and e ji , respectively, where i < j).
The representation of these graphs via partial functions could be demonstrated by Table 2.
To simplify the whole computation, alternatively, this distance could also be obtained via the following matrix representation of Equation ( 1) and computation.Definition 5.
where e 1 ij and e 2 ij denote element of i'th row, j'th column in W 1 and W 2 , respectively.
On the basis of this definition, one has Then, Equation (1) could be represented and computed via the following matrix operation:

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 PERM(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:  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.

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.

Table 1 .
Adjacent Matrices for G 1 and G 2 .

Table 2 .
Representing Directed Graphs via Partial Functions.
Definition 6. (distance between edges) Define each element e ij of the distance matrix [W 1 , W 2 ] between W 1 and W 2 by e