You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The CFPQ_PyAlgo is a repository for developing, testing and benchmarking algorithms that solve Formal-Language-Constrained Path Problems, such as Context-Free Path Queries and Regular Path Queries. All algorithms are based on the [GraphBLAS](http://graphblas.org/index.php?title=Graph_BLAS_Forum) framework that allows you to represent graphs as matrices and work with them in terms of linear algebra. For convenience, all the code is written in Python using [pygraphblas](https://github.com/michelp/pygraphblas) or in C/C++ using purely [SuiteSparse](https://github.com/DrTimothyAldenDavis/SuiteSparse/tree/master/GraphBLAS) with a Python wrapper.
3
+
The CFPQ_PyAlgo is a repository for developing, testing and evaluating solvers for
4
+
Formal-Language-Constrained Path Problems, such as Context-Free Path Queries and Regular Path Queries.
5
5
6
-
# Installation
6
+
All algorithms are based on the [GraphBLAS](http://graphblas.org/index.php?title=Graph_BLAS_Forum) framework that allows to represent graphs as matrices
7
+
and work with them in terms of linear algebra.
8
+
9
+
## Installation
7
10
First of all you need to clone repository with its submodules:
8
11
9
12
```bash
@@ -12,26 +15,27 @@ cd CFPQ_PyAlgo/
12
15
git submodule init
13
16
git submodule update
14
17
```
15
-
Then the easiest way to get started is to use Docker. An alternative, which is more correct, is to install everything directly.
18
+
Then the easiest way to get started is to use Docker. An alternative is to install everything directly.
16
19
17
-
## Using Docker
20
+
###Using Docker
18
21
The first way to start is to use Docker:
19
22
20
23
```bash
21
24
# build docker image
22
-
docker build --tag <some_tag>.
25
+
docker build --tag cfpq_py_algo.
23
26
24
27
# run docker container
25
-
docker run --rm -it -v ${PWD}:/CFPQ_PyAlgo <some_tag> bash
28
+
docker run --rm -it -v ${PWD}:/CFPQ_PyAlgo cfpq_py_algo bash
26
29
```
27
-
After it you can develop everything locally and run tests and benchmarks inside the container. Also you can use PyCharm and [configure an interpreter using Docker](https://www.jetbrains.com/help/pycharm/using-docker-as-a-remote-interpreter.html).
30
+
After it, you can develop everything locally and run tests and benchmarks inside the container.
31
+
Also, you can use PyCharm Professional and [configure an interpreter using Docker](https://www.jetbrains.com/help/pycharm/using-docker-as-a-remote-interpreter.html).
28
32
29
-
## Direct install
30
-
The correct way is to install everything into your local python interpreter or virtual environment.
33
+
###Direct install
34
+
The other way is to install everything into your local python interpreter or virtual environment.
31
35
32
36
First of all you need to install [pygraphblas](https://github.com/michelp/pygraphblas) package.
33
37
```bash
34
-
pip3 install pygraphblas
38
+
pip3 install pygraphblas==5.1.8.0
35
39
```
36
40
Secondly you need to install cfpq_data_devtools package and other requirements:
37
41
@@ -47,56 +51,32 @@ To check if the installation was successful you can run simple tests
47
51
```bash
48
52
python3 -m pytest test -v -m "CI"
49
53
```
50
-
# Benchmark
51
-
Look please [Readme](https://github.com/JetBrains-Research/CFPQ_PyAlgo/blob/master/benchmark/README.md) in *benchmark*
52
-
53
-
# Usage
54
-
55
-
Let's describe an example of using the implementation outside this environment.
56
54
57
-
For example, you want to solve a basic problem CFPQ using the matrix algorithm. To do this, you need a context-free grammar (**Gr**), as well as a graph (**G**) in the format of "triplets".
55
+
## CLI
56
+
CFPQ_Algo provides a command line interface for running
57
+
all-pairs CFPQ solver with relation query semantics.
58
58
59
-
Then the matrix algorithm can be run as follows, where *PATH_TO_GRAMMAR* --- path to file with **Gr**, *PATH_TO_GRAPH* --- path to file with **G**
59
+
See [cfpq_cli/README](cfpq_cli/README.md) for more details.
60
60
61
-
```cython
62
-
from src.problems.Base.algo.matrix_base.matrix_base import MatrixBaseAlgo
63
-
from cfpq_data import cfg_from_txt
64
-
from src.graph.graph import Graph
61
+
## Evaluation
65
62
66
-
from pathlib import Path
63
+
CFPQ_PyAlgo provides scripts for performing evaluating performance
64
+
of various CFPQ solvers (icluding third-party ones).
Copy file name to clipboardExpand all lines: benchmark/README.md
+15-3Lines changed: 15 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,14 @@
1
-
# How to start
1
+
# LEGACY WARNING
2
+
3
+
This folder contains benchmarks for legacy CFPQ implementations.
4
+
5
+
New optimized CFPQ implementations are being implemented in [cfpq_algo](../cfpq_algo) folder
6
+
and can be evaluated with scripts in [cfpq_eval](../cfpq_eval) folder.
7
+
8
+
<details>
9
+
<summary>Full README</summary>
10
+
11
+
## How to start
2
12
First, create a directory for the dataset. It should have two subdirectories for graphs (Graphs) and grammars (Grammars). In the second step, select an algorithm for benchmarking. Then run the command:
-`ALGORITHM` selects the algorithm. The available options are `IncrementalAllPairsCFLReachabilityMatrix` and `NonIncrementalAllPairsCFLReachabilityMatrix`.
30
+
-`GRAPH` specifies the path to the graph file.
31
+
-`GRAMMAR` indicates the path to the grammar file.
32
+
33
+
#### Optional Arguments
34
+
35
+
-`--time-limit TIME_LIMIT` sets the maximum execution time in seconds.
36
+
-`--out OUT` specifies the output file for saving vertex pairs.
37
+
-`--disable-optimize-block-matrix` disables the optimization of block matrices.
38
+
-`--disable-optimize-empty` disables the optimization for empty matrices.
0 commit comments