Keywords

1 Introduction

With the development of big data and cloud computing, real-time graphics editing systems are more inclined to collaborate on a large scale. A complex project typically involves hundreds of designers collaborating on a common task. In this case, two issues need to be considered further. One is that a large number of concurrency conflicts may occur inevitably, which poses a higher challenge for consistency maintenance. Another is that for large-scale collaboration where large numbers of users simultaneously edit shared documents [1], shared documents are updated frequently. This situation usually leads to a decline in collaborative computing performance [2]. Another key challenge for the success of intelligent collaborative editing systems is to improve computational efficiency. Recently, CRDT technology has been proposed as a new concurrency control mechanism for collaborative text editing. The main task of the paper is to raise a new algorithm for real-time graphic editing system to adapt to the basic operation of graphic editing system. The core idea of the CRDT algorithm is to plan exchange concurrency operations. Therefore, conversions are no longer needed and concurrent operations can be performed in any order [7]. This paper mainly proposes a string CRDT algorithm for intelligent graphics editing systems, which is face to new challenges. The performance of the CRDT algorithm has proven to be superior to traditional methods and is applicable to large-scale distributed environments [7]. The organization structure of this paper is as belows: The second part raises the research related work; The third part proposes the CRDT-based conflict resolution in real-time graphics editing system; the fourth part is analyze the complexity of time and space. The Fifth part is gives summary.

2 Related Work

In the collaborative graphics editing system, the consistency maintenance mostly uses the multi-version mechanism [14] to solve the concurrency control problem. For example, Sun et al. proposed a cloud storage operation transformation (CSOT) in the literature [4]. The convergence of real-time synchronous shared tree document structure in cloud storage system; Sun et al. [4] proposed a new collaborative object grouping technology called CoGroup, which is based on operation conversion (OT) technology and TA. Based on previous work], someone has proposed an optimized version to optimize the number of object versions. Gao et al. [5, 14] used a multi-version strategy to solve the problem of execution and undo/redo consistency maintenance in real-time collaborative bitmap editing systems. There are also many studies that apply a series of changes to the dott algorithm in OT in a collaborative graphics editing system. These methods based on OT [13] do not have good execution efficiency in collaborative editing group editing under large-scale data. Recently, CRDT (Commutative Replicated Data Type) was proposed as a new concurrency control mechanism to achieve the ultimate consistency of collaborative text editing. Since the first work in [6], a representative CRDT algorithm has been proposed and applied to collaborative text editing. [7] HE et al. proposed String-wise in large-scale collaborative editing system. The CRDT algorithm solves the consistency maintenance in intelligent and large-scale data environments, and its correctness has been verified. In past studies [15, 16], some people used traditional algorithms to solve real-time collaborative CAD system. Others have propose the CRDT model into the real-time collaborative CAD [11] system. In both of these articles, the advantages of CRDT in large-scale data processing are highlighted, and the efficiency is higher, and the time complexity and space complexity are well optimized. However, in collaborative graphics editing systems, there is little research based on CRDT, which has great advantages over multi-version mechanisms and tree-based mechanisms.

Compared with the traditional OT algorithm, the algorithm based on CRDT has great advantages. For example, the COT (Context-Based Operational Transformation) algorithm improvement was previously applied to the graphics editing scenario. In this case, the execution condition of O is to compare the operation of DS with C(O) [12]. In C(O), all operations in C (O) need to do the operation conversion, then in the one-time operation transmission, the DS and C(O) front operations will perform the useless comparison once and for all, which costs time waste and transmission overhead. The CRDT-based algorithm proposed in this paper is based on unique ID number to find the operation object to operate directly, especially during the delete operation.

3 Proposed Algorithm

In the work of documentstring editing [7], we extend and advance the data structure so that we can get good use in the Co-PAINT system based on real-time graphics. The real-time collaborative graphics editing system composes mass collaborative sites. Each site maintains the CoRDG (dynamic rule library), a hash table, a double linked list and an interactive view. CoRDG is used to store association relationships between predefined objects. The hash table stores the operations of all objects. Double linked list is links all graphic operations, including visible and invisible modeling operations, from the beginning to the end. Each graphic object operation is regarded as the operation node of double linked list. View can provide interactive interfaces for collaborative users. The whole frame is shown as shown in Fig. 1.

