Algorithmic approach to find S-consistency in Common-Edge signed graph

Common-Edge signed graph CE(S) of a signed graph S is a signed graph whose vertex-set is the pairs of adjacent edges in S and two vertices are adjacent if the corresponding pairs of adjacent edges of S have exactly one edge in common, with the sign same as that of Common-Edge. S-Marked signed graph T is a signed graph which receives the marking μ due to the signed graph S called marker. Further, T is S-consistent if a marker S is defined and if S-markingμof T with respect to which marked signed graph Tμ is consistent. In this paper, we give an algorithm to detect if CE(S) is S-consistent or not and determine its complexity. • Algorithm to detect if CE(S) is S-consistent or not. • Determination of algorithm's complexity.


Introduction
We use definitions and notations of graph theory from the books of Harary [6] and West [15] . For the algorithms, Coreman [3] and Golumbic [5] are followed. A signed graph [16 , 17] is an ordered pair S = ( S u , σ ) , where S u = ( V , E ) is the underlying graph of S and σ : E → { + , −} is a function from edge set E of S u into the set { + , −} , called the sign function of S .
Common-Edge signed graph [2] , C E (S) of a signed graph S is a signed graph where vertex-set is the set of pairs of adjacent edges in S and two vertices are adjacent if the corresponding pairs of adjacent edges of S have exactly one edge in common, with the same sign as that of Common-Edge (see Fig. 1 ).
A marked signed graph [1] is an ordered pair S μ = ( S , μ) where S = ( S u , σ ) is a signed graph and μ : V (S) → { + , −} is a function from the vertex set V (S) of S into the set { + , −} , called a marking of S . It can also be defined as a signed graph, each vertex of which is marked + or −, and it is consistent if every cycle in the signed graph possesses an even number of − marked vertices. T is S-marked [1] if the vertices of T are marked due to the specific rule on signs of the edges of some signed graph S , called marker of T . Further, T is S -consistent whenever a marker S is to be specified, if there is an S -marking μ of T with respect to which the marked signed graph T μ is consistent. Further, for a given signed graph S we define a function μ as: Such that for every v( e i e j ; e i , e j ∈ E(S) ) ∈ V( C E ( S) ) , And look for the algorithm so that the resulting marked signed graph ( C E (S) ) μ is S -consistent.
Gill & Patwardhan [4] defines negative section of a subsigned graph S of a signed graph S as a maximal connected edge-induced subsigned graph in S consisting of only the negative edges of S . A negative section in a cycle of S is essentially a maximal all-negative path in the cycle or the whole cycle itself. A cycle is positive if and only if it has an even number of negative sections of odd length.
Humans have cognitions which they invoke to develop attitudes towards various entities, including persons, in their perceivable environment. This is the foundation of consistency theory in social psychology that begins with the postulation that, over reasonably long periods of interaction with such entities, these attitudes might become so much a part of the identifiable characteristics of the individuals that they might be broadly categorized as being positive or negative in their overall attitudinal dispositions. Accordingly, each individual in a social group may be attributed a label ' + ' or ' − ' , generically called a mark , according to whether the individual's such overall attitude is positive or negative. When such attitude gets expressed by an individual A in respect of another individual(or entity in the individual's immediate environment) B , we talk of 'attitudinal disposition of A towards B with its nature believed to be in consonance with A 's attitude; this real-life situation is fully representable as an arc ( A , B ) each of whose elements A , B and the arc ( A , B ) carries one of the values (or, 'signs') in the set M = { + , −} representing the qualitative nature of attitudes possessed by the entities or expressed by them.  The concept of consistency is a motivation of communication networks. If binary messages with vertices having negative marking are sent through a network, reversing messages and vertices having positive marking, leaving them unchanged, then a consistent marked graph follows the consistency property: If a message is sent from the vertex u to the vertex v through two different vertex disjoint paths and u and v have the same sign, then v will receive the same message no matter which path is followed. In a similar manner, consistent marked graphs have utility in social networks, networks whose vertices are people. If some people always lie and some always tell the truth, a consistent social network has the property that if a message is sent from u to v and they have the same sign, then v will receive the same message independent of the path followed.
The S -consistent property is well defined in [2 , 9] which has a reference to [1] in which consistent marked graphs are considered. The property can be used in communication networks. Let us take an example of a network. The network can be represented by S . Encryption and decryption of S can be done to ( C E ( S) ) and vice versa. The additional use of consistency property on S makes the network more secured. An optimal algorithm is developed with complexity O (n 3 ) for security of network and a new technique is defined to signed graphs in encryption and decryption process.
Thus, we define algorithms for network as Common-Edge signed graph with the additional property of S -consistency to social networks.
In this paper, an algorithm is developed using the characterization given by [1 , 2] to check if given Common-Edge signed graph is S -consistent or not. The paper was presented in the International Conference [14] and was highly appreciated. An algorithm to convert S to C E (S ) has already been discussed in [11] where the complexity involved in the algorithm is O (n 3 ) .

