Business Process Management (BPM) is a research area that aims to enable organizations to narrow the gap between business goals and information technology support [27] . Business process evaluation is a key support in narrowing down this gap. There are two evaluation techniques to analyze business processes, a.k.a., model-based analysis, and data-based analysis [1] . While model-based analysis deals with the analysis of business process models, the data-based analysis mostly focuses on analyzing business processes based on their execution event logs.
Process Mining is a discipline in the BPM area that enables data-based analysis for business processes in organizations [2] . It allows analysts not only to evaluate the business processes but also to perform process discovery, compliance checking, and process enhancement based on the execution result, a.k.a., event logs. As the volume of logs increases, new opportunities and challenges also appear. The large volume of logs enables the discovery of more information about business processes; while also raises some challenges, such as feasibility, performance, and data management.
Most process mining techniques require data to be loaded first into memory, which is a feasibility technical challenge when applying them on a large volume of data in a single computer. They also need to work on fine-grain data that might not be accessible to analysts due to organizations' data management policies, which is an organizational challenge. Most of the organizations apply many restrictions to grant analysts access in the granular level to data, which can hinder applying process mining techniques. These are some challenges that the author also faced when applying process mining in practice.
To address these challenges, this paper proposes and formalizes a new approach to store and retrieve event logs in graph databases. It also defines an algorithm to compute Directly Follows Graph (DFG) inside the graph database, which shifts the heavy computation parts of process mining into the graph database. As a result, it enables i) removing the requirement to move data into analysts' computer, ii) applying graph databases' fine-grained access control on event logs and preserving privacy while applying process mining, and iii) scaling the DFG computation vertically and horizontally.
The approach is implemented in Neo4j, and its performance is evaluated in comparison with current techniques based on a real log file. The result shows that the approach can discover process models when the data is much bigger than the computational memory. It also shows better performance when dicing data into small chunks.
The remainder of this paper is organized as follows. Section 2 gives a short background on process mining and graph database. Section 3 introduces the graph-based process mining approach, and Section 4 elaborates on the implementation of the approach in Neo4j. Section 5 reports the evaluation results. Section 6 discuss alternative approaches and related works, and finally, Section 7 concludes the paper and introduces future research.
Process Mining is a research area that supports business process data-based analysis. The process mining approaches can be categorized as discovery, conformance, and enhancement [2] . The process discovery topic enables producing process models from event logs. The conformance topic enables checking the conformance of event logs with existing process models. Process enhancement topic enables improving process models using identified aspects from event logs. In all these topics, event logs are essential to enable process mining. Fig. 1 shows an overview of common process discovery steps, which can also be followed in conformance and enhancement as well. The process discovery usually includes loading the log file, calculating the Directly Follows Graph (DFG), and discovering the process model from DFG.
The process discovery starts by loading a log file that stores business process execution results, a.k.a., log files. Each log contains a set of traces representing 
Directly Follows Graph (DFG)
Discovery Algorithm Fig. 1 . Steps in a process discovery algorithm different cases that performed in the business process. Each trace contains a set of events representing the execution result of activities in the business process. Thus, a log file shall contain information about traces and events at a minimum. Note that with this basic set up, the events should be stored according to the execution order, unless we have information about execution time. It is usual to have more information like the execution time and resource who has done the activity on the log as well.
The next step is calculating the Directly Follows Graph (DFG). This graph shows the frequency of direct relations between activities that are captured in the log file. The result can be considered as a matrix with the activity names at rows and columns. Let's consider the cell that has the row for activity 1 and columns for activity 2 in Fig. 1. The number in the cell shows the number of times that the activity 2 happened after activity 1. Although the calculation of DFG comes back to alpha miner, which introduced around 20 years ago, it is still the backbone for many process mining algorithms and tools [26] . There are different variations of DFG that store more information, but the basic idea is the same.
Calculating DFG can be very time consuming and costly if the log file is huge. Also, many algorithms which are implemented in different tools like ProM and PM4PY requires to load logs to the memory first, which is problematic when calculating the big log files. The process mining algorithms also need to work with the most granular level of data, i.e., events, to calculate DFG. Thus analysts can face data management and security issues when discovering models, where companies might not be interested in handing over the complete set of data. These limitations can hinder applying process mining, while analysts are only interested in discovering the big picture rather than investigating individual cases. We will explain how our approach will solve this problem by enabling the calculation of DFG without granting access to event data in the Section 3.
The last step is to infer the process model from DFG based on rules that are specified by a process discovery algorithm. This step usually does not take much time since the computation is performed on top of DFG.
Graph databases are Database Management Systems (DBMS) that support creating, storing, retrieving, and managing graph database models. Graph database models are defined as the data structure where the schema and instances are modeled as graphs, and the operation on graphs are graph-oriented [3] . The idea is not new, and it comes back to the late eighties when the object-oriented models were also introduced [3] . However, it recently got much attention in both research and industry due to its ability to handle the huge amount of data and networks. It enables leveraging parallel computing capabilities to analyze massive graphs. As a result, a new discipline is emerged in research, called Parallel Graph Analytics [19] .
There are different sorts of graph databases with different features. For example, Neo4j is a graph DBMS that supports both vertical and horizontal scaling, meaning that not only the hardware of the system that runs the DBMS can be scaled out but the number of physical nodes that run the DBMS as a network can be increased. These features enable having a considerable performance at runtime. Also, it allows different sorts of access controls, such as Fine-grained access control, Sub-graph access control, and role-based access control. In this way, different data management strategy can be applied.
The left-side of Fig.2 shows a fictitious short example schema for a simple graph in a graph database. It has four nodes, i.e., patient, disease, symptoms, and address. It also has relations among the nodes that specify their connection. For example, a patient can live in an address, and a patient can be diagnosed with a disease. Each node can have properties, e.g., the patient has a social security number (ssn).
In a graph database, it is possible to grant access to analysts to analyze the spread of diseases, e.g., COVID19, based on patients who live in the same address but not reveal the patient's information nor individual address. We can, as an example, grant access to the postal code level. To do so, we can set the access in a way that analysts can traverse relations from/to patients but cannot 
The graph from researcher view Fig. 2 . An example of a graph schema in a graph database see patient's information. Also, we can hide individual addresses and symptoms. Thus, the schema will be like the right-side of Fig.2 for analysts. In this way, the researcher can analyze how people who lived in the same address got the same disease. Also, the result can be shown in the postal code level. The build-in access control mechanism enables us to design an approach that preserves the privacy of resources while performing process mining.
To traverse or query the graph, graph databases define their query language. Cypher [13] is a declarative query language that allows the application of graph operations on graph databases, which is implemented in several graph databases, including Neo4j.
This section formalizes the approach and explains it through an example. We simplify the formal definition by limiting the set of attributes to hold information about activities. In practice, the definition of attributes can be extended to store all information about the data perspective. The approach enables preserving the privacy of resources while computing DFG. This requires defining logs, traces, events, and event attributes as different nodes so that the access control can be limited for each node.
Definition 1 (Event Repository). An event repository is a tuple
-N is the set of nodes with the following subsets:
-L represents the set of logs, -T represents the set of traces, -E represents the set of events, -A represents the set of attributes, representing activities, where:
-logs to traces, i.e., L × T -traces to events, i.e., T × E, -events to events, i.e., E × E, -events to attributes, i.e., E × A, where:
Let's also define two operators on the graph's nodes as:
-•n represents the operator that retrieves the set of nodes from which there are relations to node n, i.e., •n = {∀e ∈ N |(e, n) ∈ R}. n• represents the operator that retrieves the set of nodes to which there are relations from node n, i.e., n• = {∀e ∈ N |(n, e) ∈ R}.
where N, L, T, E, A, R, representing the set of Nodes, Logs, Traces, Events, Attributes, Relations respectively, is sound iff:
-∀t ∈ T, | • t| = 1, meaning that a trace must belongs to 1 and only 1 log.
-∀e ∈ E, | • e ∩ T | = 1, meaning that an event must belongs to 1 and only 1 trace. -∀e ∈ E, | • e ∩ E| <= 1, meaning that an event can only have at most 1 input flow from another event. -∀e ∈ E, |e • ∩E| <= 1, meaning that an event can only have at most 1 output flow to another event. -∀e ∈ E, |e • ∩A| = 1, meaning that an event must be related to 1 and only 1 attribute.
Note that this formalization can be extended to enable several types of sequences among event logs. To calculate DFG, we need to count the number of direct relations among events for each activity pairs. Algorithm 1 defines how the DFG for a given sound event repository can be calculated.
Algorithm 1: Algorithm for calculating dfg
This section elaborates on the definitions through an example. Fig.3 shows an example of a sound event repository graph. The set of nodes for Log, Trace, Event, and Attribute are collored as green, red, white, and yellow respectively. This repository includes one log file, called l1, which has two traces, i.e., t1 and t2. t1 has three events that are happened with this order e1 → e2 → e3. t2 also has three events that are happened with this order e4 → e5 → e6.
As it can be seen, each event is related to one activity, e.g., e1 is the execution of activity a1. To get the list of events that happened for an activity a1, we can use •a1 operator, which returns {e1}. For some activities, there might be more than one events, e.g., •a2 returns {e2, e4}. Applying Algorithm 1 on this event repository will return the DFG. The DFG calculation is described as bellow:
for each pair of activities, the algorithm will calculate the frequency. We show the calculation for one pair example, i.e., a2, a3: 
The approach presented in this paper is implemented in Neo4j, which was chosen because it supports i) storing graphs and doing graph operations, ii) both vertical and horizontal scaling, iii) querying the graph using Cypher, iii) finegrained access control, sub-graph access control, and role-based access control. The supported access controls enable analysts to analyze event logs without the need to have access to individual details.
We implemented a data-aware version of the approach. The main differences with the formalization are:
-Attributes have key and val, where key is set to predefined values, which are common in process mining applications, i.e., 'log concept name', 'case concept name', and 'concept name' representing the attribute that holds information for log, case, and activity name respectively.
-This feature means that the activities are stored as one subset of activity set, and they shall be filtered based on the attributes' data.
events have timestamps to enable dicing information based on time. Note that the timestamp cannot be defined as an attribute with its own key since we will end up with many extra nodes due to many timestamps that exist for each event. Thus, they are kept as an attribute of Event class, following the same practice to deal with times in data warehousing [18] .
The calculation of DFG is implemented using a Cypher query as bellow: The match clause in the query identifies all patterns in sub-graphs that match the expression. The expression select two attributes a1 and a2 with the type of concept name, which indicates that they are activities' names. Then, it selects all incoming events to those attributes where there is a direct relationship between those two events. The return clause retrieves all combinations of attributes in addition to the number of total direct relations between their events, which is the calculation that we formalized in Algorithm 1.
To limit the number of events base on their timestamp, we can easily add a where clause to the cypher query to limit the timestamp. For other attributes, the associated attribute node can be filtered.
This section reports the evaluation result, which is done by calculating DFG using our approach and process mining for python (pm4py) library [5] based on a real public log file [8] . This dataset is selected because it is published openly, which makes the experiment repeatable. It is also the biggest log file that we could find in the BPI challenges, which can help us to evaluate the performance.
To evaluate the performance, we need to control the resources that are available for performing process mining. Thus, we decided to containerize the experiments and run them with Docker. Docker is a Platform as a Service (PaaS) product that enables creating, running, and managing containers. It also enables the control of the resources that are available for each container, such as RAM and CPU.
Among different process mining tools, we chose process mining for python (pm4py) library [5] , because i) it is open-source; ii) the DFG calculation step and discovery step can be separated easily, and iii) it can easily be encapsulated in a container. The separation of DFG calculation and discovery step in this library also enables reusing all discovery algorithms along using our approach, which makes our approach very reusable.
We designed two experiment to evaluate our approach, which are listed in Table5 1 . In Experiment 1, we loaded the whole log file into both containers The dicing is done based on a time constraint, and we added more days in an accumulative way to increase the number of events. We ran the experiments for each container separately to make sure that the assigned resources are free and available.
To simulate the situation where the computational memory is less than the log size, we started by assigning 512 megabytes of ram to each container. We added the same amount of RAM in each experiment round until we reached 4 gigabytes. We also changed the CPU starting from half of a CPU (0.5), adding by the same amount in each round until we reached 4.0. Fig.4 shows the execution result for both containers, where the x, y and z axes refer to the available memory (RAM) (in megabytes), DFG calculation time (in seconds), and available CPU quotes, respectively. The experiment related to neo4j and pm4py containers is plotted by red and blue, respectively. As can be Fig. 4 . Evaluating DFG calculation time by scaling resources seen, pm4py could not compute DFG when the memory was less than the size of the log, i.e., around 1.5 gigabytes, while neo4j could calculate DFG in that setting. This shows that the graph database can compute DFG when computational memory is less than the log size, which is an enabler when applying process mining on a very large volume of data.
As it can be seen in the figure, the increasing amount of memory reduced the time that neo4j computed the DFG, while it has very little effect on pm4py. This is no surprise for in-memory calculation since if the log fits the memory, then the performance will not be increased much by adding more memory. It is also visible that assigning more CPU does not affect the performance of either of these approaches.
It should also be mentioned that despite increasing memory can reduce the DFG calculation time for neo4j significantly; it cannot be faster than pm4py when calculating the DFG on the complete log file. The reason can be that graph databases shall process metadata, which adds more computation than in-memory calculation approaches. Thus, for small log files that can fit the computer's memory, the in-memory approach can be better if the security and access control are not necessary.
Event logs usually contain different variations that exist in the enactment of business processes [6] . These variations make process mining challenging because discovering the process based on the whole even logs usually produces so-called spaghetti models, which usually cannot be comprehended by humans, so they have very little value. Thus, analysts need to filter data to produce a meaningful model, which is a common practice in applying process mining [6, 15] . Therefore, we designed this experience to compare our approach and pm4py when calculating DFG on a filtered subset of data.
To evaluate this scenario, we kept the resources (RAM and CPU) constant for both containers, but we changed the condition based on which the data was filtered. This means that we kept the number of events in the log as a variable. We assigned 14 Gb for RAM and 4 CPU for each container, which was run separately. We diced the data in both settings by filtering events that happened during the first day; then, we added one more day to the filter condition to increase the events in an accumulative way. We repeated this step for almost four months. In this way, we could compare the performance by considering how the size of the filtered events affects the performance of calculating DFG. Fig.5 shows the evaluation result, where the x and y axes refer to the number of events (in millions) and DFG calculation time (in seconds). As can be seen, our approach performed better when the number of events is less than 2 million. Note that this is still a very big sub-log to analyze for process mining, so this shows that our approach can improve the performance of process mining when dealing with sub-set of the log. However, pm4py performed better when the number of events exceeded 2 million. This is no surprise since pm4py loaded logs into memory first, so increasing the size will have less effect on its performance. 
This section discusses the relationship between our approach to other research work. The related work can be divided into three categories reflecting those that are about scalability, preserving privacy, and using graph databases in process mining.
The scalability issue in process mining is a big concern for applying the techniques on a large volume of data. Thus, different researchers investigated this problem through different techniques. Hernández [14] . The evaluation of their approach shows a similar trend for a performance like what we presented in Fig.5 . The performance cannot be compared precisely due to different setup and resources. This is the closest approach to ours. The advantage of our approach can be considered as the capability to preserve privacy while computing DFG.
MapReduce has used by other researchers for the aim of process mining, e.g., [10, 25] . As discussed by [14] , MapReduce has used to support only event correlation discovery in [25] , and it is used to discover process models using Alpha Miner and the Flexible Heuristics Miner in [10] .
This paper does not directly contribute to preserving privacy issues in process mining; however, it enables new sort of support by enabling the use of fine-grain access controls, which are supported by Graph Databases, in particular Neo4j.
Preserving privacy in process mining is an important issue that recently got a lot of attention due to its importance. Mannhardt F. et al. describes guidelines for privacy in the process mining area [21] . As technological privacy challenges, authors mentioned the aggregation challenge that deals with enabling an analysis on aggregated event information without exposing the information at the individual level. The approach in this paper can well address this issue due to access control capabilities that exist in Neo4j. There are potentials to address other challenges using our approach, but the discussion is out of the scope of this paper.
Pika A. et al., proposed a framework for privacy-preserving when applying process mining in healthcare domain [23] . They extend the work in [24] , where they discussed the result of applying some techniques in other domains. As mentioned by authors, there might be needs for techniques like access control even after the data anonymization for output results. Our approach enables access control in one step before, i.e., DFG computation, and it does not address other issues in other steps.
There is also recent work to support the privacy issue in process mining like [4, 11, 12, 20, 22] , but as the best of our knowledge, no approach applied access control and security when computing DFG.
There are different attempts to use graph databases with process mining. Still, as our best of knowledge, none of the approaches supports shifting the calculation of DFG to a graph database. Thus, none of them can perform better than a traditional approach like pm4py. Esser S. and Fahland D. used the graph database to query multi-dimensional aspects from event logs. This is one important use case that has been introduced by a graph database, i.e., adding more features to the data [9] . They have used Neo4j as the graph database and used Cypher to query the logs. The approach uses a graph database as a log repository to sore data without any predefined structure, which is quite different from the topic of this paper. In this regard, the approach is similar to [7] , where a relational database is used to store the data. The main difference is that [9] demonstrates that the graph database has more capability to add more features to data, which is a very important topic in any machine learning related approach in general.
Joishi J. and Sureka A. also used a graph database for storing non-structured event logs [16, 17] . They also demonstrated that Actor-activity matrix could be calculated using Cypher. However, the approach is context-dependent since the logs are not standardized like our approach. Also, the approach cannot be used with other process discovery algorithm since it does not shift and separate the computation of DFG to a graph database.
This paper introduced and formalized a new approach to support process mining using graph databases. The approach defines how log files shall be stored in a graph database, and it also defined how Directly Follows Graph (DFG) can be calculated in the graph database. The approach is evaluated in comparison with pm4py by applying on a real log file. The evaluation result shows that the approach supports mining processes when the event log is bigger than computational memory. It also shows that it is scalable, and the performance is better when dicing the event log in a small chunk. The paper also discussed how this approach supports preserving privacy while computing DFG, which is an important topic in applying process mining in practice.
As future work, we intend to optimize our approach in terms of performance. Also, we intend to do some case studies to show how this approach supports privacy Preserving in practice. We also intend to develop a new library to support the use of a graph database for process mining for practitioners and researchers.