Fig. 1.
figure 1

Overall framework

The whole control process is shown as shown above. Collaborative designers can perform create, delete, update operations on local sites at the same time, and receive remote graphics object operations from other sites. A local operation generation, the local operation is executed promptly and the operation is directly linked to the last operation of the double linked list by using the identifier of the last operation. The integration process of remote operations consists of two steps. First, remote operations require a target image object operation to be found in a hash table with a unique identifier. Second, the location of the target graphical object operation needs to be found in the double-linked list. It is probably that operation may be performed after the alike target object operation. When there are conflicts, the priority of their association in the CoRDG and their identifiers need to be used to resolve conflicts. Finally, the effect of the integrated update appears in the interactive view.

Definition 1: Graphic object operation (Oa)

In real-time collaborative image editing system, an Oa consists of a 14-element < t,,k,(x,y),l,O[i],Obji,visible,flag,key,c_key,pre_key,next,prior,link,s > ,with t representing the type of operation, (x, y) representing the position of the center point of the graphic object in the implicit coordinate system of the graphic document, and 0 = true representing the local operation. l = false represents a remote operation, and O(i) represents a set of graphical state associations generated, where O[k] = (i,j), 0 ≤ k ≤ i.

Definition 2:

(Oa \( \prec \) Ob) given two Oa and Ob in the double-linked list, the position of Oa is denoted as pos(Oa), the position of Ob is denoted as pos(Ob), if pos(Oa) < pos(Ob) (The position of Oa in the double linked list is in front of Ob, then Oa \( \prec \) Ob.

Based on the above definition, we can get Oa \( \prec \) Ob between two graphics operations due to different target operation locations in the double-linked list. However, when two concurrent graphics operations may have the same operational position in a double linked list. In this case, we can’t get Oa \( \prec \) Ob between the two graphics operations, so we need to sort them. Therefore, unique identifiers can determine their order. The unique identifier is defined as follows.

Definition 3: Identifier (ID)

The unique identifier of the graphic object consists of a triple: <s , ssv, site>

  1. (1)

    s is the identifier of the session

  2. (2)

    ssv is the sum of the state vectors of an operation

  3. (3)

    site is the unique identifier of the site symbol

Definition 4:

Given the operations of any two graphic objects Oa, Ob, the IDs of the two operations are IDOa and IDOb: (1) If IDOa[s] < IDOb→ (2) If IDOa[s] = IDOb[s],IDOa

[ssv] = IDOb[ssv] (3) If IDOa[s] = IDOb[s],IDOa[ssv] = IDOb[ssv], IDOa[ssv] = IDOb[ssv],IDOa

[site] = IDOb[site] Then IDOa \( \prec \) IDOb

Definition 5:

Given any two compatible graphical objectsObji, and Objj, IDOa is the unique identifier of Obji, IDOb is the unique identifier of Objj. When they have the same target operating position in the double linked list, if IDOa \( \prec \) IDOb, then Obji \( \prec \) Objj..

To ensure ultimate consistency, we need to ensure that all modeling operations in the double-linked list have the same overall order in each site when all operations are performed in all sites. The definition of the overall order relationship for all modeling operations is given below.

Definition 6: Total ordering of operations (O⇒)

Given any three operations, called O1, O2, O3, if (1) O1 \( \prec \) O2 or O2 \( \prec \) O1 or (2) O1 \( \prec \) O2, O2 \( \prec \) O3, O1 \( \prec \) O3, then here is O⇒

In real-time collaborative text editing, final consistency and intent preservation are two important correctness criteria for the correctness of the CRDT algorithm. Therefore, after the correctness criteria in collaborative text editing, the real-time Co-Drawing system is considered correct if the following criteria are adhered to:

Final Consistency: All operational models from different sites are identical after all modeling operations have been performed in all sites.

Unlike collaborative text editing, in an operation-based Co-RGD system, there are complex relationships between operations, and there is inevitably a modeling conflict between operations between different designers. In this case, some graphics object operations cannot be performed due to operational conflicts, which ultimately leads to the inability of the entire drawing task to be completed. Therefore, conflict resolution is neededed to maintain more design intent and maintain ultimate consistency. Considering the complexity of graphics operations, in order to maintain the final consistency, this article divides operations into basic class operations and predefined relationship class operations.

Basic Class Operation

In the collaborative graphics editing system designed in this paper, the basic class operations are divided into three types: N operation (D), D operation (Delete) and U operation (Update). The following defines the conflict relationship and detection between graphic object operations.

Definition 7: Conflict/Compatibility

Suppose two operations are given, called Oa,Ob.Oa||Ob and the target graphic object identifiers for Oa and Ob operations are the same, if any of the following conditions are met:

  1. (1)

    T(Oa) = T(Ob) = Operate.Update & K(Oa) ≠ K(Ob)

  2. (2)

    T(Oa) = T(Ob) = Operate.Delete

  3. (3)

    T(Oa) = Operate.Update & T(Ob) = Operate.Delete

  4. (4)

    T(Oa) = Operate.Delete & T(Ob) = Operate.Update

Then there is a conflict relationship between Oa and Ob, expressed as: Oa ⊗ Ob. If there is no conflict relationship between the two operations Oa and Ob, they are said to be compatible relationships, expressed as: Oa ⨀ Ob. Where T(O) represents the operation type of O. K(O) represents the attached new attribute value of the image object.

figure a

Algorithm 1 describes how to resolve conflicts between basic class operations. Operation Oa is the execution of the operation, and Operation Ob is the remote operation to be performed. There are two situations to be considered. When the operation is the same operation type, the operation is determined according to the priority. The operation with higher priority is linked to the double-linked list, and the operation with lower priority is not executed. It can be seen that the operation flag set to 0 and the lower priority is Set to 1. When the operation is a different type of operation, we specify that the priority of the U operation is greater than the priority of the D operation.

figure b

Algorithm 2 describes how to resolve compatible operations between basic operations. Operation Oa is the execution of the operation, and Operation Ob is the remote operation to be performed. When the two operations are compatible, the operation with the smaller identifier is performed before the operation with the higher identifier. At the same time, an operation link with a larger identifier in a double-linked list is after an operation with a smaller identifier.

Predefined Relationship Class Operations

In the actual engineering drawing design process, there is an inherent relationship between objects, and the user can define the association relationship between the objects in advance, and add the corresponding constraint rules under the relationship. In this case, for one or more operations, the executed result violates the predefined semantic constraints, which may cause inconsistencies. Therefore, the predefined relationship class operations mainly discuss the relationship between the positions of the graphic objects. As shown in the figure below, the position constraint relationship of “contains” between “door” and “handle” is predefined. If the designer of Site 1 thinks that the position of the “handle” should be to move K2 to the left by a certain distance on the left side of the door (Operation O1), likewise, the designer of Site 2 has this idea, but the operator of Site 2 puts K1 has moved a certain distance to the right (Operation O2). For O1 and O2 operations, it is legal if only consider the consistency of independent operations, because they are operations on different objects without any conflict, although they are concurrent. But this operation violates the requirement of semantic consistency.

The rectangular object K1 represents the door and the circular object K2 represents the door handle. According to the connection between objects, the positional relationship between K1 and K2 can be predefined: the moving range of the door handle should not exceed the size range of the door, otherwise it will not meet the actual design requirements, resulting in semantic illegitimate, as illustrated below (c).

The Representation of the Association Relationship Between the Graphic Objects

The O(i) in the operation tuple represents the association constraint relationship between the two objects, and the relationship can be represented by Relate-Rule: Relate is the relationship between the objects, the specific representation method An ordered pair of  <Obj1, Obj2, r-id, r-describe>. Among them, Obj1 and Obj2 are two related object identifiers, r-id represents the generated constraint rule identification number, corresponding to rule, and r-describe is a description of the specific constraint relationship.

Rule is a constraint rule. It consists of one or more rules. The ordered form is an ordered pair of <r-id, Attributes, and comp>,  where r-id is associated with r-id in Relate, and Attributes is associated with the attribute, comp, compares the sign for the value on the specific attribute.

Definition 8: Position constraint

For two different image objects, if there is one or more locations in the spatial location, We call such a position attribute association constraint relationship between two different image objects. To operate on any of these graphical objects, you must first detect the constraint relationship between them. As shown in Fig. 2, K1 and K2 have the associated constraint relationship on the location attribute, which is represented by Relate-Rule: <1.1,2.1,1, “Obj1:1.1(door) Include Obj2:2.1(handle)”>.  In other words, the K1 of the graphic object Obj1 and the K2 of the graphic object Obj2 are in a constrained relationship. The specific rule number is 1. Therefore, Rule with a sequence number of 1 is:  < 1, x1-pos, “ ≤ ”, < 1, y1-pos, “ ≥ ”, < 1, x2-pos “ ≥ ”, < 1, y2-pos, “ ≤ ” > .O(i) is a dynamic addition of various complex relationships between graphical objects to the dynamic rule base according to the actual design requirements. The system will transmit the broadcasts to other sites in time, so that the library of each site keeps up to date.

Fig. 2.
figure 2

Example of semantic inconsistency

Definition 9: Predefined action conflict detection

The predefined concurrency conflict operation assumes that the given two operations Oa and Ob are for different objects if the following conditions are met:

  1. (1)

    Oa||Ob

  2. (2)

    Oa, Ob∈Relate (the relationship between Oa and Ob operation objects)

  3. (3)

    Oa, Ob \( \notin \) Rule (Oa, Ob violates the rule defined by Rule after execution)

Then, Oa and Ob are concurrent conflict operations.

Predefined Concurrency Compatible Operations If Oa and Ob are not concurrent collision operations, Oa and Ob are compatible operations.

figure c

Definition 10: Integrated local operation

The algorithm gives an integrated local operation Oa. There are two situations to be considered: First, when Oa:pre_key is empty and no modeling operations exist in the double-linked list, Oa is inserted at the head of the double-linked list. Otherwise, the operation is inserted after the last graphical modeling operation of the doubly linked list. In the second case, when Oa:pre_key is not empty, you need to find the graphics modeling operation (pre) that was just executed at the local site. The Oa connection is after the Pre that was just found. Then, broadcast Oa to the remote site.

figure d

4 Time Complexity Analysis and Space Complexity

Local modeling operations of the time of complexity in a session is O(1) as the target modeling operations have found directly using the hash table and the unique ID. Only when a session begins, we need to get the last executed operation of the double linked list as the target modeling operation for the first operation issued in each collaborative site. In this case, the time complexity is O(n), where n is the quantity of executed modeling operations in the double linked list.

In ours approach, each operation Oa is a fourteen-tuples <t,k,(x,y),l,O[i],Obji,visible,flag,key,c_key,pre_key,next,prior,link,s>. The regular part is  <t,k,(x,y),l,Obji,visible,flag,key,c_key,pre_key,next,prior,link,s>. The unregular part is O[i]. We suppose that the dimension of the regular part is S. The size of  <O[i]> is decided by the quantity of target operations whose the mutual relationship between the objects. If there is no predetermined relationship between the objects, so, the total size of each modeling is S. In the worst situation, there are R target modeling operations and T operations dependent on the by Oa. Assuming that the counts of operations in the linkes list is N (involving tombstones), the first-rate space complexity is O(S × N), the worst situation complexity is O((S + R + T) × N). So far as to the worst case, R and T are typical small. Meanwhile, the space overhead of the hash table is the same as that of the double linked list.

5 Conclusion

This paper proposes to improve CRDT algorithm to solve the consitency maitenance and conflict resolution in the graphics editing systems to support intelligence collaboration in big data. The algorithm can preserve the intention of the operation and ensure the semantic maintenance by ensuring the association relationship between the predefined graphic objects and the position attribute constraint rules. Through the analysis of time complexity and space complexity, the computational property of the algorithm is much better than the existing COT algorithm and AST algorithm. Therefore, ours algorithm is more suitable for intelligent collaborative applications compared to existing algorithm.

In the future of research, we will to quest further issues in this field further. First of all, we will keep on improve the posed algorithm. Then, we will do more detailed experiments to analyze and verify its correctness, and we will put forward reasonable case analysis. At the same time, we can do the related simulation prototype system, which the correctness of the algorithm. Finally, we will explore how to use multi-core CPU/multi-core GPU to accelerate large-scale collaborative application [8,9,10].