Characterization of S -consistent Common-Edge signed graphs
Theorem 2.1. Acharya and Sinha [2] For any signed graph S , C E (S) is S -consistent if and only if the following conditions holds on S , (a) for each cycle Z in S , (i) if Z is all-negative, then it must be of even length; (ii) if Z is heterogeneous then the number of negative sections of length > 1 in Z and the total number of negative edges in the negative sections of length > 1 in Z and are of the same parity; (ii) size of any negative section containing v is at most one.

Numerical interpretation
Consider the following signed graph S and C E (S) as shown in Fig. 2 .
Here S has the adjacency matrix: The adjacency matrix corresponding to Common-Edge signed graph C E (S) is: It can be easily verified that for the signed graph S as shown in Fig All conditions are satisfied for S , therefore, for the signed graph S , C E (S) is S -consistent.

Algorithm to find S-consistency in Common-Edge signed graph
Here, by vertex we mean adjacency matrix of the signed graph S of order n . NbPositiveEdge, NbTotalEdge and NbNegativeEdge denotes count of positive, total and negative edges incident to every node. by NbEdgesInSection, NbNegativeSections, NbNodesInPath and TotalNegativeEdges total edges in each section, total negative section of length > 1 , total nodes in the path and total negative sections of length > 1 , respectively, are defined.
Step 2. // Checking a(i.) and a(ii.) condition Step 3. Repeat Step 3 to 5 for Node i = 1 to n Step 4. Assign path.push-back(i) Here procedure/function FindCycle1 is used to find all cycles from adjacency matrix starting with vertex where degree is ≥ 3. This function returns true if size of edges in every section is at most one. If size increases by one, function returns false.

Complexity of the algorithm
To obtain C E (S) [10] in Step 1, complexity involved = O (n 3 )) .

In Step 3, every vertex is traversed and
Step 5 is executed ' n ' times for every node to obtain cycle. EvaluatePath () function is called to obtain all cycles where every node is travelled.

Repeat
Step 7 to Step 14 to find count length of each negative section and total negative section of every cycle, therefore, To check condition b(ii.) of the Theorem 2.1 , n x n matrix is traversed from Step 7 to Step 10 in the main algorithm to count negative, total and positive edges incident to every node. Proof. Let ' n ' is number of vertices and ' e ' be number of edges in the signed graph S . The complexity to find all elementary cycles in a given directed/undirected graph [7] is exponential in nature i.e., complexity is of O( 2 n ) and for real world networks it is polynomial in nature [8] . Depth First Search (DFS) algorithm is used randomly for a selected vertex in the graph. During DFS, when discovering an adjacent vertex in the graph, each adjacent vertex is visited before to discover a cycle. The edge between the current vertex (i) and the visited vertex (j) is called a back edge ( i , j ) and stored in an array to be used later for forming the discovered cycles. When DFS is finished, the algorithm will perform a loop on the array that stores the discovered back edges to form the unique cycles. The cycles will be formed out of discovered back edges by adding to the back edge all edges that form a route from vertex (j) to vertex (i) that grows exponentially. Now, since our aim is to find first all cycles in the given signed graph S and then all positive and negative sections in that cycle. A signed graph has entries 0, 1 and -1 representing no edge, positive edge and negative edge respectively. The algorithm uses DFS technique to find all cycles of the given signed graph with the same procedure as defined in [7 , 8] but to find all positive and negative sections of different or same length, a new algorithm is developed by Sinha and; Sethi [12 , 13] where every node is again traversed to count this length. The loop starts with the first vertex and every cycle is calculated along with negative and positive sections resulting in the time complexity of O (n 3 ) .
Next step is to prove that this complexity is minimum in nature. Let the complexity be O (n 3 ) . The algorithm is defined for real networks and for large value of ' n ' , it is obvious that n 3 ≤ 2 n for n ≥ 10 . Thus, our algorithm is lower bound which is restricted to number of vertices greater than or equal to 10.
In other way, mathematically let us suppose that complexity of O (n 3 ) is not minimum. Big Oh notation has two basic limitations; it contains no consideration of programming effort s and masks (hides) potentially important constants.
Considering these two limitations, let 2 n < cn 3 (adding constants) Taking log on both sides n < a + b log (n) // a and b are again constants n < O ( log (n) ) which is a contradiction Hence our supposition is wrong. Thus, if potential constants are considered, then the algorithm computed is optimal in nature.

Geometric interpretation of the algorithm
Different adjacency matrices are defined to check the algorithm. Example 1. Adjacency matrix of S 1 and S 2 is: Apply algorithm to obtain C E (S) [10] as defined in Step 1. The Adjacency matrix of C E ( S 1 ) and C E ( S 2 ) are: Firstly, for checking condition a(i) of Theorem 2.1 , i.e., first obtain all existing cycles in S . To detect homogenous cycle calculate path length of each cycle and all negative edges in this path. Secondly, if this count is even, then cycle is all negative and of even length and condition a(i) of Theorem 2.1 is satisfied and we have a signed graph which is S -consistent.
In Step 3 to 5, FindCycle () function is used to obtain all the cycle in the signed graph. This function outputs all the paths of the cycle. Evaluate() whether cycle is heterogeneous or homogenous. There does not exist any positive edge in signed graph S 1 and S 2 , thus both the signed graphs are homogenous. NbNodesInPath is calculated which in signed graph S 1 is 4 (even) and for S 2 it is 5(odd). Thus, signed graph S 1 is S-consistent whereas S 2 is not and hence program terminates after Step 5 in O (n 3 ) steps.

Example 2.
The adjacency matrices of S 3 and S 4 are: To check condition a(ii) of Theorem 2.1 , first obtain a cycle. Check if any positive edge exists in the cycle. Cycle is heterogeneous if positive edge exists. Negative edges (entries) in the cycle are calculated. If positive edge is preceded with only one negative edge in the path of cycle, negative section exists and updates edges in NbEdgesInSection. If the count > 1, then increase NbNegativeSections by 1 and TotalNegativeedges by NbEdgesInSection. If NbNegativeEdgesInSection exceeds 1, then stop the process and search for new cycle. This way total negative sections of length > 1 and total negative edges in the negative sections of length > 1 are found. Both NbNegativeSections and TotalNegativeEdges must be of same parity. If both the counts are odd or even then go to next condition else say that condition is false and hence C E (S) is not S -consistent.
Signed graph S 3 contains two negative sections, 3 − 4 − 5 of length 2 and 1 − 2 of length 1. Now count negative sections where length > 1 , i.e NbNegativeSections = 1. Also, total negative edges where length of the negative section > 1 , TotalNegativeEdges = 2. Since both are of different parity, S 3 does not satisfy the given condition and program is terminated after Step 12 of Evaluate () function again in O (n 3 ) steps.
Similarly, S 4 contains two negative sections, 4 − 5 − 6 and 1 − 2 − 3 both of length 2. Here total negative sections of length > 1 i.e., NbNegativeSections = 2 and total negative edges in above calculated negative sections i.e, TotalNegativeEdges = 4. Since, both are of same parity i.e even, therefore, S 4 holds true for a(ii) and check next condition. Degree of each vertex is calculated and no vertex exists with degree > 3, thus, program again terminates in O (n 3 ) steps.

Conclusion and future scope
An algorithmic characterization is defined for a given S whose C E (S) is S -consistent in O (n 3 ) steps.
An adjacency matrix is taken as data with values as 1, -1 and 0. Network of ' n ' vertices can be restricted depending on number of connections as it affects the time complexity. We can represent any matrix as an image and also vice-versa. Encryption and decryption mechanism can be applied to an image through matrices. By using the algorithms defined to obtain Common-Edge signed graph [10] from a given S and Common-Edge root signed graph of S see [10 , 11] , decryption and encryption algorithm can be applied to an image where C E (S) is S -consistent. Such application has already been discussed by the authors for another derived network Line signed graphs see [12] . The same can be applied to C E (S) too.

Declaration of Competing Interest
The authors declare that they have no known competing financial interests or personal relationships that could have appeared to influence the work reported in this paper.

Data Availability
No data was used for the research described in the article.