├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ ├── feature_request.md │ ├── grammar-add-template.md │ └── graph-add-template.md ├── PULL_REQUEST_TEMPLATE │ ├── new_grammar.md │ └── new_graph.md └── workflows │ ├── coverage.yml │ ├── deploy_docs.yml │ ├── lint.yml │ └── tests.yml ├── .gitignore ├── .pre-commit-config.yaml ├── LICENSE.txt ├── README.rst ├── cfpq_data ├── __init__.py ├── config.py ├── dataset │ ├── __init__.py │ └── data.py ├── grammars │ ├── __init__.py │ ├── converters │ │ ├── __init__.py │ │ ├── cfg.py │ │ └── cnf.py │ ├── generators │ │ ├── __init__.py │ │ ├── c_alias_grammar.py │ │ ├── dyck_grammar.py │ │ ├── java_points_to_grammar.py │ │ └── nested_parentheses_grammar.py │ ├── readwrite │ │ ├── __init__.py │ │ ├── cfg.py │ │ ├── cnf.py │ │ ├── regex.py │ │ └── rsa.py │ └── utils │ │ ├── __init__.py │ │ └── change_terminals.py └── graphs │ ├── __init__.py │ ├── generators │ ├── __init__.py │ ├── fast_labeled_binomial_graph.py │ ├── labeled_barabasi_albert_graph.py │ ├── labeled_binomial_graph.py │ ├── labeled_cycle_graph.py │ ├── labeled_scale_free_graph.py │ └── labeled_two_cycles_graph.py │ ├── readwrite │ ├── __init__.py │ ├── csv.py │ ├── rdf.py │ └── txt.py │ └── utils │ ├── __init__.py │ ├── add_reverse_edges.py │ ├── change_edges.py │ ├── edges_statistics.py │ ├── filter_edges.py │ ├── multiple_source_utils.py │ └── nodes_to_integers.py ├── docs ├── .nojekyll ├── Makefile ├── README.md ├── _static │ ├── css │ │ ├── about.css │ │ ├── copybutton.css │ │ └── custom.css │ └── img │ │ └── CFPQDataLogo.svg ├── _templates │ └── layout.html ├── about.rst ├── benchmarks │ ├── data │ │ └── ms_reachability.rst │ └── index.rst ├── conf.py ├── grammars │ ├── data │ │ ├── c_alias.rst │ │ ├── dyck.rst │ │ ├── java_points_to.rst │ │ └── nested_parentheses.rst │ └── index.rst ├── graphs │ ├── data │ │ ├── apache.rst │ │ ├── arch.rst │ │ ├── atom.rst │ │ ├── avrora.rst │ │ ├── batik.rst │ │ ├── biomedical.rst │ │ ├── block.rst │ │ ├── bzip.rst │ │ ├── core.rst │ │ ├── crypto.rst │ │ ├── drivers.rst │ │ ├── eclass.rst │ │ ├── eclipse.rst │ │ ├── enzyme.rst │ │ ├── foaf.rst │ │ ├── fop.rst │ │ ├── fs.rst │ │ ├── funding.rst │ │ ├── generations.rst │ │ ├── geospecies.rst │ │ ├── go.rst │ │ ├── go_hierarchy.rst │ │ ├── gzip.rst │ │ ├── h2.rst │ │ ├── init.rst │ │ ├── ipc.rst │ │ ├── jython.rst │ │ ├── kernel.rst │ │ ├── lib.rst │ │ ├── ls.rst │ │ ├── luindex.rst │ │ ├── lusearch.rst │ │ ├── mm.rst │ │ ├── net.rst │ │ ├── pathways.rst │ │ ├── people.rst │ │ ├── pizza.rst │ │ ├── pmd.rst │ │ ├── postgre.rst │ │ ├── pr.rst │ │ ├── security.rst │ │ ├── skos.rst │ │ ├── sound.rst │ │ ├── sunflow.rst │ │ ├── taxonomy.rst │ │ ├── taxonomy_hierarchy.rst │ │ ├── tomcat.rst │ │ ├── tradebeans.rst │ │ ├── tradesoap.rst │ │ ├── travel.rst │ │ ├── univ.rst │ │ ├── wc.rst │ │ ├── wine.rst │ │ └── xalan.rst │ └── index.rst ├── index.rst ├── install.rst ├── license.rst ├── reference │ ├── dataset │ │ └── index.rst │ ├── grammars │ │ ├── grammars_converters.rst │ │ ├── grammars_generators.rst │ │ ├── grammars_readwrite.rst │ │ ├── grammars_utils.rst │ │ └── index.rst │ ├── graphs │ │ ├── graphs_generators.rst │ │ ├── graphs_readwrite.rst │ │ ├── graphs_utils.rst │ │ └── index.rst │ └── index.rst └── tutorial.rst ├── pyproject.toml ├── requirements.txt ├── requirements ├── README.md ├── default.txt ├── developer.txt ├── docs.txt └── tests.txt ├── setup.py ├── tests ├── dataset │ └── test_data.py ├── grammars │ ├── converters │ │ ├── test_cfg_converters.py │ │ └── test_cnf_converters.py │ ├── generators │ │ ├── test_c_alias_grammar.py │ │ ├── test_dyck_grammar.py │ │ ├── test_java_points_to_grammar.py │ │ └── test_nested_parentheses_grammar.py │ ├── readwrite │ │ ├── test_cfg_readwrite.py │ │ ├── test_cnf_readwrite.py │ │ ├── test_regex_readwrite.py │ │ └── test_rsa_readwrite.py │ └── utils │ │ └── test_change_terminals.py └── graphs │ ├── generators │ ├── test_fast_labeled_binomial_graph.py │ ├── test_labeled_barabasi_albert_graph.py │ ├── test_labeled_binomial_graph.py │ ├── test_labeled_cycle_graph.py │ ├── test_labeled_scale_free_graph.py │ └── test_labeled_two_cycles_graph.py │ ├── readwrite │ ├── test_rdf.py │ └── test_txt.py │ └── utils │ ├── test_add_reverse_edges.py │ ├── test_change_edges.py │ ├── test_edges_statistics.py │ ├── test_filter_edges.py │ ├── test_multiple_source_utils.py │ └── test_nodes_to_integers.py └── utils ├── config.py ├── fetch_dataset.py └── update_dataset_tables.py /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: BUG REPORT 3 | about: Create a report to help us improve 4 | title: "[BUG] " 5 | labels: bug 6 | assignees: vdshk 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Desktop (please complete the following information):** 27 | - OS: `[e.g. Ubuntu 20.04]` 28 | - CFPQ_Data: `[e.g. 22]` 29 | - Python: `[e.g. 3.8]` 30 | - Other important stuff versions 31 | 32 | **Additional context** 33 | Add any other context about the problem here. 34 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: FEATURE REQUEST 3 | about: Suggest an idea for this project 4 | title: "[FEATURE] " 5 | labels: enhancement 6 | assignees: vdshk 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/grammar-add-template.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: ADD NEW GRAMMAR 3 | about: Suggest new grammar template to this project 4 | title: "[NEW GRAMMAR] " 5 | labels: new data 6 | assignees: rustam-azimov, vadyushkins 7 | 8 | --- 9 | 10 | 11 | 12 | ## Info 13 | | | | 14 | |-----------|------------------------------------------------------------------------| 15 | | Full Name | ```` | 16 | | Version | ```` | 17 | | Class | ```` | 18 | | Kind | ```` | 19 | | Origin | [link](````) | 20 | 21 | ## Grammar Parameters 22 | 23 | | Parameter | Description | 24 | |:------------------------------------:|:---------------------------------------:| 25 | | ```` | ```` | 26 | 27 | ## Grammar Template 28 | 29 | 30 | 31 | ## Grammar Description 32 | 33 | 34 | 35 | ## Example Grammars 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/graph-add-template.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: ADD NEW GRAPH 3 | about: Suggest new graph to this project 4 | title: "[NEW GRAPH] " 5 | labels: new data 6 | assignees: rustam-azimov, vadyushkins 7 | 8 | --- 9 | 10 | 11 | 12 | ## Info 13 | | | | 14 | |---|---| 15 | | Full Name | ```` | 16 | | Version | ```` | 17 | | Origin | [link](````) | 18 | 19 | ## CSV File Structure 20 | 21 | | Column Number | Column Type | Column Description | 22 | |:---:|:---:|---| 23 | | 1 | int | The tail of the edge | 24 | | 2 | int | The head of the edge | 25 | | 3 | str | The label of the edge | 26 | 27 | ## Graph Statistics 28 | | Num Nodes | Num Edges | 29 | |:---:|:---:| 30 | | ```` | ```` | 31 | 32 | ## Edges Statistics 33 | | Edge Label | Num Edge Label | 34 | |---:|---:| 35 | | ```` | ```` | 36 | 37 | ## Canonical grammars 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE/new_grammar.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | ## Info 4 | | | | 5 | |-----------|------------------------------------------------------------------------| 6 | | Full Name | ```` | 7 | | Version | ```` | 8 | | Class | ```` | 9 | | Kind | ```` | 10 | | Origin | [link](````) | 11 | 12 | ## Grammar Parameters 13 | 14 | | Parameter | Description | 15 | |:------------------------------------:|:---------------------------------------:| 16 | | ```` | ```` | 17 | 18 | ## Grammar Template 19 | 20 | 21 | 22 | ## Grammar Description 23 | 24 | 25 | 26 | ## Example Grammars 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE/new_graph.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | ## Info 4 | | | | 5 | |---|---| 6 | | Full Name | ```` | 7 | | Version | ```` | 8 | | Origin | [link](````) | 9 | 10 | ## CSV File Structure 11 | 12 | | Column Number | Column Type | Column Description | 13 | |:---:|:---:|---| 14 | | 1 | int | The tail of the edge | 15 | | 2 | int | The head of the edge | 16 | | 3 | str | The label of the edge | 17 | 18 | ## Graph Statistics 19 | | Num Nodes | Num Edges | 20 | |:---:|:---:| 21 | | ```` | ```` | 22 | 23 | ## Edges Statistics 24 | | Edge Label | Num Edge Label | 25 | |---:|---:| 26 | | ```` | ```` | 27 | 28 | ## Canonical grammars 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /.github/workflows/coverage.yml: -------------------------------------------------------------------------------- 1 | name: Code coverage 2 | 3 | on: [ push, pull_request ] 4 | 5 | jobs: 6 | report: 7 | runs-on: ubuntu-latest 8 | strategy: 9 | matrix: 10 | python-version: [ 3.9 ] 11 | steps: 12 | - uses: actions/checkout@v3 13 | 14 | - name: Set up Python ${{ matrix.python-version }} 15 | uses: actions/setup-python@v4 16 | with: 17 | python-version: ${{ matrix.python-version }} 18 | 19 | - name: Install packages 20 | run: | 21 | python -m pip install --upgrade pip wheel setuptools 22 | python -m pip install -r requirements.txt 23 | python -m pip install -r requirements/tests.txt 24 | python -m pip install . 25 | python -m pip list 26 | 27 | - name: Test CFPQ_Data with coverage 28 | run: | 29 | pytest --cov=cfpq_data --doctest-modules -vv -s cfpq_data tests 30 | codecov 31 | -------------------------------------------------------------------------------- /.github/workflows/deploy_docs.yml: -------------------------------------------------------------------------------- 1 | name: Deploy docs 2 | 3 | on: 4 | push: 5 | branches: [ master ] 6 | 7 | jobs: 8 | documentation: 9 | # Do not attempt to deploy documentation on forks 10 | if: github.repository_owner == 'FormalLanguageConstrainedPathQuerying' 11 | runs-on: ubuntu-latest 12 | strategy: 13 | matrix: 14 | python-version: [ 3.9 ] 15 | steps: 16 | - uses: actions/checkout@v3 17 | 18 | - name: Set up Python ${{ matrix.python-version }} 19 | uses: actions/setup-python@v4 20 | with: 21 | python-version: ${{ matrix.python-version }} 22 | 23 | - name: Install packages 24 | run: | 25 | python -m pip install --upgrade pip wheel setuptools 26 | python -m pip install -r requirements.txt 27 | python -m pip install -r requirements/docs.txt 28 | python -m pip install . 29 | python -m pip list 30 | 31 | - name: Build 32 | run: make -C docs/ html 33 | 34 | - name: Deploy 35 | uses: JamesIves/github-pages-deploy-action@4.1.3 36 | with: 37 | branch: gh-pages # The branch the action should deploy to. 38 | folder: docs/_build/html # The folder the action should deploy. 39 | -------------------------------------------------------------------------------- /.github/workflows/lint.yml: -------------------------------------------------------------------------------- 1 | name: Code style check 2 | 3 | on: [ push, pull_request ] 4 | 5 | jobs: 6 | style: 7 | runs-on: ubuntu-latest 8 | strategy: 9 | matrix: 10 | python-version: [ 3.9 ] 11 | steps: 12 | - uses: actions/checkout@v3 13 | 14 | - name: Set up Python ${{ matrix.python-version }} 15 | uses: actions/setup-python@v4 16 | with: 17 | python-version: ${{ matrix.python-version }} 18 | 19 | - name: Install pre-commit 20 | run: | 21 | python -m pip install pre-commit==3.6.2 22 | pre-commit install 23 | 24 | - name: Run pre-commit 25 | run: | 26 | pre-commit run --all-files --color always --verbose --show-diff-on-failure 27 | -------------------------------------------------------------------------------- /.github/workflows/tests.yml: -------------------------------------------------------------------------------- 1 | name: Continuous integration 2 | 3 | on: [ push, pull_request ] 4 | 5 | jobs: 6 | tests: 7 | runs-on: ${{ matrix.os }} 8 | strategy: 9 | matrix: 10 | os: [ 11 | ubuntu-latest, 12 | macos-latest, 13 | windows-latest, 14 | ] 15 | python-version: [ 3.9 ] 16 | steps: 17 | - uses: actions/checkout@v3 18 | 19 | - name: Set up Python ${{ matrix.python-version }} 20 | uses: actions/setup-python@v4 21 | with: 22 | python-version: ${{ matrix.python-version }} 23 | 24 | - name: Install packages 25 | run: | 26 | python -m pip install --upgrade pip wheel setuptools 27 | python -m pip install -r requirements.txt 28 | python -m pip install -r requirements/tests.txt 29 | python -m pip install . 30 | python -m pip list 31 | 32 | - name: Test CFPQ_Data 33 | run: | 34 | pytest --doctest-modules -vv -s cfpq_data tests 35 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # IDEA 2 | .idea 3 | 4 | # Data 5 | cfpq_data/data 6 | 7 | # Byte-compiled / optimized / DLL files 8 | __pycache__/ 9 | *.py[cod] 10 | *$py.class 11 | 12 | # C extensions 13 | *.so 14 | 15 | # Distribution / packaging 16 | .Python 17 | build/ 18 | develop-eggs/ 19 | dist/ 20 | downloads/ 21 | eggs/ 22 | .eggs/ 23 | lib/ 24 | lib64/ 25 | parts/ 26 | sdist/ 27 | var/ 28 | wheels/ 29 | *.egg-info/ 30 | .installed.cfg 31 | *.egg 32 | MANIFEST 33 | 34 | # PyInstaller 35 | # Usually these files are written by a python script from a template 36 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 37 | *.manifest 38 | *.spec 39 | 40 | # Installer logs 41 | pip-log.txt 42 | pip-delete-this-directory.txt 43 | 44 | # Unit test / coverage reports 45 | htmlcov/ 46 | .tox/ 47 | .coverage 48 | .coverage.* 49 | .cache 50 | nosetests.xml 51 | coverage.xml 52 | *.cover 53 | .hypothesis/ 54 | .pytest_cache/ 55 | 56 | # Doctest files 57 | test.txt 58 | test.xml 59 | 60 | # Translations 61 | *.mo 62 | *.pot 63 | 64 | # Django stuff: 65 | *.log 66 | local_settings.py 67 | db.sqlite3 68 | 69 | # Flask stuff: 70 | instance/ 71 | .webassets-cache 72 | 73 | # Scrapy stuff: 74 | .scrapy 75 | 76 | # Sphinx documentation 77 | docs/_build/ 78 | docs/*/generated/* 79 | docs/*/*/generated/* 80 | 81 | # PyBuilder 82 | target/ 83 | 84 | # Jupyter Notebook 85 | .ipynb_checkpoints 86 | 87 | # pyenv 88 | .python-version 89 | 90 | # celery beat schedule file 91 | celerybeat-schedule 92 | 93 | # SageMath parsed files 94 | *.sage.py 95 | 96 | # Environments 97 | .env 98 | .venv 99 | env/ 100 | venv/ 101 | ENV/ 102 | env.bak/ 103 | venv.bak/ 104 | 105 | # Spyder project settings 106 | .spyderproject 107 | .spyproject 108 | 109 | # Rope project settings 110 | .ropeproject 111 | 112 | # VSCode stuff 113 | **/.vscode/* 114 | *.code-workspace 115 | 116 | # mkdocs documentation 117 | /site 118 | 119 | # mypy 120 | .mypy_cache/ 121 | 122 | **/Matrices/ 123 | 124 | *.xz 125 | 126 | *.gz 127 | 128 | GTgraph/ 129 | 130 | log 131 | 132 | tmp.txt 133 | 134 | # MacOS directory structure meta 135 | /**/.DS_Store 136 | -------------------------------------------------------------------------------- /.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | repos: 2 | - repo: https://github.com/pre-commit/pre-commit-hooks 3 | rev: v4.3.0 4 | hooks: 5 | - id: check-yaml 6 | - id: end-of-file-fixer 7 | - id: trailing-whitespace 8 | - id: requirements-txt-fixer 9 | - repo: https://github.com/psf/black 10 | rev: 22.10.0 11 | hooks: 12 | - id: black 13 | -------------------------------------------------------------------------------- /README.rst: -------------------------------------------------------------------------------- 1 | CFPQ_Data 2 | ========= 3 | 4 | .. image:: https://github.com/FormalLanguageConstrainedPathQuerying/CFPQ_Data/actions/workflows/tests.yml/badge.svg?branch=master 5 | :target: https://github.com/FormalLanguageConstrainedPathQuerying/CFPQ_Data/actions/workflows/tests.yml 6 | 7 | .. image:: https://codecov.io/gh/FormalLanguageConstrainedPathQuerying/CFPQ_Data/branch/master/graph/badge.svg?token=6IAZM6KZT7 8 | :target: https://codecov.io/gh/FormalLanguageConstrainedPathQuerying/CFPQ_Data 9 | 10 | .. image:: https://img.shields.io/pypi/v/cfpq-data.svg 11 | :target: https://pypi.org/project/cfpq-data/ 12 | 13 | .. image:: https://img.shields.io/pypi/pyversions/cfpq-data.svg 14 | :target: https://pypi.org/project/cfpq-data/ 15 | 16 | .. image:: https://img.shields.io/badge/code%20style-black-000000.svg 17 | :target: https://github.com/ambv/black 18 | 19 | .. image:: https://img.shields.io/badge/License-Apache%202.0-blue.svg 20 | :target: https://github.com/FormalLanguageConstrainedPathQuerying/CFPQ_Data/blob/master/LICENSE.txt 21 | 22 | CFPQ_Data is a Python package for the creation, manipulation, and study of the 23 | structure, dynamics, and functions of complex Graphs and Grammars used for 24 | experimental analysis of Context-Free Path Querying algorithms. 25 | 26 | - **Website:** https://formallanguageconstrainedpathquerying.github.io/CFPQ_Data 27 | - **Tutorial:** https://formallanguageconstrainedpathquerying.github.io/CFPQ_Data/tutorial.html 28 | - **Documentation:** https://formallanguageconstrainedpathquerying.github.io/CFPQ_Data/reference/index.html 29 | - **Source Code:** https://github.com/formallanguageconstrainedpathquerying/CFPQ_Data 30 | - **Bug Tracker:** https://github.com/formallanguageconstrainedpathquerying/CFPQ_Data/issues 31 | 32 | Examples 33 | ******** 34 | 35 | Dataset content 36 | --------------- 37 | 38 | .. code-block:: python 39 | 40 | >>> import cfpq_data 41 | >>> cfpq_data.DATASET 42 | ['skos', 'wc', 'generations', 'travel', 'univ', 'atom', 'biomedical', 'bzip', 'foaf', 'people', 'pr', 'funding', 'ls', 'wine', 'pizza', 'gzip', 'core', 'pathways', 'enzyme', 'eclass', 'go_hierarchy', 'go', 'apache', 'init', 'mm', 'geospecies', 'ipc', 'lib', 'block', 'arch', 'crypto', 'security', 'sound', 'net', 'fs', 'drivers', 'postgre', 'kernel', 'taxonomy', 'taxonomy_hierarchy'] 43 | 44 | Load graph from Dataset 45 | ----------------------- 46 | 47 | .. code-block:: python 48 | 49 | >>> bzip_path = cfpq_data.download("bzip") 50 | >>> bzip = cfpq_data.graph_from_csv(bzip_path) 51 | 52 | How to add a new graph? 53 | *********************** 54 | 55 | Just create 56 | 57 | - an ``Issue`` corresponding to the `"Issue template for adding a new graph" `_. 58 | - a ``Pull Request`` corresponding to the `"Pull request template for adding a new graph" `_. 59 | -------------------------------------------------------------------------------- /cfpq_data/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | CFPQ_Data 3 | ========= 4 | 5 | CFPQ_Data is a Python package for the creation, manipulation, and study of the 6 | structure, dynamics, and functions of complex Graphs and Grammars used for 7 | experimental analysis of context-free path querying algorithms 8 | """ 9 | 10 | import cfpq_data.config 11 | from cfpq_data.config import * 12 | 13 | __version__ = VERSION 14 | 15 | import cfpq_data.dataset 16 | from cfpq_data.dataset import * 17 | 18 | import cfpq_data.graphs 19 | from cfpq_data.graphs import * 20 | 21 | import cfpq_data.grammars 22 | from cfpq_data.grammars import * 23 | 24 | import logging 25 | 26 | logging.basicConfig( 27 | level=logging.INFO, 28 | format="[%(asctime)s]>%(levelname)s>%(message)s", 29 | datefmt="%Y-%m-%d %H:%M:%S", 30 | ) 31 | -------------------------------------------------------------------------------- /cfpq_data/config.py: -------------------------------------------------------------------------------- 1 | import pathlib 2 | 3 | __all__ = [ 4 | "VERSION", 5 | "ROOT", 6 | "DATA", 7 | "GRAPHS_DIR", 8 | "GRAMMARS_DIR", 9 | "BENCHMARKS_DIR", 10 | ] 11 | 12 | VERSION = "4.0.3" 13 | 14 | ROOT = pathlib.Path(__file__).parent 15 | DATA = ROOT / "data" 16 | GRAPHS_DIR = DATA / "graphs" 17 | GRAMMARS_DIR = DATA / "grammars" 18 | BENCHMARKS_DIR = DATA / "benchmarks" 19 | -------------------------------------------------------------------------------- /cfpq_data/dataset/__init__.py: -------------------------------------------------------------------------------- 1 | from cfpq_data.dataset.data import * 2 | -------------------------------------------------------------------------------- /cfpq_data/grammars/__init__.py: -------------------------------------------------------------------------------- 1 | from cfpq_data.grammars.converters import * 2 | from cfpq_data.grammars.generators import * 3 | from cfpq_data.grammars.readwrite import * 4 | from cfpq_data.grammars.utils import * 5 | -------------------------------------------------------------------------------- /cfpq_data/grammars/converters/__init__.py: -------------------------------------------------------------------------------- 1 | from cfpq_data.grammars.converters.cfg import * 2 | from cfpq_data.grammars.converters.cnf import * 3 | -------------------------------------------------------------------------------- /cfpq_data/grammars/generators/__init__.py: -------------------------------------------------------------------------------- 1 | from cfpq_data.grammars.generators.c_alias_grammar import * 2 | from cfpq_data.grammars.generators.dyck_grammar import * 3 | from cfpq_data.grammars.generators.java_points_to_grammar import * 4 | from cfpq_data.grammars.generators.nested_parentheses_grammar import * 5 | -------------------------------------------------------------------------------- /cfpq_data/grammars/generators/c_alias_grammar.py: -------------------------------------------------------------------------------- 1 | """Returns a C Alias grammar that generates a language for the flow-insensitive alias analysis of C programs.""" 2 | import logging 3 | from typing import Tuple 4 | from pyformlang.cfg import CFG, Variable 5 | 6 | import cfpq_data 7 | 8 | __all__ = ["c_alias_grammar"] 9 | 10 | 11 | def c_alias_grammar( 12 | *, 13 | assigment_labels: Tuple[str, str] = ("a", "a_r"), 14 | dereference_labels: Tuple[str, str] = ("d", "d_r"), 15 | start_symbol: Variable = Variable("S"), 16 | ) -> CFG: 17 | """Returns a C Alias grammar that generates a language for the flow-insensitive alias analysis of C programs [1]_. 18 | 19 | Parameters 20 | ---------- 21 | assigment_labels : Tuple[str, str] 22 | Pair $(a, a_r)$ where label $a$ represents the assignment operation and $a_r$ is reverse to it. 23 | 24 | dereference_labels : Tuple[str, str] 25 | Pair $(d, d_r)$ where label $d$ represents pointer dereference relation and $d_r$ is reverse to it. 26 | 27 | start_symbol : Variable 28 | Start symbol of the grammar. 29 | 30 | Examples 31 | -------- 32 | >>> from cfpq_data import * 33 | >>> cfg = c_alias_grammar() 34 | >>> cfg_to_text(cfg) 35 | 'S -> d_r V d\\nV -> V1 V2 V3\\nV1 -> \\nV1 -> V2 a_r V1\\nV2 -> \\nV2 -> S\\nV3 -> \\nV3 -> a V2 V3' 36 | 37 | Returns 38 | ------- 39 | cfg : CFG 40 | C Alias context-free grammar. 41 | 42 | References 43 | ---------- 44 | .. [1] https://dl.acm.org/doi/10.1145/1328897.1328464 45 | """ 46 | a, a_r = assigment_labels 47 | d, d_r = dereference_labels 48 | 49 | grammar_text = f"""{start_symbol.to_text()} -> {d_r} V {d} 50 | V -> V1 V2 V3 51 | V1 -> epsilon 52 | V1 -> V2 {a_r} V1 53 | V2 -> epsilon 54 | V2 -> S 55 | V3 -> epsilon 56 | V3 -> {a} V2 V3""" 57 | 58 | cfg = cfpq_data.cfg_from_text(grammar_text) 59 | 60 | logging.info( 61 | f"Create a C Alias {cfg=} with {assigment_labels=}, {dereference_labels=}" 62 | ) 63 | 64 | return cfg 65 | -------------------------------------------------------------------------------- /cfpq_data/grammars/generators/dyck_grammar.py: -------------------------------------------------------------------------------- 1 | """Returns a Dyck grammar that generates a Dyck language of the balanced strings with parentheses of different types.""" 2 | import logging 3 | from typing import List, Tuple 4 | from pyformlang.cfg import CFG, Production, Variable, Terminal 5 | 6 | __all__ = ["dyck_grammar"] 7 | 8 | 9 | def dyck_grammar( 10 | types: List[Tuple[str, str]], 11 | *, 12 | eps: bool = True, 13 | start_symbol: Variable = Variable("S"), 14 | ) -> CFG: 15 | """Returns a Dyck grammar that generates a Dyck language [1]_ of the balanced strings with parentheses of given types. 16 | 17 | Parameters 18 | ---------- 19 | types : List[Tuple[str, str]] 20 | List of pairs $(op_i, cp_i)$ with opening and closing parentheses for each type. 21 | 22 | eps : bool 23 | Whether the empty string belongs to the language generated by the grammar. 24 | 25 | start_symbol : Variable 26 | Start symbol of the grammar. 27 | 28 | Examples 29 | -------- 30 | >>> from cfpq_data import * 31 | >>> cfg = dyck_grammar([("a", "b"), ("c", "d")]) 32 | >>> cfg_to_text(cfg) 33 | 'S -> \\nS -> a S b S\\nS -> c S d S' 34 | 35 | Returns 36 | ------- 37 | cfg : CFG 38 | A Dyck context-free grammar. 39 | 40 | References 41 | ---------- 42 | .. [1] https://en.wikipedia.org/wiki/Dyck_language 43 | """ 44 | variables = {start_symbol} 45 | productions = set() 46 | terminals = set() 47 | 48 | if eps: 49 | productions.add(Production(start_symbol, [])) 50 | else: 51 | for op, cp in types: 52 | productions.add(Production(start_symbol, [Terminal(op), Terminal(cp)])) 53 | 54 | for op, cp in types: 55 | terminals.update([Terminal(op), Terminal(cp)]) 56 | productions.add( 57 | Production( 58 | start_symbol, [Terminal(op), start_symbol, Terminal(cp), start_symbol] 59 | ) 60 | ) 61 | 62 | cfg = CFG( 63 | variables=variables, 64 | terminals=terminals, 65 | productions=productions, 66 | start_symbol=start_symbol, 67 | ) 68 | 69 | logging.info(f"Create a Dyck {cfg=} with {types=}, {eps=}") 70 | 71 | return cfg 72 | -------------------------------------------------------------------------------- /cfpq_data/grammars/generators/nested_parentheses_grammar.py: -------------------------------------------------------------------------------- 1 | """Returns a Nested Parentheses grammar that generates a language of the strings with nested parentheses of different 2 | types. """ 3 | import logging 4 | from typing import List, Tuple 5 | from pyformlang.cfg import CFG, Production, Variable, Terminal 6 | 7 | __all__ = ["nested_parentheses_grammar"] 8 | 9 | 10 | def nested_parentheses_grammar( 11 | types: List[Tuple[str, str]], 12 | *, 13 | eps: bool = True, 14 | start_symbol: Variable = Variable("S"), 15 | ) -> CFG: 16 | """Returns a Nested Parentheses grammar that generates a language of the strings with nested parentheses of given types. 17 | 18 | Parameters 19 | ---------- 20 | types : List[Tuple[str, str]] 21 | List of pairs $(op_i, cp_i)$ with opening and closing parentheses for each type. 22 | 23 | eps : bool 24 | Whether the empty string belongs to the language generated by the grammar. 25 | 26 | start_symbol : Variable 27 | Start symbol of the grammar. 28 | 29 | Examples 30 | -------- 31 | >>> from cfpq_data import * 32 | >>> cfg = nested_parentheses_grammar([("a", "b"), ("c", "d")]) 33 | >>> cfg_to_text(cfg) 34 | 'S -> \\nS -> a S b\\nS -> c S d' 35 | 36 | Returns 37 | ------- 38 | cfg : CFG 39 | A Nested Parentheses context-free grammar. 40 | """ 41 | variables = {start_symbol} 42 | productions = set() 43 | terminals = set() 44 | 45 | if eps: 46 | productions.add(Production(start_symbol, [])) 47 | else: 48 | for op, cp in types: 49 | productions.add(Production(start_symbol, [Terminal(op), Terminal(cp)])) 50 | 51 | for op, cp in types: 52 | terminals.update([Terminal(op), Terminal(cp)]) 53 | productions.add( 54 | Production(start_symbol, [Terminal(op), start_symbol, Terminal(cp)]) 55 | ) 56 | 57 | cfg = CFG( 58 | variables=variables, 59 | terminals=terminals, 60 | productions=productions, 61 | start_symbol=start_symbol, 62 | ) 63 | 64 | logging.info(f"Create a Nested Parentheses {cfg=} with {types=}, {eps=}") 65 | 66 | return cfg 67 | -------------------------------------------------------------------------------- /cfpq_data/grammars/readwrite/__init__.py: -------------------------------------------------------------------------------- 1 | from cfpq_data.grammars.readwrite.cfg import * 2 | from cfpq_data.grammars.readwrite.cnf import * 3 | from cfpq_data.grammars.readwrite.rsa import * 4 | from cfpq_data.grammars.readwrite.regex import * 5 | -------------------------------------------------------------------------------- /cfpq_data/grammars/readwrite/cnf.py: -------------------------------------------------------------------------------- 1 | """Read (and write) a context-free grammar in Chomsky normal form 2 | from (and to) different sources.""" 3 | import logging 4 | import pathlib 5 | from typing import Union 6 | 7 | from pyformlang.cfg import Variable, CFG 8 | 9 | from cfpq_data.grammars.converters.cnf import cnf_from_cfg 10 | from cfpq_data.grammars.readwrite.cfg import cfg_from_text 11 | 12 | __all__ = [ 13 | "cnf_from_text", 14 | "cnf_from_txt", 15 | ] 16 | 17 | 18 | def cnf_from_text(text: str, *, start_symbol: Variable = Variable("S")) -> CFG: 19 | """Create a context-free grammar in Chomsky normal form [1]_ from text. 20 | 21 | Parameters 22 | ---------- 23 | text : str 24 | The text with which the context-free grammar in Chomsky normal form 25 | will be created. 26 | 27 | start_symbol : Variable 28 | Start symbol of a context-free grammar. 29 | 30 | Examples 31 | -------- 32 | >>> from cfpq_data import * 33 | >>> cnf = cnf_from_text("S -> a b") 34 | >>> cfg_to_text(cnf) 35 | 'S -> a#CNF# b#CNF#\\na#CNF# -> a\\nb#CNF# -> b' 36 | 37 | Returns 38 | ------- 39 | cnf : CFG 40 | Context-free grammar in Chomsky normal form. 41 | 42 | References 43 | ---------- 44 | .. [1] https://en.wikipedia.org/wiki/Chomsky_normal_form 45 | """ 46 | cnf = cnf_from_cfg(cfg_from_text(text, start_symbol=start_symbol)) 47 | 48 | logging.info(f"Create {cnf=} from {text=}, {start_symbol=}") 49 | 50 | return cnf 51 | 52 | 53 | def cnf_from_txt( 54 | path: Union[pathlib.Path, str], *, start_symbol: Variable = Variable("S") 55 | ) -> CFG: 56 | """Create a context-free grammar in Chomsky normal form [1]_ from TXT file. 57 | 58 | Parameters 59 | ---------- 60 | path : Union[Path, str] 61 | The path to the TXT file with which the context-free grammar 62 | in Chomsky normal form will be created. 63 | 64 | start_symbol : Variable 65 | Start symbol of a context-free grammar. 66 | 67 | Examples 68 | -------- 69 | >>> from cfpq_data import * 70 | >>> cnf_1 = cfg_from_text("S -> a b") 71 | >>> path = cfg_to_txt(cnf_1, "test.txt") 72 | >>> cnf = cnf_from_txt(path) 73 | >>> cfg_to_text(cnf) 74 | 'S -> a#CNF# b#CNF#\\na#CNF# -> a\\nb#CNF# -> b' 75 | 76 | Returns 77 | ------- 78 | cnf : CFG 79 | Context-free grammar in Chomsky normal form. 80 | 81 | References 82 | ---------- 83 | .. [1] https://en.wikipedia.org/wiki/Chomsky_normal_form 84 | """ 85 | with open(path, "r") as f: 86 | productions = f.read() 87 | 88 | cnf = cnf_from_text(productions, start_symbol=start_symbol) 89 | 90 | logging.info(f"Create {cnf=} from {path=}, {start_symbol=}") 91 | 92 | return cnf 93 | -------------------------------------------------------------------------------- /cfpq_data/grammars/utils/__init__.py: -------------------------------------------------------------------------------- 1 | from cfpq_data.grammars.utils.change_terminals import * 2 | -------------------------------------------------------------------------------- /cfpq_data/graphs/__init__.py: -------------------------------------------------------------------------------- 1 | from cfpq_data.graphs.generators import * 2 | from cfpq_data.graphs.readwrite import * 3 | from cfpq_data.graphs.utils import * 4 | -------------------------------------------------------------------------------- /cfpq_data/graphs/generators/__init__.py: -------------------------------------------------------------------------------- 1 | from cfpq_data.graphs.generators.fast_labeled_binomial_graph import * 2 | from cfpq_data.graphs.generators.labeled_barabasi_albert_graph import * 3 | from cfpq_data.graphs.generators.labeled_binomial_graph import * 4 | from cfpq_data.graphs.generators.labeled_cycle_graph import * 5 | from cfpq_data.graphs.generators.labeled_scale_free_graph import * 6 | from cfpq_data.graphs.generators.labeled_two_cycles_graph import * 7 | -------------------------------------------------------------------------------- /cfpq_data/graphs/generators/fast_labeled_binomial_graph.py: -------------------------------------------------------------------------------- 1 | """Returns a $G_{n,p}$ random graph, also known as an Erdős-Rényi graph or 2 | a binomial graph. With labeled edges.""" 3 | import logging 4 | import random 5 | from typing import Union, List, Callable 6 | 7 | import networkx as nx 8 | 9 | __all__ = ["fast_labeled_binomial_graph"] 10 | 11 | 12 | def fast_labeled_binomial_graph( 13 | n: int, 14 | p: float, 15 | *, 16 | labels: List[str] = "a", 17 | choice: Callable[[List[str]], str] = random.choice, 18 | seed: Union[int, None] = None, 19 | ) -> nx.MultiDiGraph: 20 | """Returns a $G_{n,p}$ random graph, also known as an Erdős-Rényi graph or 21 | a binomial graph. With labeled edges. 22 | 23 | The $G_{n,p}$ model chooses each of the possible edges with probability $p$. 24 | 25 | Parameters 26 | ---------- 27 | n : int 28 | The number of nodes. 29 | 30 | p : float 31 | Probability for edge creation. 32 | 33 | labels: Iterable[str] 34 | Labels that will be used to mark the edges of the graph. 35 | 36 | choice: Callable[[Iterable[str]], str] 37 | Function for marking edges. 38 | 39 | seed : integer, random_state, or None (default) 40 | Indicator of random number generation state. 41 | 42 | Examples 43 | -------- 44 | >>> from cfpq_data import * 45 | >>> g = fast_labeled_binomial_graph(42, 0.42, seed=42) 46 | >>> g.number_of_nodes() 47 | 42 48 | >>> g.number_of_edges() 49 | 711 50 | 51 | Returns 52 | ------- 53 | g : MultiDiGraph 54 | An Erdős-Rényi graph random graph. 55 | 56 | Notes 57 | ----- 58 | The $G_{n,p}$ graph algorithm chooses each of the $(n (n - 1)) / 2$ 59 | (undirected) or $n (n - 1)$ (directed) possible edges with probability $p$. 60 | 61 | This algorithm [4]_ runs in $O(n + m)$ time, where $m$ is the expected number of 62 | edges, which equals $p n (n - 1) / 2$. This should be faster than 63 | :func:`labeled_binomial_graph` when $p$ is small and the expected number of edges 64 | is small (that is, the graph is sparse). 65 | 66 | References 67 | ---------- 68 | .. [1] P. Erdős and A. Rényi, On Random Graphs, Publ. Math. 6, 290 (1959). 69 | .. [2] E. N. Gilbert, Random Graphs, Ann. Math. Stat., 30, 1141 (1959). 70 | .. [3] https://networkx.org/documentation/stable//reference/randomness.html#randomness 71 | .. [4] Vladimir Batagelj and Ulrik Brandes, 72 | "Efficient generation of large random networks", 73 | Phys. Rev. E, 71, 036113, 2005. 74 | """ 75 | graph = nx.MultiDiGraph( 76 | nx.fast_gnp_random_graph(n=n, p=p, seed=seed, directed=True) 77 | ) 78 | 79 | random.seed(seed) 80 | 81 | for edge in graph.edges: 82 | graph.edges[edge]["label"] = choice(labels) 83 | 84 | logging.info( 85 | f"[FAST GNP] Create a Erdős-Rényi {graph=} " 86 | f"with {n=}, {p=}, {labels=}, {choice=}, {seed=}" 87 | ) 88 | 89 | return graph 90 | -------------------------------------------------------------------------------- /cfpq_data/graphs/generators/labeled_barabasi_albert_graph.py: -------------------------------------------------------------------------------- 1 | """Returns a random graph according to the Barabási–Albert preferential attachment model 2 | With labeled edges. 3 | 4 | A graph of `n` nodes is grown by attaching new nodes each with 5 | `m` edges that are preferentially attached to existing nodes with high degree. 6 | """ 7 | import logging 8 | import random 9 | from typing import List, Union, Callable 10 | 11 | import networkx as nx 12 | 13 | __all__ = ["labeled_barabasi_albert_graph"] 14 | 15 | 16 | def labeled_barabasi_albert_graph( 17 | n: int, 18 | m: int, 19 | *, 20 | labels: List[str] = "abcd", 21 | choice: Callable[[List[str]], str] = random.choice, 22 | seed: Union[int, None] = None, 23 | ) -> nx.MultiDiGraph: 24 | """Returns a random graph according to the Barabási–Albert preferential attachment model. 25 | With labeled edges. 26 | 27 | A graph of `n` nodes is grown by attaching new nodes each with 28 | `m` edges that are preferentially attached to existing nodes with high degree. 29 | 30 | Parameters 31 | ---------- 32 | n : int 33 | Number of nodes. 34 | 35 | m : int 36 | Number of edges to attach from a new node to existing nodes. 37 | 38 | labels: Iterable[str] 39 | Labels that will be used to mark the edges of the graph. 40 | 41 | choice: Callable[[Iterable[str]], str] 42 | Function for marking edges. 43 | 44 | seed : Union[int, RandomState, None] 45 | Indicator of random number generation state. 46 | 47 | Examples 48 | -------- 49 | >>> from cfpq_data import * 50 | >>> g = labeled_barabasi_albert_graph(42, 29, seed=42) 51 | >>> g.number_of_nodes() 52 | 42 53 | >>> g.number_of_edges() 54 | 754 55 | 56 | Returns 57 | ------- 58 | g : MultiDiGraph 59 | A random graph according to the Barabási–Albert preferential attachment model. 60 | 61 | Raises 62 | ------ 63 | NetworkXError 64 | If `m` does not satisfy ``1 <= m < n``. 65 | 66 | References 67 | ---------- 68 | .. [1] A. L. Barabási and R. Albert "Emergence of scaling in 69 | random networks", Science 286, pp 509-512, 1999. 70 | .. [2] https://networkx.org/documentation/stable//reference/randomness.html#randomness 71 | """ 72 | graph = nx.MultiDiGraph(nx.barabasi_albert_graph(n=n, m=m, seed=seed)) 73 | 74 | random.seed(seed) 75 | 76 | for edge in graph.edges: 77 | graph.edges[edge]["label"] = choice(labels) 78 | 79 | logging.info( 80 | f"Create a random {graph=} " 81 | f"according to the Barabási–Albert preferential attachment model " 82 | f"with {n=}, {m=}, {labels=}, {choice=}, {seed=}" 83 | ) 84 | 85 | return graph 86 | -------------------------------------------------------------------------------- /cfpq_data/graphs/generators/labeled_binomial_graph.py: -------------------------------------------------------------------------------- 1 | """Returns a $G_{n,p}$ random graph, also known as an Erdős-Rényi graph or 2 | a binomial graph. With labeled edges. 3 | """ 4 | import logging 5 | import random 6 | from typing import Union, List, Callable 7 | 8 | import networkx as nx 9 | 10 | __all__ = ["labeled_binomial_graph"] 11 | 12 | 13 | def labeled_binomial_graph( 14 | n: int, 15 | p: float, 16 | *, 17 | labels: List[str] = "a", 18 | choice: Callable[[List[str]], str] = random.choice, 19 | seed: Union[int, None] = None, 20 | ) -> nx.MultiDiGraph: 21 | """Returns a $G_{n,p}$ random graph, also known as an Erdős-Rényi graph or 22 | a binomial graph. With labeled edges. 23 | 24 | The $G_{n,p}$ model chooses each of the possible edges with probability $p$. 25 | 26 | Parameters 27 | ---------- 28 | n : int 29 | The number of nodes. 30 | 31 | p : float 32 | Probability for edge creation. 33 | 34 | labels: Iterable[str] 35 | Labels that will be used to mark the edges of the graph. 36 | 37 | choice: Callable[[Iterable[str]], str] 38 | Function for marking edges. 39 | 40 | seed : integer, random_state, or None (default) 41 | Indicator of random number generation state. 42 | 43 | Examples 44 | -------- 45 | >>> from cfpq_data import * 46 | >>> g = labeled_binomial_graph(42, 0.84, seed=42) 47 | >>> g.number_of_nodes() 48 | 42 49 | >>> g.number_of_edges() 50 | 1453 51 | 52 | Returns 53 | ------- 54 | g : MultiDiGraph 55 | An Erdős-Rényi graph random graph. 56 | 57 | Notes 58 | ----- 59 | This algorithm runs in $O(n^2)$ time. For sparse graphs (that is, for 60 | small values of $p$), :func:`fast_labeled_binomial_graph` is faster. 61 | 62 | References 63 | ---------- 64 | .. [1] P. Erdős and A. Rényi, On Random Graphs, Publ. Math. 6, 290 (1959). 65 | .. [2] E. N. Gilbert, Random Graphs, Ann. Math. Stat., 30, 1141 (1959). 66 | .. [3] https://networkx.org/documentation/stable//reference/randomness.html#randomness 67 | """ 68 | graph = nx.MultiDiGraph(nx.gnp_random_graph(n=n, p=p, seed=seed, directed=True)) 69 | 70 | random.seed(seed) 71 | 72 | for edge in graph.edges: 73 | graph.edges[edge]["label"] = choice(labels) 74 | 75 | logging.info( 76 | f"[GNP] Create a Erdős-Rényi {graph=} " 77 | f"with {n=}, {p=}, {labels=}, {choice=}, {seed=}" 78 | ) 79 | 80 | return graph 81 | -------------------------------------------------------------------------------- /cfpq_data/graphs/generators/labeled_cycle_graph.py: -------------------------------------------------------------------------------- 1 | """Returns a cycle graph $C_n$ of cyclically connected nodes. With labeled edges. 2 | 3 | $C_n$ is a path with its two end-nodes connected. 4 | """ 5 | import logging 6 | from typing import Union, Iterable, Any 7 | 8 | import networkx as nx 9 | 10 | __all__ = ["labeled_cycle_graph"] 11 | 12 | 13 | def labeled_cycle_graph( 14 | n: Union[int, Iterable[Any]], 15 | label: str = "a", 16 | ) -> nx.MultiDiGraph: 17 | """Returns a cycle graph $C_n$ of cyclically connected nodes. 18 | With labeled edges. 19 | 20 | $C_n$ is a path with its two end-nodes connected. 21 | 22 | Parameters 23 | ---------- 24 | n : Union[int, Iterable[Any]] 25 | If n is an integer, nodes are from `range(n)`. 26 | If n is a container of nodes, those nodes appear in the graph. 27 | 28 | label: str 29 | Label that will be used to mark the edges of the graph. 30 | 31 | Examples 32 | -------- 33 | >>> from cfpq_data import * 34 | >>> g = labeled_cycle_graph(42) 35 | >>> g.number_of_nodes() 36 | 42 37 | >>> g.number_of_edges() 38 | 42 39 | 40 | Returns 41 | ------- 42 | g : MultiDiGraph 43 | A cycle graph $C_n$. 44 | """ 45 | graph = nx.cycle_graph(n=n, create_using=nx.MultiDiGraph) 46 | 47 | for edge in graph.edges: 48 | graph.edges[edge]["label"] = label 49 | 50 | logging.info(f"Create a cycle {graph=} with {n=}, {label=}") 51 | 52 | return graph 53 | -------------------------------------------------------------------------------- /cfpq_data/graphs/generators/labeled_two_cycles_graph.py: -------------------------------------------------------------------------------- 1 | """Returns a graph with two cycles connected by one node. With labeled edges.""" 2 | import logging 3 | from typing import Union, Iterable, Any, Tuple 4 | 5 | import networkx as nx 6 | 7 | __all__ = ["labeled_two_cycles_graph"] 8 | 9 | 10 | def labeled_two_cycles_graph( 11 | n: Union[int, Iterable[Any]], 12 | m: Union[int, Iterable[Any]], 13 | *, 14 | common_node: Union[int, Any] = 0, 15 | labels: Tuple[str, str] = ("a", "b"), 16 | ) -> nx.MultiDiGraph: 17 | """Returns a graph with two cycles connected by one node. With labeled edges. 18 | 19 | Parameters 20 | ---------- 21 | n : Union[int, Iterable[Any]] 22 | The number of nodes in the first cycle without a common node. 23 | If n is an integer, nodes are from `range(n)`. 24 | If n is a container of nodes, those nodes appear in the graph. 25 | 26 | m : Union[int, Iterable[Any]] 27 | The number of nodes in the second cycle without a common node. 28 | If m is an integer, nodes are from `range(n)`. 29 | If m is a container of nodes, those nodes appear in the graph. 30 | 31 | common_node : Union[int, Any] 32 | The node along which two cycles are connected. 33 | 34 | labels: Tuple[str, str] 35 | Labels that will be used to mark the edges of the graph. 36 | 37 | Examples 38 | -------- 39 | >>> from cfpq_data import * 40 | >>> g = labeled_two_cycles_graph(42, 29) 41 | >>> g.number_of_nodes() 42 | 72 43 | >>> g.number_of_edges() 44 | 73 45 | 46 | Returns 47 | ------- 48 | g : MultiDiGraph 49 | A graph with two cycles connected by one node. 50 | """ 51 | g1 = nx.path_graph(n=n, create_using=nx.MultiDiGraph) 52 | 53 | if isinstance(n, int): 54 | g1_number_of_nodes = g1.number_of_nodes() 55 | g1_nodes = map(lambda x: x + 1, g1.nodes) 56 | g1 = nx.path_graph(n=g1_nodes, create_using=nx.MultiDiGraph) 57 | 58 | g2 = nx.path_graph(n=m, create_using=nx.MultiDiGraph) 59 | 60 | if isinstance(m, int): 61 | g1_number_of_nodes = g1.number_of_nodes() 62 | g2_nodes = map(lambda x: x + g1_number_of_nodes + 1, g2.nodes) 63 | g2 = nx.path_graph(n=g2_nodes, create_using=nx.MultiDiGraph) 64 | 65 | for tmp in [g1, g2]: 66 | first_node = list(tmp.nodes)[0] 67 | last_node = list(tmp.nodes)[-1] 68 | tmp.add_edge(common_node, first_node) 69 | tmp.add_edge(last_node, common_node) 70 | 71 | for edge in g1.edges: 72 | g1.edges[edge]["label"] = labels[0] 73 | 74 | for edge in g2.edges: 75 | g2.edges[edge]["label"] = labels[1] 76 | 77 | graph = nx.MultiDiGraph(nx.compose(g1, g2)) 78 | 79 | logging.info( 80 | f"Create a {graph=} with two cycles connected by one node " 81 | f"with {n=}, {m=}, {common_node=}, {labels=}" 82 | ) 83 | 84 | return graph 85 | -------------------------------------------------------------------------------- /cfpq_data/graphs/readwrite/__init__.py: -------------------------------------------------------------------------------- 1 | from cfpq_data.graphs.readwrite.rdf import * 2 | from cfpq_data.graphs.readwrite.txt import * 3 | from cfpq_data.graphs.readwrite.csv import * 4 | -------------------------------------------------------------------------------- /cfpq_data/graphs/readwrite/csv.py: -------------------------------------------------------------------------------- 1 | """Read (and write) a graph from (and to) CSV file.""" 2 | import logging 3 | import pathlib 4 | from typing import Union 5 | 6 | import networkx as nx 7 | import pandas as pd 8 | 9 | __all__ = [ 10 | "graph_from_csv", 11 | "graph_to_csv", 12 | ] 13 | 14 | 15 | def graph_from_csv(path: Union[pathlib.Path, str]) -> nx.MultiDiGraph: 16 | """Loads a graph from CSV file. 17 | 18 | Parameters 19 | ---------- 20 | path : Union[Path, str] 21 | The path to the CSV file with which 22 | the graph will be created. 23 | 24 | Examples 25 | -------- 26 | >>> from cfpq_data import * 27 | >>> p = cfpq_data.download("generations") 28 | >>> g = cfpq_data.graph_from_csv(p) 29 | >>> g.number_of_nodes() 30 | 129 31 | >>> g.number_of_edges() 32 | 273 33 | 34 | Returns 35 | ------- 36 | g : MultiDiGraph 37 | Loaded graph. 38 | """ 39 | data = pd.read_csv( 40 | filepath_or_buffer=path, 41 | sep=" ", 42 | header=None, 43 | names=["from", "to", "label"], 44 | engine="c", 45 | ) 46 | 47 | graph = nx.from_pandas_edgelist( 48 | df=data, 49 | source="from", 50 | target="to", 51 | edge_attr="label", 52 | create_using=nx.MultiDiGraph, 53 | ) 54 | 55 | logging.info(f"Load {graph=} from {path=}") 56 | 57 | return graph 58 | 59 | 60 | def graph_to_csv( 61 | graph: nx.MultiDiGraph, path: Union[pathlib.Path, str] 62 | ) -> pathlib.Path: 63 | """Saves the `graph` to the CSV file by `path`. 64 | 65 | Parameters 66 | ---------- 67 | graph : MultiDiGraph 68 | Graph to save. 69 | 70 | path : Union[Path, str] 71 | The path to the CSV file where the graph will be saved. 72 | 73 | Examples 74 | -------- 75 | >>> from cfpq_data import * 76 | >>> p = download("generations") 77 | >>> g = graph_from_csv(p) 78 | >>> path = graph_to_csv(g, "test.csv") 79 | 80 | Returns 81 | ------- 82 | path : Path 83 | Path to the CSV file where the graph will be saved. 84 | """ 85 | with open(file=path, mode="w") as f: 86 | for u, v, edge_labels in graph.edges(data=True): 87 | for e in edge_labels.values(): 88 | f.write(f"{u} {v} {e}\n") 89 | 90 | dest = pathlib.Path(path).resolve() 91 | 92 | logging.info(f"Save {graph=} to {dest=}") 93 | 94 | return dest 95 | -------------------------------------------------------------------------------- /cfpq_data/graphs/readwrite/rdf.py: -------------------------------------------------------------------------------- 1 | """Read (and write) a graph from (and to) RDF file.""" 2 | import logging 3 | import pathlib 4 | from typing import Union 5 | 6 | import networkx as nx 7 | import rdflib 8 | 9 | __all__ = [ 10 | "graph_from_rdf", 11 | "graph_to_rdf", 12 | ] 13 | 14 | 15 | def graph_from_rdf(path: Union[pathlib.Path, str]) -> nx.MultiDiGraph: 16 | """Loads a graph from RDF file. 17 | 18 | Parameters 19 | ---------- 20 | path : Union[Path, str] 21 | The path to the RDF file with which the graph will be created. 22 | 23 | Examples 24 | -------- 25 | >>> from cfpq_data import * 26 | >>> p = download("generations") 27 | >>> g = graph_from_csv(path=p) 28 | >>> path = graph_to_rdf(g, "test.ttl") 29 | >>> generations = graph_from_rdf(path) 30 | >>> generations.number_of_nodes() 31 | 129 32 | >>> generations.number_of_edges() 33 | 273 34 | 35 | Returns 36 | ------- 37 | g : MultiDiGraph 38 | Loaded graph. 39 | """ 40 | tmp = rdflib.Graph() 41 | tmp.parse(str(path)) 42 | 43 | graph = nx.MultiDiGraph() 44 | 45 | for subj, pred, obj in tmp: 46 | graph.add_edge( 47 | u_for_edge=subj, 48 | v_for_edge=obj, 49 | label=pred, 50 | ) 51 | 52 | logging.info(f"Load {graph=} from {path=}") 53 | 54 | return graph 55 | 56 | 57 | def graph_to_rdf( 58 | graph: nx.MultiDiGraph, path: Union[pathlib.Path, str] 59 | ) -> pathlib.Path: 60 | """Saves the `graph` to the RDF file by `path`. 61 | 62 | Parameters 63 | ---------- 64 | graph : MultiDiGraph 65 | Graph to save. 66 | 67 | path : Union[Path, str] 68 | The path to the file where the graph will be saved. 69 | 70 | Examples 71 | -------- 72 | >>> from cfpq_data import * 73 | >>> p = download("generations") 74 | >>> g = graph_from_csv(p) 75 | >>> path = graph_to_rdf(g, "test.ttl") 76 | 77 | Returns 78 | ------- 79 | path : Path 80 | Path to the RDF file where the graph will be saved. 81 | """ 82 | tmp = rdflib.Graph() 83 | 84 | for u, v, edge_labels in graph.edges(data=True): 85 | subj = rdflib.BNode(u) 86 | obj = rdflib.BNode(v) 87 | 88 | for label in edge_labels.values(): 89 | pred = rdflib.Literal(f"{label}", datatype=rdflib.XSD.string) 90 | tmp.add((subj, pred, obj)) 91 | 92 | dest = pathlib.Path(path).resolve() 93 | tmp.serialize(destination=str(dest)) 94 | 95 | logging.info(f"Save {graph=} to {dest=}") 96 | 97 | return dest 98 | -------------------------------------------------------------------------------- /cfpq_data/graphs/utils/__init__.py: -------------------------------------------------------------------------------- 1 | from cfpq_data.graphs.utils.add_reverse_edges import * 2 | from cfpq_data.graphs.utils.change_edges import * 3 | from cfpq_data.graphs.utils.filter_edges import * 4 | from cfpq_data.graphs.utils.edges_statistics import * 5 | from cfpq_data.graphs.utils.nodes_to_integers import * 6 | from cfpq_data.graphs.utils.multiple_source_utils import * 7 | -------------------------------------------------------------------------------- /cfpq_data/graphs/utils/add_reverse_edges.py: -------------------------------------------------------------------------------- 1 | """Returns a graph with added reverse edges.""" 2 | import logging 3 | from typing import Any, Dict, Union 4 | 5 | import networkx as nx 6 | 7 | __all__ = ["add_reverse_edges"] 8 | 9 | 10 | def add_reverse_edges( 11 | graph: nx.MultiDiGraph, 12 | *, 13 | mapping: Union[Dict[Any, Any], None] = None, 14 | ) -> nx.MultiDiGraph: 15 | """Returns a graph with added reverse edges (with suffix '_r' by default). 16 | 17 | Parameters 18 | ---------- 19 | graph : MultiDiGraph 20 | Initial graph. 21 | 22 | mapping: Dict[Any, Any] 23 | Edge labels mapping for reverse edges that must be added. 24 | 25 | Examples 26 | -------- 27 | >>> from cfpq_data import * 28 | >>> g = labeled_cycle_graph(2) 29 | >>> list(g.edges(data=True)) 30 | [(0, 1, {'label': 'a'}), (1, 0, {'label': 'a'})] 31 | >>> new_g = add_reverse_edges(g) 32 | >>> list(new_g.edges(data=True)) 33 | [(0, 1, {'label': 'a'}), (0, 1, {'label': 'a_r'}), (1, 0, {'label': 'a_r'}), (1, 0, {'label': 'a'})] 34 | 35 | Returns 36 | ------- 37 | g : MultiDiGraph 38 | A graph with added reverse edges. 39 | """ 40 | new_graph = nx.MultiDiGraph() 41 | 42 | for node, node_labels in graph.nodes(data=True): 43 | new_graph.add_node(node, **node_labels) 44 | 45 | for u, v, edge_labels in graph.edges(data=True): 46 | new_graph.add_edge(u, v, **edge_labels) 47 | reverse_edge_labels = dict() 48 | for key, value in edge_labels.items(): 49 | if not mapping: 50 | reverse_edge_labels[key] = value + "_r" 51 | elif value in mapping.keys(): 52 | reverse_edge_labels[key] = mapping[value] 53 | 54 | if reverse_edge_labels != dict(): 55 | new_graph.add_edge(v, u, **reverse_edge_labels) 56 | 57 | logging.info(f"Add reverse edges in {graph=} with {mapping=} to {new_graph=}") 58 | 59 | return new_graph 60 | -------------------------------------------------------------------------------- /cfpq_data/graphs/utils/change_edges.py: -------------------------------------------------------------------------------- 1 | """Returns a graph with changed edges by specified edge labels mapping.""" 2 | import logging 3 | from typing import Any, Dict 4 | 5 | import networkx as nx 6 | 7 | __all__ = ["change_edges"] 8 | 9 | 10 | def change_edges( 11 | graph: nx.MultiDiGraph, 12 | mapping: Dict[Any, Any], 13 | ) -> nx.MultiDiGraph: 14 | """Returns a graph with relabeled edges by specified edge labels mapping. 15 | 16 | Parameters 17 | ---------- 18 | graph : MultiDiGraph 19 | Initial graph. 20 | 21 | mapping: Dict[Any, Any] 22 | Edge labels mapping. 23 | 24 | Examples 25 | -------- 26 | >>> from cfpq_data import * 27 | >>> g = labeled_cycle_graph(2) 28 | >>> list(g.edges(data=True)) 29 | [(0, 1, {'label': 'a'}), (1, 0, {'label': 'a'})] 30 | >>> new_g = change_edges(g, {"a": "b"}) 31 | >>> list(new_g.edges(data=True)) 32 | [(0, 1, {'label': 'b'}), (1, 0, {'label': 'b'})] 33 | 34 | Returns 35 | ------- 36 | g : MultiDiGraph 37 | A graph with changed edges. 38 | """ 39 | new_graph = nx.MultiDiGraph() 40 | 41 | for node, node_labels in graph.nodes(data=True): 42 | new_graph.add_node(node, **node_labels) 43 | 44 | for u, v, edge_labels in graph.edges(data=True): 45 | changed_edge_labels = dict() 46 | for key, value in edge_labels.items(): 47 | if value in mapping.keys(): 48 | changed_edge_labels[key] = mapping[value] 49 | else: 50 | changed_edge_labels[key] = value 51 | new_graph.add_edge(u, v, **changed_edge_labels) 52 | 53 | logging.info(f"Change labels in {graph=} with {mapping=} to {new_graph=}") 54 | 55 | return new_graph 56 | -------------------------------------------------------------------------------- /cfpq_data/graphs/utils/edges_statistics.py: -------------------------------------------------------------------------------- 1 | """Returns statistics of graph edges.""" 2 | import logging 3 | from collections import defaultdict 4 | from typing import List, Any, DefaultDict 5 | 6 | import networkx as nx 7 | 8 | __all__ = ["get_labels_frequency", "get_sorted_labels"] 9 | 10 | 11 | def get_labels_frequency(graph: nx.MultiDiGraph) -> DefaultDict[Any, int]: 12 | """Returns a dictionary with the number of edge labels used in the graph. 13 | 14 | Parameters 15 | ---------- 16 | graph : MultiDiGraph 17 | Given graph. 18 | 19 | Examples 20 | -------- 21 | >>> from cfpq_data import * 22 | >>> g = labeled_two_cycles_graph(1, 1, labels=("a", "b")) 23 | >>> list(g.edges(data=True)) 24 | [(1, 0, {'label': 'a'}), (0, 1, {'label': 'a'}), (0, 2, {'label': 'b'}), (2, 0, {'label': 'b'})] 25 | >>> labels_frequency = get_labels_frequency(g) 26 | >>> labels_frequency 27 | defaultdict(, {'a': 2, 'b': 2}) 28 | 29 | Returns 30 | ------- 31 | labels_frequency : DefaultDict[Any, int] 32 | Dictionary with edge labels usage frequency. 33 | """ 34 | labels_frequency = defaultdict(int) 35 | 36 | for u, v, edge_labels in graph.edges(data=True): 37 | for key, value in edge_labels.items(): 38 | labels_frequency[value] += 1 39 | 40 | logging.info(f"Construct {labels_frequency=} for {graph=}") 41 | 42 | return labels_frequency 43 | 44 | 45 | def get_sorted_labels( 46 | graph: nx.MultiDiGraph, 47 | *, 48 | reverse: bool = False, 49 | ) -> List[Any]: 50 | """Returns a list of edge labels sorted by the number of uses in the graph. The labels with equal number of uses are 51 | sorted lexicographically. 52 | 53 | Parameters 54 | ---------- 55 | graph : MultiDiGraph 56 | Given graph. 57 | 58 | reverse: bool 59 | If set to True, then the labels are sorted in reverse (ascending) order. 60 | 61 | Examples 62 | -------- 63 | >>> from cfpq_data import * 64 | >>> g = labeled_two_cycles_graph(42, 29) 65 | >>> sorted_labels = get_sorted_labels(g) 66 | >>> sorted_labels 67 | ['a', 'b'] 68 | 69 | Returns 70 | ------- 71 | labels : List[Any] 72 | Sorted list of graph edge labels. 73 | """ 74 | sorted_pairs = sorted( 75 | get_labels_frequency(graph).items(), 76 | key=lambda x: (-x[1], x[0]), 77 | reverse=reverse, 78 | ) 79 | 80 | labels = [] 81 | for label, _ in sorted_pairs: 82 | labels.append(label) 83 | 84 | logging.info(f"Sort edge {labels=} of {graph=}") 85 | 86 | return labels 87 | -------------------------------------------------------------------------------- /cfpq_data/graphs/utils/filter_edges.py: -------------------------------------------------------------------------------- 1 | """Returns a graph with filtered edges.""" 2 | import logging 3 | from typing import Iterable, Any 4 | 5 | import networkx as nx 6 | 7 | __all__ = ["filter_edges"] 8 | 9 | 10 | def filter_edges(graph: nx.MultiDiGraph, labels: Iterable[Any]) -> nx.MultiDiGraph: 11 | """Returns a graph with filtered edges. 12 | 13 | Parameters 14 | ---------- 15 | graph : MultiDiGraph 16 | Initial graph. 17 | 18 | labels : Iterable[Any] 19 | Graph edge labels to be preserved. 20 | 21 | Examples 22 | -------- 23 | >>> from cfpq_data import * 24 | >>> g = labeled_two_cycles_graph(1, 1, labels=("a", "b")) 25 | >>> list(g.edges(data=True)) 26 | [(1, 0, {'label': 'a'}), (0, 1, {'label': 'a'}), (0, 2, {'label': 'b'}), (2, 0, {'label': 'b'})] 27 | >>> new_g = filter_edges(g, ["a"]) 28 | >>> list(new_g.edges(data=True)) 29 | [(1, 0, {'label': 'a'}), (0, 1, {'label': 'a'})] 30 | 31 | Returns 32 | ------- 33 | g : MultiDiGraph 34 | Graph with filtered edges. 35 | """ 36 | new_graph = nx.MultiDiGraph() 37 | 38 | for node, node_labels in graph.nodes(data=True): 39 | new_graph.add_node(node, **node_labels) 40 | 41 | for u, v, edge_labels in graph.edges(data=True): 42 | filtered_edge_labels = dict() 43 | for key, value in edge_labels.items(): 44 | if value in labels: 45 | filtered_edge_labels[key] = value 46 | if filtered_edge_labels != dict(): 47 | new_graph.add_edge(u, v, **filtered_edge_labels) 48 | 49 | logging.info(f"Filter labels in {graph=} with {labels=} to {new_graph=}") 50 | 51 | return new_graph 52 | -------------------------------------------------------------------------------- /cfpq_data/graphs/utils/nodes_to_integers.py: -------------------------------------------------------------------------------- 1 | """Returns a graph with nodes converted to integers.""" 2 | import logging 3 | 4 | import networkx as nx 5 | 6 | __all__ = ["nodes_to_integers"] 7 | 8 | 9 | def nodes_to_integers(graph: nx.MultiDiGraph) -> nx.MultiDiGraph: 10 | """Returns a graph with nodes converted to integers. 11 | 12 | Parameters 13 | ---------- 14 | graph : MultiDiGraph 15 | Initial graph. 16 | 17 | Examples 18 | -------- 19 | >>> from cfpq_data import * 20 | >>> g = graph_from_text(["FROM LABEL TO"]) 21 | >>> list(g.edges(data=True)) 22 | [('FROM', 'TO', {'label': 'LABEL'})] 23 | >>> new_g = nodes_to_integers(g) 24 | >>> list(new_g.edges(data=True)) 25 | [(0, 1, {'label': 'LABEL'})] 26 | 27 | Returns 28 | ------- 29 | g : MultiDiGraph 30 | A graph whose vertices are integers. 31 | """ 32 | node2int = dict() 33 | 34 | for node in graph.nodes(): 35 | if node not in node2int.keys(): 36 | node2int[node] = len(node2int) 37 | 38 | new_graph = nx.MultiDiGraph() 39 | 40 | for node, node_labels in graph.nodes(data=True): 41 | new_graph.add_node(node2int[node], **node_labels) 42 | 43 | for u, v, edge_labels in graph.edges(data=True): 44 | new_graph.add_edge(node2int[u], node2int[v], **edge_labels) 45 | 46 | logging.info(f"Enumerate nodes in {graph=} to {new_graph=}") 47 | 48 | return new_graph 49 | -------------------------------------------------------------------------------- /docs/.nojekyll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FormalLanguageConstrainedPathQuerying/CFPQ_Data/d4367d0de1be4e9e7e517cd9ff1f00f1696b8c7a/docs/.nojekyll -------------------------------------------------------------------------------- /docs/Makefile: -------------------------------------------------------------------------------- 1 | # Minimal makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line. 5 | SPHINXOPTS = 6 | SPHINXBUILD = sphinx-build 7 | SOURCEDIR = . 8 | BUILDDIR = _build 9 | 10 | # Put it first so that "make" without argument is like "make help". 11 | help: 12 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 13 | 14 | .PHONY: help Makefile 15 | 16 | # Catch-all target: route all unknown targets to Sphinx using the new 17 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). 18 | %: Makefile 19 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 20 | -------------------------------------------------------------------------------- /docs/README.md: -------------------------------------------------------------------------------- 1 | # Building docs 2 | 3 | We use Sphinx for generating the API and reference documentation. 4 | 5 | ## Instructions 6 | 7 | After installing NetworkX and its dependencies, install the Python 8 | packages needed to build the documentation by entering:: 9 | 10 | pip install -r requirements/docs.txt 11 | 12 | in the root directory. 13 | 14 | To build the HTML documentation, enter:: 15 | 16 | make html 17 | 18 | in the ``doc/`` directory. This will generate a ``build/html`` subdirectory 19 | containing the built documentation. 20 | -------------------------------------------------------------------------------- /docs/_static/css/about.css: -------------------------------------------------------------------------------- 1 | .team-member { 2 | display: inline-block; 3 | padding: 1rem; 4 | margin: 0.25rem; 5 | width: 7rem; 6 | text-align: center; 7 | vertical-align: top; 8 | } 9 | 10 | .team-member-photo { 11 | display: block; 12 | } 13 | 14 | .team-member-photo img { 15 | width: 100%; 16 | height: auto; 17 | border-radius: 50%; 18 | margin-left: auto; 19 | margin-right: auto; 20 | margin-bottom: 0.5rem; 21 | } 22 | 23 | .team-member-name { 24 | font-weight: bold; 25 | } 26 | 27 | .team-member-handle { 28 | display: none; 29 | } 30 | -------------------------------------------------------------------------------- /docs/_static/css/copybutton.css: -------------------------------------------------------------------------------- 1 | /* Copy buttons */ 2 | a.copybtn { 3 | position: absolute; 4 | top: .2em; 5 | right: .2em; 6 | width: 2em; 7 | height: 2em; 8 | opacity: .3; 9 | transition: opacity 0.5s; 10 | border: none; 11 | user-select: none; 12 | } 13 | 14 | div.highlight { 15 | position: relative; 16 | } 17 | 18 | a.copybtn > img { 19 | vertical-align: top; 20 | margin: 0; 21 | top: 0; 22 | right: 0; 23 | position: absolute; 24 | } 25 | 26 | .highlight:hover .copybtn { 27 | opacity: 1; 28 | } 29 | 30 | /** 31 | * A minimal CSS-only tooltip copied from: 32 | * https://codepen.io/mildrenben/pen/rVBrpK 33 | * 34 | * To use, write HTML like the following: 35 | * 36 | *

Short

37 | */ 38 | .o-tooltip--left { 39 | position: relative; 40 | } 41 | 42 | .o-tooltip--left:after { 43 | opacity: 0; 44 | visibility: hidden; 45 | position: absolute; 46 | content: attr(data-tooltip); 47 | padding: 2px; 48 | top: 0; 49 | left: -.2em; 50 | background: grey; 51 | font-size: 1rem; 52 | color: white; 53 | white-space: nowrap; 54 | z-index: 2; 55 | border-radius: 2px; 56 | transform: translateX(-102%) translateY(0); 57 | transition: opacity 0.2s cubic-bezier(0.64, 0.09, 0.08, 1), transform 0.2s cubic-bezier(0.64, 0.09, 0.08, 1); 58 | } 59 | 60 | .o-tooltip--left:hover:after { 61 | display: block; 62 | opacity: 1; 63 | visibility: visible; 64 | transform: translateX(-100%) translateY(0); 65 | transition: opacity 0.2s cubic-bezier(0.64, 0.09, 0.08, 1), transform 0.2s cubic-bezier(0.64, 0.09, 0.08, 1); 66 | transition-delay: .5s; 67 | } 68 | -------------------------------------------------------------------------------- /docs/_static/css/custom.css: -------------------------------------------------------------------------------- 1 | @import url("https://fonts.googleapis.com/css?family=Montserrat"); 2 | @import url("https://fonts.googleapis.com/css?family=JetBrains+Mono"); 3 | 4 | :root { 5 | --pst-header-height: 80px; 6 | --pst-font-size-base: 16px; 7 | --pst-font-family-base: Montserrat, var(--pst-font-family-base-system); 8 | --pst-font-family-heading: Montserrat, var(--pst-font-family-base-system); 9 | --pst-font-family-monospace: "JetBrains Mono", var(--pst-font-family-monospace-system); 10 | } 11 | 12 | /* Set font size for code examples */ 13 | span { 14 | font-size: 16px; 15 | } 16 | 17 | th, td { 18 | font-family: monospace; 19 | text-align: right; 20 | } 21 | 22 | #navbar-center { 23 | font-size: var(--pst-font-size-h4); 24 | } 25 | 26 | #navbar-icon-links i.fa, #navbar-icon-links i.fab, #navbar-icon-links i.far, #navbar-icon-links i.fas { 27 | vertical-align: middle; 28 | font-style: normal; 29 | font-size: 3rem; 30 | line-height: 1.25; 31 | } 32 | 33 | div.topic { 34 | border: 1px solid #eee; 35 | padding: 7px; 36 | margin: 10px 0 10px 0; 37 | } 38 | -------------------------------------------------------------------------------- /docs/_templates/layout.html: -------------------------------------------------------------------------------- 1 | {% extends "!layout.html" %} 2 | 3 | {%- block extrahead %} 4 | 5 | 41 | 42 | {% endblock %} 43 | -------------------------------------------------------------------------------- /docs/about.rst: -------------------------------------------------------------------------------- 1 | .. _about: 2 | 3 | About 4 | ===== 5 | 6 | .. only:: html 7 | 8 | :Release: |release| 9 | :Date: |today| 10 | 11 | CFPQ_Data development is guided by the following core team: 12 | 13 | .. raw:: html 14 | 15 | 28 | 29 | .. raw:: html 30 | 31 | 44 | 45 | .. raw:: html 46 | 47 | 60 | -------------------------------------------------------------------------------- /docs/benchmarks/index.rst: -------------------------------------------------------------------------------- 1 | .. _benchmarks: 2 | 3 | ********** 4 | Benchmarks 5 | ********** 6 | 7 | .. only:: html 8 | 9 | :Release: |release| 10 | :Date: |today| 11 | 12 | ---- 13 | 14 | Benchmarks content 15 | ------------------ 16 | 17 | .. list-table:: 18 | :header-rows: 1 19 | 20 | * - Benchmark 21 | - Download 22 | * - :ref:`msreachability` 23 | - `.tar.gz `_ 📥 24 | -------------------------------------------------------------------------------- /docs/grammars/data/dyck.rst: -------------------------------------------------------------------------------- 1 | .. _dyck: 2 | 3 | Dyck 4 | ==== 5 | 6 | .. contents:: Table of Contents 7 | 8 | Info 9 | ---- 10 | 11 | .. list-table:: 12 | :header-rows: 1 13 | 14 | * - 15 | - 16 | * - Full Name 17 | - Dyck Grammar 18 | * - Version 19 | - 4.0.0 20 | * - Class 21 | - Context-Free 22 | * - Kind 23 | - Hierarchical 24 | * - Example download (.txt + .md) 25 | - `.tar.gz `_ 26 | * - Origin 27 | - `link `_ 28 | 29 | 30 | Grammar Parameters 31 | ------------------ 32 | 33 | .. list-table:: 34 | :header-rows: 1 35 | 36 | * - Parameter 37 | - Description 38 | * - :math:`\textit{types}` 39 | - List of pairs :math:`(\textit{op}_i, \textit{cp}_i)` with opening and closing parentheses for each type 40 | * - :math:`\textit{eps}` 41 | - :math:`\textit{True}` if empty string is in the language and :math:`\textit{False}` otherwise 42 | 43 | 44 | Grammar Template 45 | ---------------- 46 | 47 | .. math:: 48 | 49 | S \, &\rightarrow \, \varepsilon \, \qquad \qquad &\textit{if } \textit{eps} = \textit{True} \, \\ 50 | S \, &\rightarrow \, \textit{op}_i \, \textit{cp}_i \qquad \qquad &\textit{if } \textit{eps} = \textit{False} \, \\ 51 | S \, &\rightarrow \, \textit{op}_i \, S \, \textit{cp}_i \, S \, &\\ 52 | &\forall \, (\textit{op}_i, \textit{cp}_i) \, \in \, \textit{types} \, &\\ 53 | 54 | 55 | Description 56 | ----------- 57 | Dyck grammars generate Dyck languages of the balanced strings with parentheses of :math:`|\textit{types}|` types. 58 | For example, such a grammar with :math:`\textit{types} = \{(a, b)\}` 59 | and :math:`\textit{eps} = \textit{True}` generates the language :math:`\{\varepsilon, a b, ab ab, aabb, \ldots\}`. 60 | 61 | 62 | Example Grammars 63 | ---------------- 64 | The Dyck grammar with :math:`\textit{types} = \{(a, b)\}` and :math:`\textit{eps} = \textit{True}`. 65 | 66 | .. math:: 67 | 68 | S \, \rightarrow \, \varepsilon \, \mid \, a \, S \, b \, S \, \\ 69 | 70 | `Pyformlang CFG `_: 71 | 72 | .. code-block:: python 73 | 74 | S -> epsilon | a S b S 75 | 76 | ---- 77 | 78 | The Dyck grammar with :math:`\textit{types} = \{(a, b)\}` and :math:`\textit{eps} = \textit{False}`. 79 | 80 | .. math:: 81 | 82 | S \, \rightarrow \, a \, b \, \mid \, a \, S \, b \, S \, \\ 83 | 84 | `Pyformlang CFG `_: 85 | 86 | .. code-block:: python 87 | 88 | S -> a b | a S b S 89 | 90 | ---- 91 | -------------------------------------------------------------------------------- /docs/grammars/data/java_points_to.rst: -------------------------------------------------------------------------------- 1 | .. _java_points-to: 2 | 3 | Java Points-to 4 | ============== 5 | 6 | .. contents:: Table of Contents 7 | 8 | Info 9 | ---- 10 | 11 | .. list-table:: 12 | :header-rows: 1 13 | 14 | * - 15 | - 16 | * - Full Name 17 | - Java Points-to Analysis Grammar 18 | * - Class 19 | - Context-Free 20 | * - Kind 21 | - Static Analysis 22 | * - Version 23 | - 4.0.0 24 | * - Example download (.txt + .md) 25 | - `.tar.gz `_ 26 | * - Origin 27 | - `link `_ 28 | 29 | 30 | Grammar Parameters 31 | ------------------ 32 | 33 | .. list-table:: 34 | :header-rows: 1 35 | 36 | * - Parameter 37 | - Description 38 | * - :math:`\textit{fields}` 39 | - List of fields :math:`f` used in Java program for load/store operations 40 | 41 | 42 | Grammar Template 43 | ---------------- 44 | 45 | .. math:: 46 | \textit{PointsTo} \, &\rightarrow \, (\textit{assign} \, \mid \, \textit{load}_f \, \textit{Alias} \, \textit{store}_f)^{*} \, \textit{alloc} \, \\ 47 | \textit{Alias} \, &\rightarrow \, \textit{PointsTo} \, \textit{FlowsTo} \, \\ 48 | \textit{FlowsTo} \, &\rightarrow \, \overline{\textit{alloc}} \, (\overline{\textit{assign}} \, \mid \, \overline{\textit{store}}_f \, \textit{Alias} \, \overline{\textit{load}}_f)^* \, \\ 49 | &\forall \, f \, \in \, \textit{fields} \, \\ 50 | 51 | 52 | Description 53 | ----------- 54 | Java points-to analysis grammar generates language for the field-sensitive analysis 55 | of Java programs, which tracks the dataflow between heap objects that are stored in 56 | and loaded from fields :math:`f \in \textit{fields}`. Introduced in 57 | `"Giga-scale exhaustive points-to analysis for Java in under a minute" `_. 58 | The dataflow of the program is constructed from object creations, variable assignments, 59 | and load/store operations on fields. 60 | 61 | 62 | Example Grammars 63 | ---------------- 64 | 65 | The Java points-to analysis grammar with :math:`\textit{fields} = [0, 1]`. 66 | 67 | `Pyformlang CFG `_: 68 | 69 | .. code-block:: python 70 | 71 | S -> PTh alloc 72 | PTh -> epsilon 73 | PTh -> assign PTh 74 | PTh -> load_0 Al store_0 PTh 75 | PTh -> load_1 Al store_1 PTh 76 | FT -> alloc_r FTh 77 | FTh -> epsilon 78 | FTh -> assign_r FTh 79 | FTh -> store_0_r Al load_0_r FTh 80 | FTh -> store_1_r Al load_1_r FTh 81 | Al -> S FT 82 | ---- 83 | -------------------------------------------------------------------------------- /docs/grammars/data/nested_parentheses.rst: -------------------------------------------------------------------------------- 1 | .. _nested_parentheses: 2 | 3 | Nested Parentheses 4 | ================== 5 | 6 | .. contents:: Table of Contents 7 | 8 | Info 9 | ---- 10 | 11 | .. list-table:: 12 | :header-rows: 1 13 | 14 | * - 15 | - 16 | * - Full Name 17 | - Nested Parentheses Grammar 18 | * - Version 19 | - 4.0.0 20 | * - Class 21 | - Context-Free 22 | * - Kind 23 | - Hierarchical 24 | * - Example download (.txt + .md) 25 | - `.tar.gz `_ 26 | * - Origin 27 | - `link `_ 28 | 29 | 30 | Grammar Parameters 31 | ------------------ 32 | 33 | .. list-table:: 34 | :header-rows: 1 35 | 36 | * - Parameter 37 | - Description 38 | * - :math:`\textit{types}` 39 | - List of pairs :math:`(\textit{op}_i, \textit{cp}_i)` with opening and closing parentheses for each type 40 | * - :math:`\textit{eps}` 41 | - :math:`\textit{True}` if empty string is in the language and :math:`\textit{False}` otherwise 42 | 43 | 44 | Grammar Template 45 | ---------------- 46 | 47 | .. math:: 48 | 49 | S \, &\rightarrow \, \varepsilon \, \qquad \qquad &\textit{if } \textit{eps} = \textit{True} \, \\ 50 | S \, &\rightarrow \, \textit{op}_i \, \textit{cp}_i \qquad \qquad &\textit{if } \textit{eps} = \textit{False} \, \\ 51 | S \, &\rightarrow \, \textit{op}_i \, S \, \textit{cp}_i \, &\\ 52 | &\forall \, (\textit{op}_i, \textit{cp}_i) \, \in \, \textit{types} \, &\\ 53 | 54 | 55 | Grammar Description 56 | ------------------- 57 | Nested parentheses grammars generate languages of the nested parentheses of :math:`|\textit{types}|` types. 58 | For example, such a grammar with :math:`\textit{types} = \{(a, b)\}` 59 | and :math:`\textit{eps} = \textit{True}` generates the language :math:`\{a^n b^n \ | \ n \geq 0\}`. 60 | 61 | 62 | Example Grammars 63 | ---------------- 64 | The nested parentheses grammar with :math:`\textit{types} = \{(a, b)\}` and :math:`\textit{eps} = \textit{True}`. 65 | 66 | .. math:: 67 | 68 | S \, \rightarrow \, \varepsilon \, \mid \, a \, S \, b \, \\ 69 | 70 | `Pyformlang CFG `_: 71 | 72 | .. code-block:: python 73 | 74 | S -> epsilon | a S b 75 | 76 | ---- 77 | 78 | The nested parentheses grammar with :math:`\textit{types} = \{(a, b)\}` and :math:`\textit{eps} = \textit{False}`. 79 | 80 | .. math:: 81 | 82 | S \, \rightarrow \, a \, b \, \mid \, a \, S \, b \, \\ 83 | 84 | `Pyformlang CFG `_: 85 | 86 | .. code-block:: python 87 | 88 | S -> a b | a S b 89 | 90 | ---- 91 | -------------------------------------------------------------------------------- /docs/grammars/index.rst: -------------------------------------------------------------------------------- 1 | .. _grammar_templates: 2 | 3 | ******** 4 | Grammars 5 | ******** 6 | 7 | .. only:: html 8 | 9 | :Release: |release| 10 | :Date: |today| 11 | 12 | How to add a new grammar? 13 | ------------------------- 14 | 15 | Just create a PR (Pull Request) corresponding to the `"Template for adding a new grammar" `_. 16 | 17 | ---- 18 | 19 | Grammar templates 20 | ----------------- 21 | 22 | .. list-table:: 23 | :header-rows: 1 24 | 25 | * - Grammar 26 | - Class 27 | - Kind 28 | - Examples 29 | * - :ref:`nested_parentheses` 30 | - Context-Free 31 | - Hierarchical 32 | - `.tar.gz `_ 📥 33 | * - :ref:`dyck` 34 | - Context-Free 35 | - Hierarchical 36 | - `.tar.gz `_ 📥 37 | * - :ref:`c_alias` 38 | - Context-Free 39 | - Static Analysis 40 | - `.tar.gz `_ 📥 41 | * - :ref:`java_points-to` 42 | - Context-Free 43 | - Static Analysis 44 | - `.tar.gz `_ 📥 45 | -------------------------------------------------------------------------------- /docs/graphs/data/apache.rst: -------------------------------------------------------------------------------- 1 | .. _apache: 2 | 3 | apache 4 | ====== 5 | 6 | .. contents:: Table of Contents 7 | 8 | Info 9 | ---- 10 | 11 | .. list-table:: 12 | :header-rows: 1 13 | 14 | * - 15 | - 16 | * - Full Name 17 | - apache_httpd_2_2_18_points_to_graph 18 | * - Version 19 | - 4.0.0 20 | * - Direct download (.csv + .md) 21 | - `.tar.gz `_ 22 | * - Origin 23 | - `.txt `_ 24 | 25 | 26 | CSV File Structure 27 | ------------------ 28 | 29 | .. list-table:: 30 | :header-rows: 1 31 | 32 | * - Column Number 33 | - Column Type 34 | - Column Description 35 | * - 1 36 | - int 37 | - The tail of the edge 38 | * - 2 39 | - int 40 | - The head of the edge 41 | * - 3 42 | - str 43 | - The label of the edge 44 | 45 | 46 | Graph Statistics 47 | ---------------- 48 | 49 | .. list-table:: 50 | :header-rows: 1 51 | 52 | * - Num Nodes 53 | - Num Edges 54 | * - 1721418 55 | - 1510411 56 | 57 | 58 | Edges Statistics 59 | ---------------- 60 | 61 | .. list-table:: 62 | :header-rows: 1 63 | 64 | * - Edge Label 65 | - Num Edge Label 66 | * - d 67 | - 1147612 68 | * - a 69 | - 362799 70 | 71 | Canonical grammars 72 | ------------------ 73 | 74 | .. note:: 75 | 76 | In order to get the original graph you must apply function `cfpq_data.change_edges` with `mapping={"a": "A", "d": "D"}` to this graph. In this case these grammars must be updated. 77 | 78 | Grammars for the alias analysis of C programs introduced in `"Demand-driven alias analysis for C" `_. 79 | Template for these grammars is described on the :ref:`c_alias` page. 80 | 81 | .. math:: 82 | 83 | S \, \rightarrow \, \overline{d} \, V \, d \, \\ 84 | V \, \rightarrow \, V_1 \, V_2 \, V_3 \, \\ 85 | V_1 \, \rightarrow \, \varepsilon \, \\ 86 | V_1 \, \rightarrow \, V_2 \, \overline{a} \, V_1 \, \\ 87 | V_2 \, \rightarrow \, \varepsilon \, \\ 88 | V_2 \, \rightarrow \, S \, \\ 89 | V_3 \, \rightarrow \, \varepsilon \, \\ 90 | V_3 \, \rightarrow \, a \, V_2 \, V_3 \, \\ 91 | 92 | `Pyformlang CFG `_: 93 | 94 | .. code-block:: python 95 | 96 | S -> d_r V d 97 | V -> V1 V2 V3 98 | V1 -> epsilon 99 | V1 -> V2 a_r V1 100 | V2 -> epsilon 101 | V2 -> S 102 | V3 -> epsilon 103 | V3 -> a V2 V3 104 | 105 | ---- 106 | 107 | .. math:: 108 | 109 | S \, \rightarrow \, \overline{d} \, V \, d \, \\ 110 | V \, \rightarrow \, ((S \mid \varepsilon) \, \overline{a})^{*} \, (S \mid \varepsilon) \, (a \, (S \mid \varepsilon))^{*} \, \\ 111 | 112 | `Pyformlang RSA `_: 113 | 114 | .. code-block:: python 115 | 116 | S -> d_r V d 117 | V -> ((S|epsilon) a_r)* (S|epsilon) (a (S|epsilon))* 118 | -------------------------------------------------------------------------------- /docs/graphs/data/arch.rst: -------------------------------------------------------------------------------- 1 | .. _arch: 2 | 3 | arch 4 | ==== 5 | 6 | .. contents:: Table of Contents 7 | 8 | Info 9 | ---- 10 | 11 | .. list-table:: 12 | :header-rows: 1 13 | 14 | * - 15 | - 16 | * - Full Name 17 | - arch_after_inline 18 | * - Version 19 | - 4.0.0 20 | * - Direct download (.csv + .md) 21 | - `.tar.gz `_ 22 | * - Origin 23 | - `.txt `_ 24 | 25 | 26 | CSV File Structure 27 | ------------------ 28 | 29 | .. list-table:: 30 | :header-rows: 1 31 | 32 | * - Column Number 33 | - Column Type 34 | - Column Description 35 | * - 1 36 | - int 37 | - The tail of the edge 38 | * - 2 39 | - int 40 | - The head of the edge 41 | * - 3 42 | - str 43 | - The label of the edge 44 | 45 | 46 | Graph Statistics 47 | ---------------- 48 | 49 | .. list-table:: 50 | :header-rows: 1 51 | 52 | * - Num Nodes 53 | - Num Edges 54 | * - 3448422 55 | - 2970242 56 | 57 | 58 | Edges Statistics 59 | ---------------- 60 | 61 | .. list-table:: 62 | :header-rows: 1 63 | 64 | * - Edge Label 65 | - Num Edge Label 66 | * - d 67 | - 2298947 68 | * - a 69 | - 671295 70 | 71 | Canonical grammars 72 | ------------------ 73 | 74 | .. note:: 75 | 76 | In order to get the original graph you must apply function `cfpq_data.change_edges` with `mapping={"a": "A", "d": "D"}` to this graph. In this case these grammars must be updated. 77 | 78 | Grammars for the alias analysis of C programs introduced in `"Demand-driven alias analysis for C" `_. 79 | Template for these grammars is described on the :ref:`c_alias` page. 80 | 81 | .. math:: 82 | 83 | S \, \rightarrow \, \overline{d} \, V \, d \, \\ 84 | V \, \rightarrow \, V_1 \, V_2 \, V_3 \, \\ 85 | V_1 \, \rightarrow \, \varepsilon \, \\ 86 | V_1 \, \rightarrow \, V_2 \, \overline{a} \, V_1 \, \\ 87 | V_2 \, \rightarrow \, \varepsilon \, \\ 88 | V_2 \, \rightarrow \, S \, \\ 89 | V_3 \, \rightarrow \, \varepsilon \, \\ 90 | V_3 \, \rightarrow \, a \, V_2 \, V_3 \, \\ 91 | 92 | `Pyformlang CFG `_: 93 | 94 | .. code-block:: python 95 | 96 | S -> d_r V d 97 | V -> V1 V2 V3 98 | V1 -> epsilon 99 | V1 -> V2 a_r V1 100 | V2 -> epsilon 101 | V2 -> S 102 | V3 -> epsilon 103 | V3 -> a V2 V3 104 | 105 | ---- 106 | 107 | .. math:: 108 | 109 | S \, \rightarrow \, \overline{d} \, V \, d \, \\ 110 | V \, \rightarrow \, ((S \mid \varepsilon) \, \overline{a})^{*} \, (S \mid \varepsilon) \, (a \, (S \mid \varepsilon))^{*} \, \\ 111 | 112 | `Pyformlang RSA `_: 113 | 114 | .. code-block:: python 115 | 116 | S -> d_r V d 117 | V -> ((S|epsilon) a_r)* (S|epsilon) (a (S|epsilon))* 118 | -------------------------------------------------------------------------------- /docs/graphs/data/avrora.rst: -------------------------------------------------------------------------------- 1 | .. _avrora: 2 | 3 | avrora 4 | ===== 5 | 6 | .. contents:: Table of Contents 7 | 8 | Info 9 | ---- 10 | 11 | .. list-table:: 12 | :header-rows: 1 13 | 14 | * - 15 | - 16 | * - Full Name 17 | - avrora 18 | * - Version 19 | - 4.0.0 20 | * - Direct download (.csv + .md) 21 | - `.tar.gz `_ 22 | * - Origin 23 | - `link `_ 24 | 25 | 26 | CSV File Structure 27 | ------------------ 28 | 29 | .. list-table:: 30 | :header-rows: 1 31 | 32 | * - Column Number 33 | - Column Type 34 | - Column Description 35 | * - 1 36 | - int 37 | - The tail of the edge 38 | * - 2 39 | - int 40 | - The head of the edge 41 | * - 3 42 | - str 43 | - The label of the edge 44 | 45 | 46 | Graph Statistics 47 | ---------------- 48 | 49 | .. list-table:: 50 | :header-rows: 1 51 | 52 | * - Num Nodes 53 | - Num Edges 54 | * - 24690 55 | - 25196 56 | 57 | 58 | Edges Statistics 59 | ---------------- 60 | 61 | .. note:: 62 | 63 | This graph has edges with labels :math:`\textit{load}_f` and :math:`\textit{store}_f` for all :math:`f \in \textit{Fields} = \{0, \ldots, 857\}`. 64 | 65 | .. list-table:: 66 | :header-rows: 1 67 | 68 | * - Edge Label 69 | - Num Edge Label 70 | * - :math:`\textit{alloc}` 71 | - 4526 72 | * - :math:`\textit{assign}` 73 | - 16009 74 | * - :math:`\textit{load}_f` 75 | - 3684 76 | * - :math:`\textit{store}_f` 77 | - 977 78 | 79 | 80 | Canonical grammars 81 | ------------------ 82 | 83 | Grammars for the field-sensitive analysis of Java programs introduced in `"Giga-scale exhaustive points-to analysis for Java in under a minute" `_. 84 | Template for these grammars is described on the :ref:`java_points-to` page. 85 | 86 | .. math:: 87 | \textit{PointsTo} \, \rightarrow \, (\textit{assign} \mid \textit{load}_f \, \textit{Alias} \, \textit{store}_f)^{*} \, \textit{alloc} \, \\ 88 | \textit{Alias} \, \rightarrow \, \textit{PointsTo} \, \textit{FlowsTo} \, \\ 89 | \textit{FlowsTo} \, \rightarrow \, \overline{\textit{alloc}} \, (\overline{\textit{assign}} \mid \overline{\textit{store}_f} \, \textit{Alias} \, \overline{\textit{load}_f})^* \, \\ 90 | \forall \, f \, \in \, Fields 91 | -------------------------------------------------------------------------------- /docs/graphs/data/batik.rst: -------------------------------------------------------------------------------- 1 | .. _batik: 2 | 3 | batik 4 | ===== 5 | 6 | .. contents:: Table of Contents 7 | 8 | Info 9 | ---- 10 | 11 | .. list-table:: 12 | :header-rows: 1 13 | 14 | * - 15 | - 16 | * - Full Name 17 | - batik 18 | * - Version 19 | - 4.0.0 20 | * - Direct download (.csv + .md) 21 | - `.tar.gz `_ 22 | * - Origin 23 | - `link `_ 24 | 25 | 26 | CSV File Structure 27 | ------------------ 28 | 29 | .. list-table:: 30 | :header-rows: 1 31 | 32 | * - Column Number 33 | - Column Type 34 | - Column Description 35 | * - 1 36 | - int 37 | - The tail of the edge 38 | * - 2 39 | - int 40 | - The head of the edge 41 | * - 3 42 | - str 43 | - The label of the edge 44 | 45 | 46 | Graph Statistics 47 | ---------------- 48 | 49 | .. list-table:: 50 | :header-rows: 1 51 | 52 | * - Num Nodes 53 | - Num Edges 54 | * - 60175 55 | - 63089 56 | 57 | 58 | Edges Statistics 59 | ---------------- 60 | 61 | .. note:: 62 | 63 | This graph has edges with labels :math:`\textit{load}_f` and :math:`\textit{store}_f` for all :math:`f \in \textit{Fields} = \{0, \ldots, 1005\}`. 64 | 65 | .. list-table:: 66 | :header-rows: 1 67 | 68 | * - Edge Label 69 | - Num Edge Label 70 | * - :math:`\textit{alloc}` 71 | - 10322 72 | * - :math:`\textit{assign}` 73 | - 43905 74 | * - :math:`\textit{load}_f` 75 | - 7176 76 | * - :math:`\textit{store}_f` 77 | - 1686 78 | 79 | 80 | Canonical grammars 81 | ------------------ 82 | 83 | Grammars for the field-sensitive analysis of Java programs introduced in `"Giga-scale exhaustive points-to analysis for Java in under a minute" `_. 84 | Template for these grammars is described on the :ref:`java_points-to` page. 85 | 86 | .. math:: 87 | \textit{PointsTo} \, \rightarrow \, (\textit{assign} \mid \textit{load}_f \, \textit{Alias} \, \textit{store}_f)^{*} \, \textit{alloc} \, \\ 88 | \textit{Alias} \, \rightarrow \, \textit{PointsTo} \, \textit{FlowsTo} \, \\ 89 | \textit{FlowsTo} \, \rightarrow \, \overline{\textit{alloc}} \, (\overline{\textit{assign}} \mid \overline{\textit{store}_f} \, \textit{Alias} \, \overline{\textit{load}_f})^* \, \\ 90 | \forall \, f \, \in \, Fields 91 | -------------------------------------------------------------------------------- /docs/graphs/data/block.rst: -------------------------------------------------------------------------------- 1 | .. _block: 2 | 3 | block 4 | ===== 5 | 6 | .. contents:: Table of Contents 7 | 8 | Info 9 | ---- 10 | 11 | .. list-table:: 12 | :header-rows: 1 13 | 14 | * - 15 | - 16 | * - Full Name 17 | - block_after_inline 18 | * - Version 19 | - 4.0.0 20 | * - Direct download (.csv + .md) 21 | - `.tar.gz `_ 22 | * - Origin 23 | - `.txt `_ 24 | 25 | 26 | CSV File Structure 27 | ------------------ 28 | 29 | .. list-table:: 30 | :header-rows: 1 31 | 32 | * - Column Number 33 | - Column Type 34 | - Column Description 35 | * - 1 36 | - int 37 | - The tail of the edge 38 | * - 2 39 | - int 40 | - The head of the edge 41 | * - 3 42 | - str 43 | - The label of the edge 44 | 45 | 46 | Graph Statistics 47 | ---------------- 48 | 49 | .. list-table:: 50 | :header-rows: 1 51 | 52 | * - Num Nodes 53 | - Num Edges 54 | * - 3423234 55 | - 2951393 56 | 57 | 58 | Edges Statistics 59 | ---------------- 60 | 61 | .. list-table:: 62 | :header-rows: 1 63 | 64 | * - Edge Label 65 | - Num Edge Label 66 | * - d 67 | - 2282155 68 | * - a 69 | - 669238 70 | 71 | Canonical grammars 72 | ------------------ 73 | 74 | .. note:: 75 | 76 | In order to get the original graph you must apply function `cfpq_data.change_edges` with `mapping={"a": "A", "d": "D"}` to this graph. In this case these grammars must be updated. 77 | 78 | Grammars for the alias analysis of C programs introduced in `"Demand-driven alias analysis for C" `_. 79 | Template for these grammars is described on the :ref:`c_alias` page. 80 | 81 | .. math:: 82 | 83 | S \, \rightarrow \, \overline{d} \, V \, d \, \\ 84 | V \, \rightarrow \, V_1 \, V_2 \, V_3 \, \\ 85 | V_1 \, \rightarrow \, \varepsilon \, \\ 86 | V_1 \, \rightarrow \, V_2 \, \overline{a} \, V_1 \, \\ 87 | V_2 \, \rightarrow \, \varepsilon \, \\ 88 | V_2 \, \rightarrow \, S \, \\ 89 | V_3 \, \rightarrow \, \varepsilon \, \\ 90 | V_3 \, \rightarrow \, a \, V_2 \, V_3 \, \\ 91 | 92 | `Pyformlang CFG `_: 93 | 94 | .. code-block:: python 95 | 96 | S -> d_r V d 97 | V -> V1 V2 V3 98 | V1 -> epsilon 99 | V1 -> V2 a_r V1 100 | V2 -> epsilon 101 | V2 -> S 102 | V3 -> epsilon 103 | V3 -> a V2 V3 104 | 105 | ---- 106 | 107 | .. math:: 108 | 109 | S \, \rightarrow \, \overline{d} \, V \, d \, \\ 110 | V \, \rightarrow \, ((S \mid \varepsilon) \, \overline{a})^{*} \, (S \mid \varepsilon) \, (a \, (S \mid \varepsilon))^{*} \, \\ 111 | 112 | `Pyformlang RSA `_: 113 | 114 | .. code-block:: python 115 | 116 | S -> d_r V d 117 | V -> ((S|epsilon) a_r)* (S|epsilon) (a (S|epsilon))* 118 | -------------------------------------------------------------------------------- /docs/graphs/data/bzip.rst: -------------------------------------------------------------------------------- 1 | .. _bzip: 2 | 3 | bzip 4 | ===== 5 | 6 | .. contents:: Table of Contents 7 | 8 | Info 9 | ---- 10 | 11 | .. list-table:: 12 | :header-rows: 1 13 | 14 | * - 15 | - 16 | * - Full Name 17 | - bzip2 18 | * - Version 19 | - 4.0.0 20 | * - Direct download (.csv + .md) 21 | - `.tar.gz `_ 22 | * - Origin 23 | - `link `_ 24 | 25 | 26 | CSV File Structure 27 | ------------------ 28 | 29 | .. list-table:: 30 | :header-rows: 1 31 | 32 | * - Column Number 33 | - Column Type 34 | - Column Description 35 | * - 1 36 | - int 37 | - The tail of the edge 38 | * - 2 39 | - int 40 | - The head of the edge 41 | * - 3 42 | - str 43 | - The label of the edge 44 | 45 | 46 | Graph Statistics 47 | ---------------- 48 | 49 | .. list-table:: 50 | :header-rows: 1 51 | 52 | * - Num Nodes 53 | - Num Edges 54 | * - 632 55 | - 556 56 | 57 | 58 | Edges Statistics 59 | ---------------- 60 | 61 | .. list-table:: 62 | :header-rows: 1 63 | 64 | * - Edge Label 65 | - Num Edge Label 66 | * - d 67 | - 297 68 | * - a 69 | - 259 70 | 71 | Canonical grammars 72 | ------------------ 73 | 74 | .. note:: 75 | 76 | In order to get the original graph you must apply function `cfpq_data.change_edges` with `mapping={"a": "A", "d": "D"}` to this graph. In this case these grammars must be updated. 77 | 78 | Grammars for the alias analysis of C programs introduced in `"Demand-driven alias analysis for C" `_. 79 | Template for these grammars is described on the :ref:`c_alias` page. 80 | 81 | .. math:: 82 | 83 | S \, \rightarrow \, \overline{d} \, V \, d \, \\ 84 | V \, \rightarrow \, V_1 \, V_2 \, V_3 \, \\ 85 | V_1 \, \rightarrow \, \varepsilon \, \\ 86 | V_1 \, \rightarrow \, V_2 \, \overline{a} \, V_1 \, \\ 87 | V_2 \, \rightarrow \, \varepsilon \, \\ 88 | V_2 \, \rightarrow \, S \, \\ 89 | V_3 \, \rightarrow \, \varepsilon \, \\ 90 | V_3 \, \rightarrow \, a \, V_2 \, V_3 \, \\ 91 | 92 | `Pyformlang CFG `_: 93 | 94 | .. code-block:: python 95 | 96 | S -> d_r V d 97 | V -> V1 V2 V3 98 | V1 -> epsilon 99 | V1 -> V2 a_r V1 100 | V2 -> epsilon 101 | V2 -> S 102 | V3 -> epsilon 103 | V3 -> a V2 V3 104 | 105 | ---- 106 | 107 | .. math:: 108 | 109 | S \, \rightarrow \, \overline{d} \, V \, d \, \\ 110 | V \, \rightarrow \, ((S \mid \varepsilon) \, \overline{a})^{*} \, (S \mid \varepsilon) \, (a \, (S \mid \varepsilon))^{*} \, \\ 111 | 112 | `Pyformlang RSA `_: 113 | 114 | .. code-block:: python 115 | 116 | S -> d_r V d 117 | V -> ((S|epsilon) a_r)* (S|epsilon) (a (S|epsilon))* 118 | -------------------------------------------------------------------------------- /docs/graphs/data/crypto.rst: -------------------------------------------------------------------------------- 1 | .. _crypto: 2 | 3 | crypto 4 | ====== 5 | 6 | .. contents:: Table of Contents 7 | 8 | Info 9 | ---- 10 | 11 | .. list-table:: 12 | :header-rows: 1 13 | 14 | * - 15 | - 16 | * - Full Name 17 | - crypto_after_inline 18 | * - Version 19 | - 4.0.0 20 | * - Direct download (.csv + .md) 21 | - `.tar.gz `_ 22 | * - Origin 23 | - `.txt `_ 24 | 25 | 26 | CSV File Structure 27 | ------------------ 28 | 29 | .. list-table:: 30 | :header-rows: 1 31 | 32 | * - Column Number 33 | - Column Type 34 | - Column Description 35 | * - 1 36 | - int 37 | - The tail of the edge 38 | * - 2 39 | - int 40 | - The head of the edge 41 | * - 3 42 | - str 43 | - The label of the edge 44 | 45 | 46 | Graph Statistics 47 | ---------------- 48 | 49 | .. list-table:: 50 | :header-rows: 1 51 | 52 | * - Num Nodes 53 | - Num Edges 54 | * - 3464970 55 | - 2988387 56 | 57 | 58 | Edges Statistics 59 | ---------------- 60 | 61 | .. list-table:: 62 | :header-rows: 1 63 | 64 | * - Edge Label 65 | - Num Edge Label 66 | * - d 67 | - 2309979 68 | * - a 69 | - 678408 70 | 71 | Canonical grammars 72 | ------------------ 73 | 74 | .. note:: 75 | 76 | In order to get the original graph you must apply function `cfpq_data.change_edges` with `mapping={"a": "A", "d": "D"}` to this graph. In this case these grammars must be updated. 77 | 78 | Grammars for the alias analysis of C programs introduced in `"Demand-driven alias analysis for C" `_. 79 | Template for these grammars is described on the :ref:`c_alias` page. 80 | 81 | .. math:: 82 | 83 | S \, \rightarrow \, \overline{d} \, V \, d \, \\ 84 | V \, \rightarrow \, V_1 \, V_2 \, V_3 \, \\ 85 | V_1 \, \rightarrow \, \varepsilon \, \\ 86 | V_1 \, \rightarrow \, V_2 \, \overline{a} \, V_1 \, \\ 87 | V_2 \, \rightarrow \, \varepsilon \, \\ 88 | V_2 \, \rightarrow \, S \, \\ 89 | V_3 \, \rightarrow \, \varepsilon \, \\ 90 | V_3 \, \rightarrow \, a \, V_2 \, V_3 \, \\ 91 | 92 | `Pyformlang CFG `_: 93 | 94 | .. code-block:: python 95 | 96 | S -> d_r V d 97 | V -> V1 V2 V3 98 | V1 -> epsilon 99 | V1 -> V2 a_r V1 100 | V2 -> epsilon 101 | V2 -> S 102 | V3 -> epsilon 103 | V3 -> a V2 V3 104 | 105 | ---- 106 | 107 | .. math:: 108 | 109 | S \, \rightarrow \, \overline{d} \, V \, d \, \\ 110 | V \, \rightarrow \, ((S \mid \varepsilon) \, \overline{a})^{*} \, (S \mid \varepsilon) \, (a \, (S \mid \varepsilon))^{*} \, \\ 111 | 112 | `Pyformlang RSA `_: 113 | 114 | .. code-block:: python 115 | 116 | S -> d_r V d 117 | V -> ((S|epsilon) a_r)* (S|epsilon) (a (S|epsilon))* 118 | -------------------------------------------------------------------------------- /docs/graphs/data/drivers.rst: -------------------------------------------------------------------------------- 1 | .. _drivers: 2 | 3 | drivers 4 | ======= 5 | 6 | .. contents:: Table of Contents 7 | 8 | Info 9 | ---- 10 | 11 | .. list-table:: 12 | :header-rows: 1 13 | 14 | * - 15 | - 16 | * - Full Name 17 | - drivers_after_inline 18 | * - Version 19 | - 4.0.0 20 | * - Direct download (.csv + .md) 21 | - `.tar.gz `_ 22 | * - Origin 23 | - `.txt `_ 24 | 25 | 26 | CSV File Structure 27 | ------------------ 28 | 29 | .. list-table:: 30 | :header-rows: 1 31 | 32 | * - Column Number 33 | - Column Type 34 | - Column Description 35 | * - 1 36 | - int 37 | - The tail of the edge 38 | * - 2 39 | - int 40 | - The head of the edge 41 | * - 3 42 | - str 43 | - The label of the edge 44 | 45 | 46 | Graph Statistics 47 | ---------------- 48 | 49 | .. list-table:: 50 | :header-rows: 1 51 | 52 | * - Num Nodes 53 | - Num Edges 54 | * - 4273803 55 | - 3707769 56 | 57 | 58 | Edges Statistics 59 | ---------------- 60 | 61 | .. list-table:: 62 | :header-rows: 1 63 | 64 | * - Edge Label 65 | - Num Edge Label 66 | * - d 67 | - 2849201 68 | * - a 69 | - 858568 70 | 71 | Canonical grammars 72 | ------------------ 73 | 74 | .. note:: 75 | 76 | In order to get the original graph you must apply function `cfpq_data.change_edges` with `mapping={"a": "A", "d": "D"}` to this graph. In this case these grammars must be updated. 77 | 78 | Grammars for the alias analysis of C programs introduced in `"Demand-driven alias analysis for C" `_. 79 | Template for these grammars is described on the :ref:`c_alias` page. 80 | 81 | .. math:: 82 | 83 | S \, \rightarrow \, \overline{d} \, V \, d \, \\ 84 | V \, \rightarrow \, V_1 \, V_2 \, V_3 \, \\ 85 | V_1 \, \rightarrow \, \varepsilon \, \\ 86 | V_1 \, \rightarrow \, V_2 \, \overline{a} \, V_1 \, \\ 87 | V_2 \, \rightarrow \, \varepsilon \, \\ 88 | V_2 \, \rightarrow \, S \, \\ 89 | V_3 \, \rightarrow \, \varepsilon \, \\ 90 | V_3 \, \rightarrow \, a \, V_2 \, V_3 \, \\ 91 | 92 | `Pyformlang CFG `_: 93 | 94 | .. code-block:: python 95 | 96 | S -> d_r V d 97 | V -> V1 V2 V3 98 | V1 -> epsilon 99 | V1 -> V2 a_r V1 100 | V2 -> epsilon 101 | V2 -> S 102 | V3 -> epsilon 103 | V3 -> a V2 V3 104 | 105 | ---- 106 | 107 | .. math:: 108 | 109 | S \, \rightarrow \, \overline{d} \, V \, d \, \\ 110 | V \, \rightarrow \, ((S \mid \varepsilon) \, \overline{a})^{*} \, (S \mid \varepsilon) \, (a \, (S \mid \varepsilon))^{*} \, \\ 111 | 112 | `Pyformlang RSA `_: 113 | 114 | .. code-block:: python 115 | 116 | S -> d_r V d 117 | V -> ((S|epsilon) a_r)* (S|epsilon) (a (S|epsilon))* 118 | -------------------------------------------------------------------------------- /docs/graphs/data/eclipse.rst: -------------------------------------------------------------------------------- 1 | .. _eclipse: 2 | 3 | eclipse 4 | ===== 5 | 6 | .. contents:: Table of Contents 7 | 8 | Info 9 | ---- 10 | 11 | .. list-table:: 12 | :header-rows: 1 13 | 14 | * - 15 | - 16 | * - Full Name 17 | - eclipse 18 | * - Version 19 | - 4.0.0 20 | * - Direct download (.csv + .md) 21 | - `.tar.gz `_ 22 | * - Origin 23 | - `link `_ 24 | 25 | 26 | CSV File Structure 27 | ------------------ 28 | 29 | .. list-table:: 30 | :header-rows: 1 31 | 32 | * - Column Number 33 | - Column Type 34 | - Column Description 35 | * - 1 36 | - int 37 | - The tail of the edge 38 | * - 2 39 | - int 40 | - The head of the edge 41 | * - 3 42 | - str 43 | - The label of the edge 44 | 45 | 46 | Graph Statistics 47 | ---------------- 48 | 49 | .. list-table:: 50 | :header-rows: 1 51 | 52 | * - Num Nodes 53 | - Num Edges 54 | * - 41383 55 | - 40200 56 | 57 | 58 | Edges Statistics 59 | ---------------- 60 | 61 | .. note:: 62 | 63 | This graph has edges with labels :math:`\textit{load}_f` and :math:`\textit{store}_f` for all :math:`f \in \textit{Fields} = \{0, \ldots, 758\}`. 64 | 65 | .. list-table:: 66 | :header-rows: 1 67 | 68 | * - Edge Label 69 | - Num Edge Label 70 | * - :math:`\textit{alloc}` 71 | - 7129 72 | * - :math:`\textit{assign}` 73 | - 27535 74 | * - :math:`\textit{load}_f` 75 | - 4575 76 | * - :math:`\textit{store}_f` 77 | - 961 78 | 79 | 80 | Canonical grammars 81 | ------------------ 82 | 83 | Grammars for the field-sensitive analysis of Java programs introduced in `"Giga-scale exhaustive points-to analysis for Java in under a minute" `_. 84 | Template for these grammars is described on the :ref:`java_points-to` page. 85 | 86 | .. math:: 87 | \textit{PointsTo} \, \rightarrow \, (\textit{assign} \mid \textit{load}_f \, \textit{Alias} \, \textit{store}_f)^{*} \, \textit{alloc} \, \\ 88 | \textit{Alias} \, \rightarrow \, \textit{PointsTo} \, \textit{FlowsTo} \, \\ 89 | \textit{FlowsTo} \, \rightarrow \, \overline{\textit{alloc}} \, (\overline{\textit{assign}} \mid \overline{\textit{store}_f} \, \textit{Alias} \, \overline{\textit{load}_f})^* \, \\ 90 | \forall \, f \, \in \, Fields 91 | -------------------------------------------------------------------------------- /docs/graphs/data/fop.rst: -------------------------------------------------------------------------------- 1 | .. _fop: 2 | 3 | fop 4 | ===== 5 | 6 | .. contents:: Table of Contents 7 | 8 | Info 9 | ---- 10 | 11 | .. list-table:: 12 | :header-rows: 1 13 | 14 | * - 15 | - 16 | * - Full Name 17 | - fop 18 | * - Version 19 | - 4.0.0 20 | * - Direct download (.csv + .md) 21 | - `.tar.gz `_ 22 | * - Origin 23 | - `link `_ 24 | 25 | 26 | CSV File Structure 27 | ------------------ 28 | 29 | .. list-table:: 30 | :header-rows: 1 31 | 32 | * - Column Number 33 | - Column Type 34 | - Column Description 35 | * - 1 36 | - int 37 | - The tail of the edge 38 | * - 2 39 | - int 40 | - The head of the edge 41 | * - 3 42 | - str 43 | - The label of the edge 44 | 45 | 46 | Graph Statistics 47 | ---------------- 48 | 49 | .. list-table:: 50 | :header-rows: 1 51 | 52 | * - Num Nodes 53 | - Num Edges 54 | * - 86183 55 | - 83016 56 | 57 | 58 | Edges Statistics 59 | ---------------- 60 | 61 | .. note:: 62 | 63 | This graph has edges with labels :math:`\textit{load}_f` and :math:`\textit{store}_f` for all :math:`f \in \textit{Fields} = \{0, \ldots, 1470\}`. 64 | 65 | .. list-table:: 66 | :header-rows: 1 67 | 68 | * - Edge Label 69 | - Num Edge Label 70 | * - :math:`\textit{alloc}` 71 | - 20462 72 | * - :math:`\textit{assign}` 73 | - 53350 74 | * - :math:`\textit{load}_f` 75 | - 7212 76 | * - :math:`\textit{store}_f` 77 | - 1992 78 | 79 | 80 | Canonical grammars 81 | ------------------ 82 | 83 | Grammars for the field-sensitive analysis of Java programs introduced in `"Giga-scale exhaustive points-to analysis for Java in under a minute" `_. 84 | Template for these grammars is described on the :ref:`java_points-to` page. 85 | 86 | .. math:: 87 | \textit{PointsTo} \, \rightarrow \, (\textit{assign} \mid \textit{load}_f \, \textit{Alias} \, \textit{store}_f)^{*} \, \textit{alloc} \, \\ 88 | \textit{Alias} \, \rightarrow \, \textit{PointsTo} \, \textit{FlowsTo} \, \\ 89 | \textit{FlowsTo} \, \rightarrow \, \overline{\textit{alloc}} \, (\overline{\textit{assign}} \mid \overline{\textit{store}_f} \, \textit{Alias} \, \overline{\textit{load}_f})^* \, \\ 90 | \forall \, f \, \in \, Fields 91 | -------------------------------------------------------------------------------- /docs/graphs/data/fs.rst: -------------------------------------------------------------------------------- 1 | .. _fs: 2 | 3 | fs 4 | == 5 | 6 | .. contents:: Table of Contents 7 | 8 | Info 9 | ---- 10 | 11 | .. list-table:: 12 | :header-rows: 1 13 | 14 | * - 15 | - 16 | * - Full Name 17 | - fs_after_inline 18 | * - Version 19 | - 4.0.0 20 | * - Direct download (.csv + .md) 21 | - `.tar.gz `_ 22 | * - Origin 23 | - `.txt `_ 24 | 25 | 26 | CSV File Structure 27 | ------------------ 28 | 29 | .. list-table:: 30 | :header-rows: 1 31 | 32 | * - Column Number 33 | - Column Type 34 | - Column Description 35 | * - 1 36 | - int 37 | - The tail of the edge 38 | * - 2 39 | - int 40 | - The head of the edge 41 | * - 3 42 | - str 43 | - The label of the edge 44 | 45 | 46 | Graph Statistics 47 | ---------------- 48 | 49 | .. list-table:: 50 | :header-rows: 1 51 | 52 | * - Num Nodes 53 | - Num Edges 54 | * - 4177416 55 | - 3609373 56 | 57 | 58 | Edges Statistics 59 | ---------------- 60 | 61 | .. list-table:: 62 | :header-rows: 1 63 | 64 | * - Edge Label 65 | - Num Edge Label 66 | * - d 67 | - 2784943 68 | * - a 69 | - 824430 70 | 71 | Canonical grammars 72 | ------------------ 73 | 74 | .. note:: 75 | 76 | In order to get the original graph you must apply function `cfpq_data.change_edges` with `mapping={"a": "A", "d": "D"}` to this graph. In this case these grammars must be updated. 77 | 78 | Grammars for the alias analysis of C programs introduced in `"Demand-driven alias analysis for C" `_. 79 | Template for these grammars is described on the :ref:`c_alias` page. 80 | 81 | .. math:: 82 | 83 | S \, \rightarrow \, \overline{d} \, V \, d \, \\ 84 | V \, \rightarrow \, V_1 \, V_2 \, V_3 \, \\ 85 | V_1 \, \rightarrow \, \varepsilon \, \\ 86 | V_1 \, \rightarrow \, V_2 \, \overline{a} \, V_1 \, \\ 87 | V_2 \, \rightarrow \, \varepsilon \, \\ 88 | V_2 \, \rightarrow \, S \, \\ 89 | V_3 \, \rightarrow \, \varepsilon \, \\ 90 | V_3 \, \rightarrow \, a \, V_2 \, V_3 \, \\ 91 | 92 | `Pyformlang CFG `_: 93 | 94 | .. code-block:: python 95 | 96 | S -> d_r V d 97 | V -> V1 V2 V3 98 | V1 -> epsilon 99 | V1 -> V2 a_r V1 100 | V2 -> epsilon 101 | V2 -> S 102 | V3 -> epsilon 103 | V3 -> a V2 V3 104 | 105 | ---- 106 | 107 | .. math:: 108 | 109 | S \, \rightarrow \, \overline{d} \, V \, d \, \\ 110 | V \, \rightarrow \, ((S \mid \varepsilon) \, \overline{a})^{*} \, (S \mid \varepsilon) \, (a \, (S \mid \varepsilon))^{*} \, \\ 111 | 112 | `Pyformlang RSA `_: 113 | 114 | .. code-block:: python 115 | 116 | S -> d_r V d 117 | V -> ((S|epsilon) a_r)* (S|epsilon) (a (S|epsilon))* 118 | -------------------------------------------------------------------------------- /docs/graphs/data/go_hierarchy.rst: -------------------------------------------------------------------------------- 1 | .. _go_hierarchy: 2 | 3 | go_hierarchy 4 | ============ 5 | 6 | .. contents:: Table of Contents 7 | 8 | Info 9 | ---- 10 | 11 | .. list-table:: 12 | :header-rows: 1 13 | 14 | * - 15 | - 16 | * - Full Name 17 | - go_hierarchy 18 | * - Version 19 | - 4.0.0 20 | * - Direct download (.csv + .md) 21 | - `.tar.gz `_ 22 | * - Origin 23 | - `.owl.xz `_ 24 | 25 | 26 | CSV File Structure 27 | ------------------ 28 | 29 | .. list-table:: 30 | :header-rows: 1 31 | 32 | * - Column Number 33 | - Column Type 34 | - Column Description 35 | * - 1 36 | - int 37 | - The tail of the edge 38 | * - 2 39 | - int 40 | - The head of the edge 41 | * - 3 42 | - str 43 | - The label of the edge 44 | 45 | 46 | Graph Statistics 47 | ---------------- 48 | 49 | .. list-table:: 50 | :header-rows: 1 51 | 52 | * - Num Nodes 53 | - Num Edges 54 | * - 45007 55 | - 490109 56 | 57 | 58 | Edges Statistics 59 | ---------------- 60 | 61 | .. list-table:: 62 | :header-rows: 1 63 | 64 | * - Edge Label 65 | - Num Edge Label 66 | * - subClassOf 67 | - 490109 68 | 69 | Canonical grammars 70 | ------------------ 71 | 72 | Nested parentheses grammars introduced in `"Context-Free Path Queries on RDF Graphs" `_. 73 | Template for these grammars is described on the :ref:`nested_parentheses` page. 74 | 75 | .. math:: 76 | 77 | S \, \rightarrow \, \overline{subClassOf} \, S \, subClassOf \, \mid \, \overline{subClassOf} \, subClassOf \, \\ 78 | S \, \rightarrow \, \overline{type} \, S \, type \, \mid \, \overline{type} \, type \, \\ 79 | 80 | `Pyformlang CFG `_: 81 | 82 | .. code-block:: python 83 | 84 | S -> subClassOf_r S subClassOf | subClassOf_r subClassOf 85 | S -> type_r S type | type_r type 86 | 87 | ---- 88 | 89 | .. math:: 90 | 91 | S \, \rightarrow \, \overline{subClassOf} \, S \, subClassOf \, \mid \, \overline{subClassOf} \, subClassOf \, \\ 92 | 93 | `Pyformlang CFG `_: 94 | 95 | .. code-block:: python 96 | 97 | S -> subClassOf_r S subClassOf | subClassOf_r subClassOf 98 | 99 | ---- 100 | 101 | .. math:: 102 | 103 | S \, \rightarrow \, \overline{type} \, S \, type \, \mid \, \overline{type} \, type \, \\ 104 | 105 | `Pyformlang CFG `_: 106 | 107 | .. code-block:: python 108 | 109 | S -> type_r S type | type_r type 110 | -------------------------------------------------------------------------------- /docs/graphs/data/gzip.rst: -------------------------------------------------------------------------------- 1 | .. _gzip: 2 | 3 | gzip 4 | ==== 5 | 6 | .. contents:: Table of Contents 7 | 8 | Info 9 | ---- 10 | 11 | .. list-table:: 12 | :header-rows: 1 13 | 14 | * - 15 | - 16 | * - Full Name 17 | - gzip 18 | * - Version 19 | - 4.0.0 20 | * - Direct download (.csv + .md) 21 | - `.tar.gz `_ 22 | * - Origin 23 | - `link `_ 24 | 25 | 26 | CSV File Structure 27 | ------------------ 28 | 29 | .. list-table:: 30 | :header-rows: 1 31 | 32 | * - Column Number 33 | - Column Type 34 | - Column Description 35 | * - 1 36 | - int 37 | - The tail of the edge 38 | * - 2 39 | - int 40 | - The head of the edge 41 | * - 3 42 | - str 43 | - The label of the edge 44 | 45 | 46 | Graph Statistics 47 | ---------------- 48 | 49 | .. list-table:: 50 | :header-rows: 1 51 | 52 | * - Num Nodes 53 | - Num Edges 54 | * - 2687 55 | - 2293 56 | 57 | 58 | Edges Statistics 59 | ---------------- 60 | 61 | .. list-table:: 62 | :header-rows: 1 63 | 64 | * - Edge Label 65 | - Num Edge Label 66 | * - d 67 | - 1218 68 | * - a 69 | - 1075 70 | 71 | Canonical grammars 72 | ------------------ 73 | 74 | .. note:: 75 | 76 | In order to get the original graph you must apply function `cfpq_data.change_edges` with `mapping={"a": "A", "d": "D"}` to this graph. In this case these grammars must be updated. 77 | 78 | Grammars for the alias analysis of C programs introduced in `"Demand-driven alias analysis for C" `_. 79 | Template for these grammars is described on the :ref:`c_alias` page. 80 | 81 | .. math:: 82 | 83 | S \, \rightarrow \, \overline{d} \, V \, d \, \\ 84 | V \, \rightarrow \, V_1 \, V_2 \, V_3 \, \\ 85 | V_1 \, \rightarrow \, \varepsilon \, \\ 86 | V_1 \, \rightarrow \, V_2 \, \overline{a} \, V_1 \, \\ 87 | V_2 \, \rightarrow \, \varepsilon \, \\ 88 | V_2 \, \rightarrow \, S \, \\ 89 | V_3 \, \rightarrow \, \varepsilon \, \\ 90 | V_3 \, \rightarrow \, a \, V_2 \, V_3 \, \\ 91 | 92 | `Pyformlang CFG `_: 93 | 94 | .. code-block:: python 95 | 96 | S -> d_r V d 97 | V -> V1 V2 V3 98 | V1 -> epsilon 99 | V1 -> V2 a_r V1 100 | V2 -> epsilon 101 | V2 -> S 102 | V3 -> epsilon 103 | V3 -> a V2 V3 104 | 105 | ---- 106 | 107 | .. math:: 108 | 109 | S \, \rightarrow \, \overline{d} \, V \, d \, \\ 110 | V \, \rightarrow \, ((S \mid \varepsilon) \, \overline{a})^{*} \, (S \mid \varepsilon) \, (a \, (S \mid \varepsilon))^{*} \, \\ 111 | 112 | `Pyformlang RSA `_: 113 | 114 | .. code-block:: python 115 | 116 | S -> d_r V d 117 | V -> ((S|epsilon) a_r)* (S|epsilon) (a (S|epsilon))* 118 | -------------------------------------------------------------------------------- /docs/graphs/data/h2.rst: -------------------------------------------------------------------------------- 1 | .. _h2: 2 | 3 | h2 4 | ===== 5 | 6 | .. contents:: Table of Contents 7 | 8 | Info 9 | ---- 10 | 11 | .. list-table:: 12 | :header-rows: 1 13 | 14 | * - 15 | - 16 | * - Full Name 17 | - h2 18 | * - Version 19 | - 4.0.0 20 | * - Direct download (.csv + .md) 21 | - `.tar.gz `_ 22 | * - Origin 23 | - `link `_ 24 | 25 | 26 | CSV File Structure 27 | ------------------ 28 | 29 | .. list-table:: 30 | :header-rows: 1 31 | 32 | * - Column Number 33 | - Column Type 34 | - Column Description 35 | * - 1 36 | - int 37 | - The tail of the edge 38 | * - 2 39 | - int 40 | - The head of the edge 41 | * - 3 42 | - str 43 | - The label of the edge 44 | 45 | 46 | Graph Statistics 47 | ---------------- 48 | 49 | .. list-table:: 50 | :header-rows: 1 51 | 52 | * - Num Nodes 53 | - Num Edges 54 | * - 44717 55 | - 56683 56 | 57 | 58 | Edges Statistics 59 | ---------------- 60 | 61 | .. note:: 62 | 63 | This graph has edges with labels :math:`\textit{load}_f` and :math:`\textit{store}_f` for all :math:`f \in \textit{Fields} = \{0, \ldots, 837\}`. 64 | 65 | .. list-table:: 66 | :header-rows: 1 67 | 68 | * - Edge Label 69 | - Num Edge Label 70 | * - :math:`\textit{alloc}` 71 | - 7339 72 | * - :math:`\textit{assign}` 73 | - 41392 74 | * - :math:`\textit{load}_f` 75 | - 6709 76 | * - :math:`\textit{store}_f` 77 | - 1243 78 | 79 | 80 | Canonical grammars 81 | ------------------ 82 | 83 | Grammars for the field-sensitive analysis of Java programs introduced in `"Giga-scale exhaustive points-to analysis for Java in under a minute" `_. 84 | Template for these grammars is described on the :ref:`java_points-to` page. 85 | 86 | .. math:: 87 | \textit{PointsTo} \, \rightarrow \, (\textit{assign} \mid \textit{load}_f \, \textit{Alias} \, \textit{store}_f)^{*} \, \textit{alloc} \, \\ 88 | \textit{Alias} \, \rightarrow \, \textit{PointsTo} \, \textit{FlowsTo} \, \\ 89 | \textit{FlowsTo} \, \rightarrow \, \overline{\textit{alloc}} \, (\overline{\textit{assign}} \mid \overline{\textit{store}_f} \, \textit{Alias} \, \overline{\textit{load}_f})^* \, \\ 90 | \forall \, f \, \in \, Fields 91 | -------------------------------------------------------------------------------- /docs/graphs/data/init.rst: -------------------------------------------------------------------------------- 1 | .. _init: 2 | 3 | init 4 | ==== 5 | 6 | .. contents:: Table of Contents 7 | 8 | Info 9 | ---- 10 | 11 | .. list-table:: 12 | :header-rows: 1 13 | 14 | * - 15 | - 16 | * - Full Name 17 | - init_after_inline 18 | * - Version 19 | - 4.0.0 20 | * - Direct download (.csv + .md) 21 | - `.tar.gz `_ 22 | * - Origin 23 | - `.txt `_ 24 | 25 | 26 | CSV File Structure 27 | ------------------ 28 | 29 | .. list-table:: 30 | :header-rows: 1 31 | 32 | * - Column Number 33 | - Column Type 34 | - Column Description 35 | * - 1 36 | - int 37 | - The tail of the edge 38 | * - 2 39 | - int 40 | - The head of the edge 41 | * - 3 42 | - str 43 | - The label of the edge 44 | 45 | 46 | Graph Statistics 47 | ---------------- 48 | 49 | .. list-table:: 50 | :header-rows: 1 51 | 52 | * - Num Nodes 53 | - Num Edges 54 | * - 2446224 55 | - 2112809 56 | 57 | 58 | Edges Statistics 59 | ---------------- 60 | 61 | .. list-table:: 62 | :header-rows: 1 63 | 64 | * - Edge Label 65 | - Num Edge Label 66 | * - d 67 | - 1630815 68 | * - a 69 | - 481994 70 | 71 | Canonical grammars 72 | ------------------ 73 | 74 | .. note:: 75 | 76 | In order to get the original graph you must apply function `cfpq_data.change_edges` with `mapping={"a": "A", "d": "D"}` to this graph. In this case these grammars must be updated. 77 | 78 | Grammars for the alias analysis of C programs introduced in `"Demand-driven alias analysis for C" `_. 79 | Template for these grammars is described on the :ref:`c_alias` page. 80 | 81 | .. math:: 82 | 83 | S \, \rightarrow \, \overline{d} \, V \, d \, \\ 84 | V \, \rightarrow \, V_1 \, V_2 \, V_3 \, \\ 85 | V_1 \, \rightarrow \, \varepsilon \, \\ 86 | V_1 \, \rightarrow \, V_2 \, \overline{a} \, V_1 \, \\ 87 | V_2 \, \rightarrow \, \varepsilon \, \\ 88 | V_2 \, \rightarrow \, S \, \\ 89 | V_3 \, \rightarrow \, \varepsilon \, \\ 90 | V_3 \, \rightarrow \, a \, V_2 \, V_3 \, \\ 91 | 92 | `Pyformlang CFG `_: 93 | 94 | .. code-block:: python 95 | 96 | S -> d_r V d 97 | V -> V1 V2 V3 98 | V1 -> epsilon 99 | V1 -> V2 a_r V1 100 | V2 -> epsilon 101 | V2 -> S 102 | V3 -> epsilon 103 | V3 -> a V2 V3 104 | 105 | ---- 106 | 107 | .. math:: 108 | 109 | S \, \rightarrow \, \overline{d} \, V \, d \, \\ 110 | V \, \rightarrow \, ((S \mid \varepsilon) \, \overline{a})^{*} \, (S \mid \varepsilon) \, (a \, (S \mid \varepsilon))^{*} \, \\ 111 | 112 | `Pyformlang RSA `_: 113 | 114 | .. code-block:: python 115 | 116 | S -> d_r V d 117 | V -> ((S|epsilon) a_r)* (S|epsilon) (a (S|epsilon))* 118 | -------------------------------------------------------------------------------- /docs/graphs/data/ipc.rst: -------------------------------------------------------------------------------- 1 | .. _ipc: 2 | 3 | ipc 4 | === 5 | 6 | .. contents:: Table of Contents 7 | 8 | Info 9 | ---- 10 | 11 | .. list-table:: 12 | :header-rows: 1 13 | 14 | * - 15 | - 16 | * - Full Name 17 | - ipc_after_inline 18 | * - Version 19 | - 4.0.0 20 | * - Direct download (.csv + .md) 21 | - `.tar.gz `_ 22 | * - Origin 23 | - `.txt `_ 24 | 25 | 26 | CSV File Structure 27 | ------------------ 28 | 29 | .. list-table:: 30 | :header-rows: 1 31 | 32 | * - Column Number 33 | - Column Type 34 | - Column Description 35 | * - 1 36 | - int 37 | - The tail of the edge 38 | * - 2 39 | - int 40 | - The head of the edge 41 | * - 3 42 | - str 43 | - The label of the edge 44 | 45 | 46 | Graph Statistics 47 | ---------------- 48 | 49 | .. list-table:: 50 | :header-rows: 1 51 | 52 | * - Num Nodes 53 | - Num Edges 54 | * - 3401022 55 | - 2931498 56 | 57 | 58 | Edges Statistics 59 | ---------------- 60 | 61 | .. list-table:: 62 | :header-rows: 1 63 | 64 | * - Edge Label 65 | - Num Edge Label 66 | * - d 67 | - 2267347 68 | * - a 69 | - 664151 70 | 71 | Canonical grammars 72 | ------------------ 73 | 74 | .. note:: 75 | 76 | In order to get the original graph you must apply function `cfpq_data.change_edges` with `mapping={"a": "A", "d": "D"}` to this graph. In this case these grammars must be updated. 77 | 78 | Grammars for the alias analysis of C programs introduced in `"Demand-driven alias analysis for C" `_. 79 | Template for these grammars is described on the :ref:`c_alias` page. 80 | 81 | .. math:: 82 | 83 | S \, \rightarrow \, \overline{d} \, V \, d \, \\ 84 | V \, \rightarrow \, V_1 \, V_2 \, V_3 \, \\ 85 | V_1 \, \rightarrow \, \varepsilon \, \\ 86 | V_1 \, \rightarrow \, V_2 \, \overline{a} \, V_1 \, \\ 87 | V_2 \, \rightarrow \, \varepsilon \, \\ 88 | V_2 \, \rightarrow \, S \, \\ 89 | V_3 \, \rightarrow \, \varepsilon \, \\ 90 | V_3 \, \rightarrow \, a \, V_2 \, V_3 \, \\ 91 | 92 | `Pyformlang CFG `_: 93 | 94 | .. code-block:: python 95 | 96 | S -> d_r V d 97 | V -> V1 V2 V3 98 | V1 -> epsilon 99 | V1 -> V2 a_r V1 100 | V2 -> epsilon 101 | V2 -> S 102 | V3 -> epsilon 103 | V3 -> a V2 V3 104 | 105 | ---- 106 | 107 | .. math:: 108 | 109 | S \, \rightarrow \, \overline{d} \, V \, d \, \\ 110 | V \, \rightarrow \, ((S \mid \varepsilon) \, \overline{a})^{*} \, (S \mid \varepsilon) \, (a \, (S \mid \varepsilon))^{*} \, \\ 111 | 112 | `Pyformlang RSA `_: 113 | 114 | .. code-block:: python 115 | 116 | S -> d_r V d 117 | V -> ((S|epsilon) a_r)* (S|epsilon) (a (S|epsilon))* 118 | -------------------------------------------------------------------------------- /docs/graphs/data/jython.rst: -------------------------------------------------------------------------------- 1 | .. _jython: 2 | 3 | jython 4 | ===== 5 | 6 | .. contents:: Table of Contents 7 | 8 | Info 9 | ---- 10 | 11 | .. list-table:: 12 | :header-rows: 1 13 | 14 | * - 15 | - 16 | * - Full Name 17 | - jython 18 | * - Version 19 | - 4.0.0 20 | * - Direct download (.csv + .md) 21 | - `.tar.gz `_ 22 | * - Origin 23 | - `link `_ 24 | 25 | 26 | CSV File Structure 27 | ------------------ 28 | 29 | .. list-table:: 30 | :header-rows: 1 31 | 32 | * - Column Number 33 | - Column Type 34 | - Column Description 35 | * - 1 36 | - int 37 | - The tail of the edge 38 | * - 2 39 | - int 40 | - The head of the edge 41 | * - 3 42 | - str 43 | - The label of the edge 44 | 45 | 46 | Graph Statistics 47 | ---------------- 48 | 49 | .. list-table:: 50 | :header-rows: 1 51 | 52 | * - Num Nodes 53 | - Num Edges 54 | * - 191895 55 | - 260034 56 | 57 | 58 | Edges Statistics 59 | ---------------- 60 | 61 | .. note:: 62 | 63 | This graph has edges with labels :math:`\textit{load}_f` and :math:`\textit{store}_f` for all :math:`f \in \textit{Fields} = \{0, \ldots, 1222\}`. 64 | 65 | .. list-table:: 66 | :header-rows: 1 67 | 68 | * - Edge Label 69 | - Num Edge Label 70 | * - :math:`\textit{alloc}` 71 | - 30830 72 | * - :math:`\textit{assign}` 73 | - 210346 74 | * - :math:`\textit{load}_f` 75 | - 14685 76 | * - :math:`\textit{store}_f` 77 | - 4173 78 | 79 | 80 | Canonical grammars 81 | ------------------ 82 | 83 | Grammars for the field-sensitive analysis of Java programs introduced in `"Giga-scale exhaustive points-to analysis for Java in under a minute" `_. 84 | Template for these grammars is described on the :ref:`java_points-to` page. 85 | 86 | .. math:: 87 | \textit{PointsTo} \, \rightarrow \, (\textit{assign} \mid \textit{load}_f \, \textit{Alias} \, \textit{store}_f)^{*} \, \textit{alloc} \, \\ 88 | \textit{Alias} \, \rightarrow \, \textit{PointsTo} \, \textit{FlowsTo} \, \\ 89 | \textit{FlowsTo} \, \rightarrow \, \overline{\textit{alloc}} \, (\overline{\textit{assign}} \mid \overline{\textit{store}_f} \, \textit{Alias} \, \overline{\textit{load}_f})^* \, \\ 90 | \forall \, f \, \in \, Fields 91 | -------------------------------------------------------------------------------- /docs/graphs/data/kernel.rst: -------------------------------------------------------------------------------- 1 | .. _kernel: 2 | 3 | kernel 4 | ====== 5 | 6 | .. contents:: Table of Contents 7 | 8 | Info 9 | ---- 10 | 11 | .. list-table:: 12 | :header-rows: 1 13 | 14 | * - 15 | - 16 | * - Full Name 17 | - kernel_after_inline 18 | * - Version 19 | - 4.0.0 20 | * - Direct download (.csv + .md) 21 | - `.tar.gz `_ 22 | * - Origin 23 | - `.txt `_ 24 | 25 | 26 | CSV File Structure 27 | ------------------ 28 | 29 | .. list-table:: 30 | :header-rows: 1 31 | 32 | * - Column Number 33 | - Column Type 34 | - Column Description 35 | * - 1 36 | - int 37 | - The tail of the edge 38 | * - 2 39 | - int 40 | - The head of the edge 41 | * - 3 42 | - str 43 | - The label of the edge 44 | 45 | 46 | Graph Statistics 47 | ---------------- 48 | 49 | .. list-table:: 50 | :header-rows: 1 51 | 52 | * - Num Nodes 53 | - Num Edges 54 | * - 11254434 55 | - 9484213 56 | 57 | 58 | Edges Statistics 59 | ---------------- 60 | 61 | .. list-table:: 62 | :header-rows: 1 63 | 64 | * - Edge Label 65 | - Num Edge Label 66 | * - d 67 | - 7502955 68 | * - a 69 | - 1981258 70 | 71 | Canonical grammars 72 | ------------------ 73 | 74 | .. note:: 75 | 76 | In order to get the original graph you must apply function `cfpq_data.change_edges` with `mapping={"a": "A", "d": "D"}` to this graph. In this case these grammars must be updated. 77 | 78 | Grammars for the alias analysis of C programs introduced in `"Demand-driven alias analysis for C" `_. 79 | Template for these grammars is described on the :ref:`c_alias` page. 80 | 81 | .. math:: 82 | 83 | S \, \rightarrow \, \overline{d} \, V \, d \, \\ 84 | V \, \rightarrow \, V_1 \, V_2 \, V_3 \, \\ 85 | V_1 \, \rightarrow \, \varepsilon \, \\ 86 | V_1 \, \rightarrow \, V_2 \, \overline{a} \, V_1 \, \\ 87 | V_2 \, \rightarrow \, \varepsilon \, \\ 88 | V_2 \, \rightarrow \, S \, \\ 89 | V_3 \, \rightarrow \, \varepsilon \, \\ 90 | V_3 \, \rightarrow \, a \, V_2 \, V_3 \, \\ 91 | 92 | `Pyformlang CFG `_: 93 | 94 | .. code-block:: python 95 | 96 | S -> d_r V d 97 | V -> V1 V2 V3 98 | V1 -> epsilon 99 | V1 -> V2 a_r V1 100 | V2 -> epsilon 101 | V2 -> S 102 | V3 -> epsilon 103 | V3 -> a V2 V3 104 | 105 | ---- 106 | 107 | .. math:: 108 | 109 | S \, \rightarrow \, \overline{d} \, V \, d \, \\ 110 | V \, \rightarrow \, ((S \mid \varepsilon) \, \overline{a})^{*} \, (S \mid \varepsilon) \, (a \, (S \mid \varepsilon))^{*} \, \\ 111 | 112 | `Pyformlang RSA `_: 113 | 114 | .. code-block:: python 115 | 116 | S -> d_r V d 117 | V -> ((S|epsilon) a_r)* (S|epsilon) (a (S|epsilon))* 118 | -------------------------------------------------------------------------------- /docs/graphs/data/lib.rst: -------------------------------------------------------------------------------- 1 | .. _lib: 2 | 3 | lib 4 | === 5 | 6 | .. contents:: Table of Contents 7 | 8 | Info 9 | ---- 10 | 11 | .. list-table:: 12 | :header-rows: 1 13 | 14 | * - 15 | - 16 | * - Full Name 17 | - lib_after_inline 18 | * - Version 19 | - 4.0.0 20 | * - Direct download (.csv + .md) 21 | - `.tar.gz `_ 22 | * - Origin 23 | - `.txt `_ 24 | 25 | 26 | CSV File Structure 27 | ------------------ 28 | 29 | .. list-table:: 30 | :header-rows: 1 31 | 32 | * - Column Number 33 | - Column Type 34 | - Column Description 35 | * - 1 36 | - int 37 | - The tail of the edge 38 | * - 2 39 | - int 40 | - The head of the edge 41 | * - 3 42 | - str 43 | - The label of the edge 44 | 45 | 46 | Graph Statistics 47 | ---------------- 48 | 49 | .. list-table:: 50 | :header-rows: 1 51 | 52 | * - Num Nodes 53 | - Num Edges 54 | * - 3401355 55 | - 2931880 56 | 57 | 58 | Edges Statistics 59 | ---------------- 60 | 61 | .. list-table:: 62 | :header-rows: 1 63 | 64 | * - Edge Label 65 | - Num Edge Label 66 | * - d 67 | - 2267569 68 | * - a 69 | - 664311 70 | 71 | Canonical grammars 72 | ------------------ 73 | 74 | .. note:: 75 | 76 | In order to get the original graph you must apply function `cfpq_data.change_edges` with `mapping={"a": "A", "d": "D"}` to this graph. In this case these grammars must be updated. 77 | 78 | Grammars for the alias analysis of C programs introduced in `"Demand-driven alias analysis for C" `_. 79 | Template for these grammars is described on the :ref:`c_alias` page. 80 | 81 | .. math:: 82 | 83 | S \, \rightarrow \, \overline{d} \, V \, d \, \\ 84 | V \, \rightarrow \, V_1 \, V_2 \, V_3 \, \\ 85 | V_1 \, \rightarrow \, \varepsilon \, \\ 86 | V_1 \, \rightarrow \, V_2 \, \overline{a} \, V_1 \, \\ 87 | V_2 \, \rightarrow \, \varepsilon \, \\ 88 | V_2 \, \rightarrow \, S \, \\ 89 | V_3 \, \rightarrow \, \varepsilon \, \\ 90 | V_3 \, \rightarrow \, a \, V_2 \, V_3 \, \\ 91 | 92 | `Pyformlang CFG `_: 93 | 94 | .. code-block:: python 95 | 96 | S -> d_r V d 97 | V -> V1 V2 V3 98 | V1 -> epsilon 99 | V1 -> V2 a_r V1 100 | V2 -> epsilon 101 | V2 -> S 102 | V3 -> epsilon 103 | V3 -> a V2 V3 104 | 105 | ---- 106 | 107 | .. math:: 108 | 109 | S \, \rightarrow \, \overline{d} \, V \, d \, \\ 110 | V \, \rightarrow \, ((S \mid \varepsilon) \, \overline{a})^{*} \, (S \mid \varepsilon) \, (a \, (S \mid \varepsilon))^{*} \, \\ 111 | 112 | `Pyformlang RSA `_: 113 | 114 | .. code-block:: python 115 | 116 | S -> d_r V d 117 | V -> ((S|epsilon) a_r)* (S|epsilon) (a (S|epsilon))* 118 | -------------------------------------------------------------------------------- /docs/graphs/data/ls.rst: -------------------------------------------------------------------------------- 1 | .. _ls: 2 | 3 | ls 4 | == 5 | 6 | .. contents:: Table of Contents 7 | 8 | Info 9 | ---- 10 | 11 | .. list-table:: 12 | :header-rows: 1 13 | 14 | * - 15 | - 16 | * - Full Name 17 | - ls 18 | * - Version 19 | - 4.0.0 20 | * - Direct download (.csv + .md) 21 | - `.tar.gz `_ 22 | * - Origin 23 | - `.xml.tar.gz `_ 24 | 25 | 26 | CSV File Structure 27 | ------------------ 28 | 29 | .. list-table:: 30 | :header-rows: 1 31 | 32 | * - Column Number 33 | - Column Type 34 | - Column Description 35 | * - 1 36 | - int 37 | - The tail of the edge 38 | * - 2 39 | - int 40 | - The head of the edge 41 | * - 3 42 | - str 43 | - The label of the edge 44 | 45 | 46 | Graph Statistics 47 | ---------------- 48 | 49 | .. list-table:: 50 | :header-rows: 1 51 | 52 | * - Num Nodes 53 | - Num Edges 54 | * - 1687 55 | - 1453 56 | 57 | 58 | Edges Statistics 59 | ---------------- 60 | 61 | .. list-table:: 62 | :header-rows: 1 63 | 64 | * - Edge Label 65 | - Num Edge Label 66 | * - d 67 | - 750 68 | * - a 69 | - 703 70 | 71 | Canonical grammars 72 | ------------------ 73 | 74 | .. note:: 75 | 76 | In order to get the original graph you must apply function `cfpq_data.change_edges` with `mapping={"a": "A", "d": "D"}` to this graph. In this case these grammars must be updated. 77 | 78 | Grammars for the alias analysis of C programs introduced in `"Demand-driven alias analysis for C" `_. 79 | Template for these grammars is described on the :ref:`c_alias` page. 80 | 81 | .. math:: 82 | 83 | S \, \rightarrow \, \overline{d} \, V \, d \, \\ 84 | V \, \rightarrow \, V_1 \, V_2 \, V_3 \, \\ 85 | V_1 \, \rightarrow \, \varepsilon \, \\ 86 | V_1 \, \rightarrow \, V_2 \, \overline{a} \, V_1 \, \\ 87 | V_2 \, \rightarrow \, \varepsilon \, \\ 88 | V_2 \, \rightarrow \, S \, \\ 89 | V_3 \, \rightarrow \, \varepsilon \, \\ 90 | V_3 \, \rightarrow \, a \, V_2 \, V_3 \, \\ 91 | 92 | `Pyformlang CFG `_: 93 | 94 | .. code-block:: python 95 | 96 | S -> d_r V d 97 | V -> V1 V2 V3 98 | V1 -> epsilon 99 | V1 -> V2 a_r V1 100 | V2 -> epsilon 101 | V2 -> S 102 | V3 -> epsilon 103 | V3 -> a V2 V3 104 | 105 | ---- 106 | 107 | .. math:: 108 | 109 | S \, \rightarrow \, \overline{d} \, V \, d \, \\ 110 | V \, \rightarrow \, ((S \mid \varepsilon) \, \overline{a})^{*} \, (S \mid \varepsilon) \, (a \, (S \mid \varepsilon))^{*} \, \\ 111 | 112 | `Pyformlang RSA `_: 113 | 114 | .. code-block:: python 115 | 116 | S -> d_r V d 117 | V -> ((S|epsilon) a_r)* (S|epsilon) (a (S|epsilon))* 118 | -------------------------------------------------------------------------------- /docs/graphs/data/luindex.rst: -------------------------------------------------------------------------------- 1 | .. _luindex: 2 | 3 | luindex 4 | ===== 5 | 6 | .. contents:: Table of Contents 7 | 8 | Info 9 | ---- 10 | 11 | .. list-table:: 12 | :header-rows: 1 13 | 14 | * - 15 | - 16 | * - Full Name 17 | - luindex 18 | * - Version 19 | - 4.0.0 20 | * - Direct download (.csv + .md) 21 | - `.tar.gz `_ 22 | * - Origin 23 | - `link `_ 24 | 25 | 26 | CSV File Structure 27 | ------------------ 28 | 29 | .. list-table:: 30 | :header-rows: 1 31 | 32 | * - Column Number 33 | - Column Type 34 | - Column Description 35 | * - 1 36 | - int 37 | - The tail of the edge 38 | * - 2 39 | - int 40 | - The head of the edge 41 | * - 3 42 | - str 43 | - The label of the edge 44 | 45 | 46 | Graph Statistics 47 | ---------------- 48 | 49 | .. list-table:: 50 | :header-rows: 1 51 | 52 | * - Num Nodes 53 | - Num Edges 54 | * - 18532 55 | - 17375 56 | 57 | 58 | Edges Statistics 59 | ---------------- 60 | 61 | .. note:: 62 | 63 | This graph has edges with labels :math:`\textit{load}_f` and :math:`\textit{store}_f` for all :math:`f \in \textit{Fields} = \{0, \ldots, 446\}`. 64 | 65 | .. list-table:: 66 | :header-rows: 1 67 | 68 | * - Edge Label 69 | - Num Edge Label 70 | * - :math:`\textit{alloc}` 71 | - 3273 72 | * - :math:`\textit{assign}` 73 | - 9903 74 | * - :math:`\textit{load}_f` 75 | - 3340 76 | * - :math:`\textit{store}_f` 77 | - 859 78 | 79 | 80 | Canonical grammars 81 | ------------------ 82 | 83 | Grammars for the field-sensitive analysis of Java programs introduced in `"Giga-scale exhaustive points-to analysis for Java in under a minute" `_. 84 | Template for these grammars is described on the :ref:`java_points-to` page. 85 | 86 | .. math:: 87 | \textit{PointsTo} \, \rightarrow \, (\textit{assign} \mid \textit{load}_f \, \textit{Alias} \, \textit{store}_f)^{*} \, \textit{alloc} \, \\ 88 | \textit{Alias} \, \rightarrow \, \textit{PointsTo} \, \textit{FlowsTo} \, \\ 89 | \textit{FlowsTo} \, \rightarrow \, \overline{\textit{alloc}} \, (\overline{\textit{assign}} \mid \overline{\textit{store}_f} \, \textit{Alias} \, \overline{\textit{load}_f})^* \, \\ 90 | \forall \, f \, \in \, Fields 91 | -------------------------------------------------------------------------------- /docs/graphs/data/lusearch.rst: -------------------------------------------------------------------------------- 1 | .. _lusearch: 2 | 3 | lusearch 4 | ===== 5 | 6 | .. contents:: Table of Contents 7 | 8 | Info 9 | ---- 10 | 11 | .. list-table:: 12 | :header-rows: 1 13 | 14 | * - 15 | - 16 | * - Full Name 17 | - lusearch 18 | * - Version 19 | - 4.0.0 20 | * - Direct download (.csv + .md) 21 | - `.tar.gz `_ 22 | * - Origin 23 | - `link `_ 24 | 25 | 26 | CSV File Structure 27 | ------------------ 28 | 29 | .. list-table:: 30 | :header-rows: 1 31 | 32 | * - Column Number 33 | - Column Type 34 | - Column Description 35 | * - 1 36 | - int 37 | - The tail of the edge 38 | * - 2 39 | - int 40 | - The head of the edge 41 | * - 3 42 | - str 43 | - The label of the edge 44 | 45 | 46 | Graph Statistics 47 | ---------------- 48 | 49 | .. list-table:: 50 | :header-rows: 1 51 | 52 | * - Num Nodes 53 | - Num Edges 54 | * - 15774 55 | - 14994 56 | 57 | 58 | Edges Statistics 59 | ---------------- 60 | 61 | .. note:: 62 | 63 | This graph has edges with labels :math:`\textit{load}_f` and :math:`\textit{store}_f` for all :math:`f \in \textit{Fields} = \{0, \ldots, 347\}`. 64 | 65 | .. list-table:: 66 | :header-rows: 1 67 | 68 | * - Edge Label 69 | - Num Edge Label 70 | * - :math:`\textit{alloc}` 71 | - 2633 72 | * - :math:`\textit{assign}` 73 | - 9266 74 | * - :math:`\textit{load}_f` 75 | - 2515 76 | * - :math:`\textit{store}_f` 77 | - 580 78 | 79 | 80 | Canonical grammars 81 | ------------------ 82 | 83 | Grammars for the field-sensitive analysis of Java programs introduced in `"Giga-scale exhaustive points-to analysis for Java in under a minute" `_. 84 | Template for these grammars is described on the :ref:`java_points-to` page. 85 | 86 | .. math:: 87 | \textit{PointsTo} \, \rightarrow \, (\textit{assign} \mid \textit{load}_f \, \textit{Alias} \, \textit{store}_f)^{*} \, \textit{alloc} \, \\ 88 | \textit{Alias} \, \rightarrow \, \textit{PointsTo} \, \textit{FlowsTo} \, \\ 89 | \textit{FlowsTo} \, \rightarrow \, \overline{\textit{alloc}} \, (\overline{\textit{assign}} \mid \overline{\textit{store}_f} \, \textit{Alias} \, \overline{\textit{load}_f})^* \, \\ 90 | \forall \, f \, \in \, Fields 91 | -------------------------------------------------------------------------------- /docs/graphs/data/mm.rst: -------------------------------------------------------------------------------- 1 | .. _mm: 2 | 3 | mm 4 | == 5 | 6 | .. contents:: Table of Contents 7 | 8 | Info 9 | ---- 10 | 11 | .. list-table:: 12 | :header-rows: 1 13 | 14 | * - 15 | - 16 | * - Full Name 17 | - mm_after_inline 18 | * - Version 19 | - 4.0.0 20 | * - Direct download (.csv + .md) 21 | - `.tar.gz `_ 22 | * - Origin 23 | - `.txt `_ 24 | 25 | 26 | CSV File Structure 27 | ------------------ 28 | 29 | .. list-table:: 30 | :header-rows: 1 31 | 32 | * - Column Number 33 | - Column Type 34 | - Column Description 35 | * - 1 36 | - int 37 | - The tail of the edge 38 | * - 2 39 | - int 40 | - The head of the edge 41 | * - 3 42 | - str 43 | - The label of the edge 44 | 45 | 46 | Graph Statistics 47 | ---------------- 48 | 49 | .. list-table:: 50 | :header-rows: 1 51 | 52 | * - Num Nodes 53 | - Num Edges 54 | * - 2538243 55 | - 2191079 56 | 57 | 58 | Edges Statistics 59 | ---------------- 60 | 61 | .. list-table:: 62 | :header-rows: 1 63 | 64 | * - Edge Label 65 | - Num Edge Label 66 | * - d 67 | - 1692161 68 | * - a 69 | - 498918 70 | 71 | Canonical grammars 72 | ------------------ 73 | 74 | .. note:: 75 | 76 | In order to get the original graph you must apply function `cfpq_data.change_edges` with `mapping={"a": "A", "d": "D"}` to this graph. In this case these grammars must be updated. 77 | 78 | Grammars for the alias analysis of C programs introduced in `"Demand-driven alias analysis for C" `_. 79 | Template for these grammars is described on the :ref:`c_alias` page. 80 | 81 | .. math:: 82 | 83 | S \, \rightarrow \, \overline{d} \, V \, d \, \\ 84 | V \, \rightarrow \, V_1 \, V_2 \, V_3 \, \\ 85 | V_1 \, \rightarrow \, \varepsilon \, \\ 86 | V_1 \, \rightarrow \, V_2 \, \overline{a} \, V_1 \, \\ 87 | V_2 \, \rightarrow \, \varepsilon \, \\ 88 | V_2 \, \rightarrow \, S \, \\ 89 | V_3 \, \rightarrow \, \varepsilon \, \\ 90 | V_3 \, \rightarrow \, a \, V_2 \, V_3 \, \\ 91 | 92 | `Pyformlang CFG `_: 93 | 94 | .. code-block:: python 95 | 96 | S -> d_r V d 97 | V -> V1 V2 V3 98 | V1 -> epsilon 99 | V1 -> V2 a_r V1 100 | V2 -> epsilon 101 | V2 -> S 102 | V3 -> epsilon 103 | V3 -> a V2 V3 104 | 105 | ---- 106 | 107 | .. math:: 108 | 109 | S \, \rightarrow \, \overline{d} \, V \, d \, \\ 110 | V \, \rightarrow \, ((S \mid \varepsilon) \, \overline{a})^{*} \, (S \mid \varepsilon) \, (a \, (S \mid \varepsilon))^{*} \, \\ 111 | 112 | `Pyformlang RSA `_: 113 | 114 | .. code-block:: python 115 | 116 | S -> d_r V d 117 | V -> ((S|epsilon) a_r)* (S|epsilon) (a (S|epsilon))* 118 | -------------------------------------------------------------------------------- /docs/graphs/data/net.rst: -------------------------------------------------------------------------------- 1 | .. _net: 2 | 3 | net 4 | === 5 | 6 | .. contents:: Table of Contents 7 | 8 | Info 9 | ---- 10 | 11 | .. list-table:: 12 | :header-rows: 1 13 | 14 | * - 15 | - 16 | * - Full Name 17 | - net_after_inline 18 | * - Version 19 | - 4.0.0 20 | * - Direct download (.csv + .md) 21 | - `.tar.gz `_ 22 | * - Origin 23 | - `.txt `_ 24 | 25 | 26 | CSV File Structure 27 | ------------------ 28 | 29 | .. list-table:: 30 | :header-rows: 1 31 | 32 | * - Column Number 33 | - Column Type 34 | - Column Description 35 | * - 1 36 | - int 37 | - The tail of the edge 38 | * - 2 39 | - int 40 | - The head of the edge 41 | * - 3 42 | - str 43 | - The label of the edge 44 | 45 | 46 | Graph Statistics 47 | ---------------- 48 | 49 | .. list-table:: 50 | :header-rows: 1 51 | 52 | * - Num Nodes 53 | - Num Edges 54 | * - 4039470 55 | - 3500141 56 | 57 | 58 | Edges Statistics 59 | ---------------- 60 | 61 | .. list-table:: 62 | :header-rows: 1 63 | 64 | * - Edge Label 65 | - Num Edge Label 66 | * - d 67 | - 2692979 68 | * - a 69 | - 807162 70 | 71 | Canonical grammars 72 | ------------------ 73 | 74 | .. note:: 75 | 76 | In order to get the original graph you must apply function `cfpq_data.change_edges` with `mapping={"a": "A", "d": "D"}` to this graph. In this case these grammars must be updated. 77 | 78 | Grammars for the alias analysis of C programs introduced in `"Demand-driven alias analysis for C" `_. 79 | Template for these grammars is described on the :ref:`c_alias` page. 80 | 81 | .. math:: 82 | 83 | S \, \rightarrow \, \overline{d} \, V \, d \, \\ 84 | V \, \rightarrow \, V_1 \, V_2 \, V_3 \, \\ 85 | V_1 \, \rightarrow \, \varepsilon \, \\ 86 | V_1 \, \rightarrow \, V_2 \, \overline{a} \, V_1 \, \\ 87 | V_2 \, \rightarrow \, \varepsilon \, \\ 88 | V_2 \, \rightarrow \, S \, \\ 89 | V_3 \, \rightarrow \, \varepsilon \, \\ 90 | V_3 \, \rightarrow \, a \, V_2 \, V_3 \, \\ 91 | 92 | `Pyformlang CFG `_: 93 | 94 | .. code-block:: python 95 | 96 | S -> d_r V d 97 | V -> V1 V2 V3 98 | V1 -> epsilon 99 | V1 -> V2 a_r V1 100 | V2 -> epsilon 101 | V2 -> S 102 | V3 -> epsilon 103 | V3 -> a V2 V3 104 | 105 | ---- 106 | 107 | .. math:: 108 | 109 | S \, \rightarrow \, \overline{d} \, V \, d \, \\ 110 | V \, \rightarrow \, ((S \mid \varepsilon) \, \overline{a})^{*} \, (S \mid \varepsilon) \, (a \, (S \mid \varepsilon))^{*} \, \\ 111 | 112 | `Pyformlang RSA `_: 113 | 114 | .. code-block:: python 115 | 116 | S -> d_r V d 117 | V -> ((S|epsilon) a_r)* (S|epsilon) (a (S|epsilon))* 118 | -------------------------------------------------------------------------------- /docs/graphs/data/pathways.rst: -------------------------------------------------------------------------------- 1 | .. _pathways: 2 | 3 | pathways 4 | ======== 5 | 6 | .. contents:: Table of Contents 7 | 8 | Info 9 | ---- 10 | 11 | .. list-table:: 12 | :header-rows: 1 13 | 14 | * - 15 | - 16 | * - Full Name 17 | - pathways 18 | * - Version 19 | - 4.0.0 20 | * - Direct download (.csv + .md) 21 | - `.tar.gz `_ 22 | * - Origin 23 | - `.rdf.xz `_ 24 | 25 | 26 | CSV File Structure 27 | ------------------ 28 | 29 | .. list-table:: 30 | :header-rows: 1 31 | 32 | * - Column Number 33 | - Column Type 34 | - Column Description 35 | * - 1 36 | - int 37 | - The tail of the edge 38 | * - 2 39 | - int 40 | - The head of the edge 41 | * - 3 42 | - str 43 | - The label of the edge 44 | 45 | 46 | Graph Statistics 47 | ---------------- 48 | 49 | .. list-table:: 50 | :header-rows: 1 51 | 52 | * - Num Nodes 53 | - Num Edges 54 | * - 6238 55 | - 12363 56 | 57 | 58 | Edges Statistics 59 | ---------------- 60 | 61 | .. list-table:: 62 | :header-rows: 1 63 | 64 | * - Edge Label 65 | - Num Edge Label 66 | * - type 67 | - 3118 68 | * - subClassOf 69 | - 3117 70 | * - label 71 | - 3117 72 | * - narrower 73 | - 3010 74 | * - imports 75 | - 1 76 | 77 | Canonical grammars 78 | ------------------ 79 | 80 | Nested parentheses grammars introduced in `"Context-Free Path Queries on RDF Graphs" `_. 81 | Template for these grammars is described on the :ref:`nested_parentheses` page. 82 | 83 | .. math:: 84 | 85 | S \, \rightarrow \, \overline{subClassOf} \, S \, subClassOf \, \mid \, \overline{subClassOf} \, subClassOf \, \\ 86 | S \, \rightarrow \, \overline{type} \, S \, type \, \mid \, \overline{type} \, type \, \\ 87 | 88 | `Pyformlang CFG `_: 89 | 90 | .. code-block:: python 91 | 92 | S -> subClassOf_r S subClassOf | subClassOf_r subClassOf 93 | S -> type_r S type | type_r type 94 | 95 | ---- 96 | 97 | .. math:: 98 | 99 | S \, \rightarrow \, \overline{subClassOf} \, S \, subClassOf \, \mid \, \overline{subClassOf} \, subClassOf \, \\ 100 | 101 | `Pyformlang CFG `_: 102 | 103 | .. code-block:: python 104 | 105 | S -> subClassOf_r S subClassOf | subClassOf_r subClassOf 106 | 107 | ---- 108 | 109 | .. math:: 110 | 111 | S \, \rightarrow \, \overline{type} \, S \, type \, \mid \, \overline{type} \, type \, \\ 112 | 113 | `Pyformlang CFG `_: 114 | 115 | .. code-block:: python 116 | 117 | S -> type_r S type | type_r type 118 | -------------------------------------------------------------------------------- /docs/graphs/data/pmd.rst: -------------------------------------------------------------------------------- 1 | .. _pmd: 2 | 3 | pmd 4 | ===== 5 | 6 | .. contents:: Table of Contents 7 | 8 | Info 9 | ---- 10 | 11 | .. list-table:: 12 | :header-rows: 1 13 | 14 | * - 15 | - 16 | * - Full Name 17 | - pmd 18 | * - Version 19 | - 4.0.0 20 | * - Direct download (.csv + .md) 21 | - `.tar.gz `_ 22 | * - Origin 23 | - `link `_ 24 | 25 | 26 | CSV File Structure 27 | ------------------ 28 | 29 | .. list-table:: 30 | :header-rows: 1 31 | 32 | * - Column Number 33 | - Column Type 34 | - Column Description 35 | * - 1 36 | - int 37 | - The tail of the edge 38 | * - 2 39 | - int 40 | - The head of the edge 41 | * - 3 42 | - str 43 | - The label of the edge 44 | 45 | 46 | Graph Statistics 47 | ---------------- 48 | 49 | .. list-table:: 50 | :header-rows: 1 51 | 52 | * - Num Nodes 53 | - Num Edges 54 | * - 54444 55 | - 59329 56 | 57 | 58 | Edges Statistics 59 | ---------------- 60 | 61 | .. note:: 62 | 63 | This graph has edges with labels :math:`\textit{load}_f` and :math:`\textit{store}_f` for all :math:`f \in \textit{Fields} = \{0, \ldots, 1033\}`. 64 | 65 | .. list-table:: 66 | :header-rows: 1 67 | 68 | * - Edge Label 69 | - Num Edge Label 70 | * - :math:`\textit{alloc}` 71 | - 7552 72 | * - :math:`\textit{assign}` 73 | - 38676 74 | * - :math:`\textit{load}_f` 75 | - 11109 76 | * - :math:`\textit{store}_f` 77 | - 1992 78 | 79 | 80 | Canonical grammars 81 | ------------------ 82 | 83 | Grammars for the field-sensitive analysis of Java programs introduced in `"Giga-scale exhaustive points-to analysis for Java in under a minute" `_. 84 | Template for these grammars is described on the :ref:`java_points-to` page. 85 | 86 | .. math:: 87 | \textit{PointsTo} \, \rightarrow \, (\textit{assign} \mid \textit{load}_f \, \textit{Alias} \, \textit{store}_f)^{*} \, \textit{alloc} \, \\ 88 | \textit{Alias} \, \rightarrow \, \textit{PointsTo} \, \textit{FlowsTo} \, \\ 89 | \textit{FlowsTo} \, \rightarrow \, \overline{\textit{alloc}} \, (\overline{\textit{assign}} \mid \overline{\textit{store}_f} \, \textit{Alias} \, \overline{\textit{load}_f})^* \, \\ 90 | \forall \, f \, \in \, Fields 91 | -------------------------------------------------------------------------------- /docs/graphs/data/pr.rst: -------------------------------------------------------------------------------- 1 | .. _pr: 2 | 3 | pr 4 | == 5 | 6 | .. contents:: Table of Contents 7 | 8 | Info 9 | ---- 10 | 11 | .. list-table:: 12 | :header-rows: 1 13 | 14 | * - 15 | - 16 | * - Full Name 17 | - pr 18 | * - Version 19 | - 4.0.0 20 | * - Direct download (.csv + .md) 21 | - `.tar.gz `_ 22 | * - Origin 23 | - `.xml.tar.gz `_ 24 | 25 | 26 | CSV File Structure 27 | ------------------ 28 | 29 | .. list-table:: 30 | :header-rows: 1 31 | 32 | * - Column Number 33 | - Column Type 34 | - Column Description 35 | * - 1 36 | - int 37 | - The tail of the edge 38 | * - 2 39 | - int 40 | - The head of the edge 41 | * - 3 42 | - str 43 | - The label of the edge 44 | 45 | 46 | Graph Statistics 47 | ---------------- 48 | 49 | .. list-table:: 50 | :header-rows: 1 51 | 52 | * - Num Nodes 53 | - Num Edges 54 | * - 815 55 | - 692 56 | 57 | 58 | Edges Statistics 59 | ---------------- 60 | 61 | .. list-table:: 62 | :header-rows: 1 63 | 64 | * - Edge Label 65 | - Num Edge Label 66 | * - d 67 | - 359 68 | * - a 69 | - 333 70 | 71 | Canonical grammars 72 | ------------------ 73 | 74 | .. note:: 75 | 76 | In order to get the original graph you must apply function `cfpq_data.change_edges` with `mapping={"a": "A", "d": "D"}` to this graph. In this case these grammars must be updated. 77 | 78 | Grammars for the alias analysis of C programs introduced in `"Demand-driven alias analysis for C" `_. 79 | Template for these grammars is described on the :ref:`c_alias` page. 80 | 81 | .. math:: 82 | 83 | S \, \rightarrow \, \overline{d} \, V \, d \, \\ 84 | V \, \rightarrow \, V_1 \, V_2 \, V_3 \, \\ 85 | V_1 \, \rightarrow \, \varepsilon \, \\ 86 | V_1 \, \rightarrow \, V_2 \, \overline{a} \, V_1 \, \\ 87 | V_2 \, \rightarrow \, \varepsilon \, \\ 88 | V_2 \, \rightarrow \, S \, \\ 89 | V_3 \, \rightarrow \, \varepsilon \, \\ 90 | V_3 \, \rightarrow \, a \, V_2 \, V_3 \, \\ 91 | 92 | `Pyformlang CFG `_: 93 | 94 | .. code-block:: python 95 | 96 | S -> d_r V d 97 | V -> V1 V2 V3 98 | V1 -> epsilon 99 | V1 -> V2 a_r V1 100 | V2 -> epsilon 101 | V2 -> S 102 | V3 -> epsilon 103 | V3 -> a V2 V3 104 | 105 | ---- 106 | 107 | .. math:: 108 | 109 | S \, \rightarrow \, \overline{d} \, V \, d \, \\ 110 | V \, \rightarrow \, ((S \mid \varepsilon) \, \overline{a})^{*} \, (S \mid \varepsilon) \, (a \, (S \mid \varepsilon))^{*} \, \\ 111 | 112 | `Pyformlang RSA `_: 113 | 114 | .. code-block:: python 115 | 116 | S -> d_r V d 117 | V -> ((S|epsilon) a_r)* (S|epsilon) (a (S|epsilon))* 118 | -------------------------------------------------------------------------------- /docs/graphs/data/security.rst: -------------------------------------------------------------------------------- 1 | .. _security: 2 | 3 | security 4 | ======== 5 | 6 | .. contents:: Table of Contents 7 | 8 | Info 9 | ---- 10 | 11 | .. list-table:: 12 | :header-rows: 1 13 | 14 | * - 15 | - 16 | * - Full Name 17 | - security_after_inline 18 | * - Version 19 | - 4.0.0 20 | * - Direct download (.csv + .md) 21 | - `.tar.gz `_ 22 | * - Origin 23 | - `.txt `_ 24 | 25 | 26 | CSV File Structure 27 | ------------------ 28 | 29 | .. list-table:: 30 | :header-rows: 1 31 | 32 | * - Column Number 33 | - Column Type 34 | - Column Description 35 | * - 1 36 | - int 37 | - The tail of the edge 38 | * - 2 39 | - int 40 | - The head of the edge 41 | * - 3 42 | - str 43 | - The label of the edge 44 | 45 | 46 | Graph Statistics 47 | ---------------- 48 | 49 | .. list-table:: 50 | :header-rows: 1 51 | 52 | * - Num Nodes 53 | - Num Edges 54 | * - 3479982 55 | - 3003326 56 | 57 | 58 | Edges Statistics 59 | ---------------- 60 | 61 | .. list-table:: 62 | :header-rows: 1 63 | 64 | * - Edge Label 65 | - Num Edge Label 66 | * - d 67 | - 2319987 68 | * - a 69 | - 683339 70 | 71 | Canonical grammars 72 | ------------------ 73 | 74 | .. note:: 75 | 76 | In order to get the original graph you must apply function `cfpq_data.change_edges` with `mapping={"a": "A", "d": "D"}` to this graph. In this case these grammars must be updated. 77 | 78 | Grammars for the alias analysis of C programs introduced in `"Demand-driven alias analysis for C" `_. 79 | Template for these grammars is described on the :ref:`c_alias` page. 80 | 81 | .. math:: 82 | 83 | S \, \rightarrow \, \overline{d} \, V \, d \, \\ 84 | V \, \rightarrow \, V_1 \, V_2 \, V_3 \, \\ 85 | V_1 \, \rightarrow \, \varepsilon \, \\ 86 | V_1 \, \rightarrow \, V_2 \, \overline{a} \, V_1 \, \\ 87 | V_2 \, \rightarrow \, \varepsilon \, \\ 88 | V_2 \, \rightarrow \, S \, \\ 89 | V_3 \, \rightarrow \, \varepsilon \, \\ 90 | V_3 \, \rightarrow \, a \, V_2 \, V_3 \, \\ 91 | 92 | `Pyformlang CFG `_: 93 | 94 | .. code-block:: python 95 | 96 | S -> d_r V d 97 | V -> V1 V2 V3 98 | V1 -> epsilon 99 | V1 -> V2 a_r V1 100 | V2 -> epsilon 101 | V2 -> S 102 | V3 -> epsilon 103 | V3 -> a V2 V3 104 | 105 | ---- 106 | 107 | .. math:: 108 | 109 | S \, \rightarrow \, \overline{d} \, V \, d \, \\ 110 | V \, \rightarrow \, ((S \mid \varepsilon) \, \overline{a})^{*} \, (S \mid \varepsilon) \, (a \, (S \mid \varepsilon))^{*} \, \\ 111 | 112 | `Pyformlang RSA `_: 113 | 114 | .. code-block:: python 115 | 116 | S -> d_r V d 117 | V -> ((S|epsilon) a_r)* (S|epsilon) (a (S|epsilon))* 118 | -------------------------------------------------------------------------------- /docs/graphs/data/sound.rst: -------------------------------------------------------------------------------- 1 | .. _sound: 2 | 3 | sound 4 | ===== 5 | 6 | .. contents:: Table of Contents 7 | 8 | Info 9 | ---- 10 | 11 | .. list-table:: 12 | :header-rows: 1 13 | 14 | * - 15 | - 16 | * - Full Name 17 | - sound_after_inline 18 | * - Version 19 | - 4.0.0 20 | * - Direct download (.csv + .md) 21 | - `.tar.gz `_ 22 | * - Origin 23 | - `.txt `_ 24 | 25 | 26 | CSV File Structure 27 | ------------------ 28 | 29 | .. list-table:: 30 | :header-rows: 1 31 | 32 | * - Column Number 33 | - Column Type 34 | - Column Description 35 | * - 1 36 | - int 37 | - The tail of the edge 38 | * - 2 39 | - int 40 | - The head of the edge 41 | * - 3 42 | - str 43 | - The label of the edge 44 | 45 | 46 | Graph Statistics 47 | ---------------- 48 | 49 | .. list-table:: 50 | :header-rows: 1 51 | 52 | * - Num Nodes 53 | - Num Edges 54 | * - 3528861 55 | - 3049732 56 | 57 | 58 | Edges Statistics 59 | ---------------- 60 | 61 | .. list-table:: 62 | :header-rows: 1 63 | 64 | * - Edge Label 65 | - Num Edge Label 66 | * - d 67 | - 2352573 68 | * - a 69 | - 697159 70 | 71 | Canonical grammars 72 | ------------------ 73 | 74 | .. note:: 75 | 76 | In order to get the original graph you must apply function `cfpq_data.change_edges` with `mapping={"a": "A", "d": "D"}` to this graph. In this case these grammars must be updated. 77 | 78 | Grammars for the alias analysis of C programs introduced in `"Demand-driven alias analysis for C" `_. 79 | Template for these grammars is described on the :ref:`c_alias` page. 80 | 81 | .. math:: 82 | 83 | S \, \rightarrow \, \overline{d} \, V \, d \, \\ 84 | V \, \rightarrow \, V_1 \, V_2 \, V_3 \, \\ 85 | V_1 \, \rightarrow \, \varepsilon \, \\ 86 | V_1 \, \rightarrow \, V_2 \, \overline{a} \, V_1 \, \\ 87 | V_2 \, \rightarrow \, \varepsilon \, \\ 88 | V_2 \, \rightarrow \, S \, \\ 89 | V_3 \, \rightarrow \, \varepsilon \, \\ 90 | V_3 \, \rightarrow \, a \, V_2 \, V_3 \, \\ 91 | 92 | `Pyformlang CFG `_: 93 | 94 | .. code-block:: python 95 | 96 | S -> d_r V d 97 | V -> V1 V2 V3 98 | V1 -> epsilon 99 | V1 -> V2 a_r V1 100 | V2 -> epsilon 101 | V2 -> S 102 | V3 -> epsilon 103 | V3 -> a V2 V3 104 | 105 | ---- 106 | 107 | .. math:: 108 | 109 | S \, \rightarrow \, \overline{d} \, V \, d \, \\ 110 | V \, \rightarrow \, ((S \mid \varepsilon) \, \overline{a})^{*} \, (S \mid \varepsilon) \, (a \, (S \mid \varepsilon))^{*} \, \\ 111 | 112 | `Pyformlang RSA `_: 113 | 114 | .. code-block:: python 115 | 116 | S -> d_r V d 117 | V -> ((S|epsilon) a_r)* (S|epsilon) (a (S|epsilon))* 118 | -------------------------------------------------------------------------------- /docs/graphs/data/sunflow.rst: -------------------------------------------------------------------------------- 1 | .. _sunflow: 2 | 3 | sunflow 4 | ===== 5 | 6 | .. contents:: Table of Contents 7 | 8 | Info 9 | ---- 10 | 11 | .. list-table:: 12 | :header-rows: 1 13 | 14 | * - 15 | - 16 | * - Full Name 17 | - sunflow 18 | * - Version 19 | - 4.0.0 20 | * - Direct download (.csv + .md) 21 | - `.tar.gz `_ 22 | * - Origin 23 | - `link `_ 24 | 25 | 26 | CSV File Structure 27 | ------------------ 28 | 29 | .. list-table:: 30 | :header-rows: 1 31 | 32 | * - Column Number 33 | - Column Type 34 | - Column Description 35 | * - 1 36 | - int 37 | - The tail of the edge 38 | * - 2 39 | - int 40 | - The head of the edge 41 | * - 3 42 | - str 43 | - The label of the edge 44 | 45 | 46 | Graph Statistics 47 | ---------------- 48 | 49 | .. list-table:: 50 | :header-rows: 1 51 | 52 | * - Num Nodes 53 | - Num Edges 54 | * - 15464 55 | - 15957 56 | 57 | 58 | Edges Statistics 59 | ---------------- 60 | 61 | .. note:: 62 | 63 | This graph has edges with labels :math:`\textit{load}_f` and :math:`\textit{store}_f` for all :math:`f \in \textit{Fields} = \{0, \ldots, 231\}`. 64 | 65 | .. list-table:: 66 | :header-rows: 1 67 | 68 | * - Edge Label 69 | - Num Edge Label 70 | * - :math:`\textit{alloc}` 71 | - 3306 72 | * - :math:`\textit{assign}` 73 | - 9972 74 | * - :math:`\textit{load}_f` 75 | - 2305 76 | * - :math:`\textit{store}_f` 77 | - 374 78 | 79 | 80 | Canonical grammars 81 | ------------------ 82 | 83 | Grammars for the field-sensitive analysis of Java programs introduced in `"Giga-scale exhaustive points-to analysis for Java in under a minute" `_. 84 | Template for these grammars is described on the :ref:`java_points-to` page. 85 | 86 | .. math:: 87 | \textit{PointsTo} \, \rightarrow \, (\textit{assign} \mid \textit{load}_f \, \textit{Alias} \, \textit{store}_f)^{*} \, \textit{alloc} \, \\ 88 | \textit{Alias} \, \rightarrow \, \textit{PointsTo} \, \textit{FlowsTo} \, \\ 89 | \textit{FlowsTo} \, \rightarrow \, \overline{\textit{alloc}} \, (\overline{\textit{assign}} \mid \overline{\textit{store}_f} \, \textit{Alias} \, \overline{\textit{load}_f})^* \, \\ 90 | \forall \, f \, \in \, Fields 91 | -------------------------------------------------------------------------------- /docs/graphs/data/taxonomy_hierarchy.rst: -------------------------------------------------------------------------------- 1 | .. _taxonomy_hierarchy: 2 | 3 | taxonomy_hierarchy 4 | ================== 5 | 6 | .. contents:: Table of Contents 7 | 8 | Info 9 | ---- 10 | 11 | .. list-table:: 12 | :header-rows: 1 13 | 14 | * - 15 | - 16 | * - Full Name 17 | - taxonomy_hierarchy 18 | * - Version 19 | - 4.0.0 20 | * - Direct download (.csv + .md) 21 | - `.tar.gz `_ 22 | * - Origin 23 | - `.rdf.xz `_ 24 | 25 | 26 | CSV File Structure 27 | ------------------ 28 | 29 | .. list-table:: 30 | :header-rows: 1 31 | 32 | * - Column Number 33 | - Column Type 34 | - Column Description 35 | * - 1 36 | - int 37 | - The tail of the edge 38 | * - 2 39 | - int 40 | - The head of the edge 41 | * - 3 42 | - str 43 | - The label of the edge 44 | 45 | 46 | Graph Statistics 47 | ---------------- 48 | 49 | .. list-table:: 50 | :header-rows: 1 51 | 52 | * - Num Nodes 53 | - Num Edges 54 | * - 2112625 55 | - 32876289 56 | 57 | 58 | Edges Statistics 59 | ---------------- 60 | 61 | .. list-table:: 62 | :header-rows: 1 63 | 64 | * - Edge Label 65 | - Num Edge Label 66 | * - subClassOf 67 | - 32876289 68 | 69 | Canonical grammars 70 | ------------------ 71 | 72 | Nested parentheses grammars introduced in `"Context-Free Path Queries on RDF Graphs" `_. 73 | Template for these grammars is described on the :ref:`nested_parentheses` page. 74 | 75 | .. math:: 76 | 77 | S \, \rightarrow \, \overline{subClassOf} \, S \, subClassOf \, \mid \, \overline{subClassOf} \, subClassOf \, \\ 78 | S \, \rightarrow \, \overline{type} \, S \, type \, \mid \, \overline{type} \, type \, \\ 79 | 80 | `Pyformlang CFG `_: 81 | 82 | .. code-block:: python 83 | 84 | S -> subClassOf_r S subClassOf | subClassOf_r subClassOf 85 | S -> type_r S type | type_r type 86 | 87 | ---- 88 | 89 | .. math:: 90 | 91 | S \, \rightarrow \, \overline{subClassOf} \, S \, subClassOf \, \mid \, \overline{subClassOf} \, subClassOf \, \\ 92 | 93 | `Pyformlang CFG `_: 94 | 95 | .. code-block:: python 96 | 97 | S -> subClassOf_r S subClassOf | subClassOf_r subClassOf 98 | 99 | ---- 100 | 101 | .. math:: 102 | 103 | S \, \rightarrow \, \overline{type} \, S \, type \, \mid \, \overline{type} \, type \, \\ 104 | 105 | `Pyformlang CFG `_: 106 | 107 | .. code-block:: python 108 | 109 | S -> type_r S type | type_r type 110 | -------------------------------------------------------------------------------- /docs/graphs/data/tomcat.rst: -------------------------------------------------------------------------------- 1 | .. _tomcat: 2 | 3 | tomcat 4 | ===== 5 | 6 | .. contents:: Table of Contents 7 | 8 | Info 9 | ---- 10 | 11 | .. list-table:: 12 | :header-rows: 1 13 | 14 | * - 15 | - 16 | * - Full Name 17 | - tomcat 18 | * - Version 19 | - 4.0.0 20 | * - Direct download (.csv + .md) 21 | - `.tar.gz `_ 22 | * - Origin 23 | - `link `_ 24 | 25 | 26 | CSV File Structure 27 | ------------------ 28 | 29 | .. list-table:: 30 | :header-rows: 1 31 | 32 | * - Column Number 33 | - Column Type 34 | - Column Description 35 | * - 1 36 | - int 37 | - The tail of the edge 38 | * - 2 39 | - int 40 | - The head of the edge 41 | * - 3 42 | - str 43 | - The label of the edge 44 | 45 | 46 | Graph Statistics 47 | ---------------- 48 | 49 | .. list-table:: 50 | :header-rows: 1 51 | 52 | * - Num Nodes 53 | - Num Edges 54 | * - 111327 55 | - 110884 56 | 57 | 58 | Edges Statistics 59 | ---------------- 60 | 61 | .. note:: 62 | 63 | This graph has edges with labels :math:`\textit{load}_f` and :math:`\textit{store}_f` for all :math:`f \in \textit{Fields} = \{0, \ldots, 2210\}`. 64 | 65 | .. list-table:: 66 | :header-rows: 1 67 | 68 | * - Edge Label 69 | - Num Edge Label 70 | * - :math:`\textit{alloc}` 71 | - 22962 72 | * - :math:`\textit{assign}` 73 | - 69473 74 | * - :math:`\textit{load}_f` 75 | - 15198 76 | * - :math:`\textit{store}_f` 77 | - 3251 78 | 79 | 80 | Canonical grammars 81 | ------------------ 82 | 83 | Grammars for the field-sensitive analysis of Java programs introduced in `"Giga-scale exhaustive points-to analysis for Java in under a minute" `_. 84 | Template for these grammars is described on the :ref:`java_points-to` page. 85 | 86 | .. math:: 87 | \textit{PointsTo} \, \rightarrow \, (\textit{assign} \mid \textit{load}_f \, \textit{Alias} \, \textit{store}_f)^{*} \, \textit{alloc} \, \\ 88 | \textit{Alias} \, \rightarrow \, \textit{PointsTo} \, \textit{FlowsTo} \, \\ 89 | \textit{FlowsTo} \, \rightarrow \, \overline{\textit{alloc}} \, (\overline{\textit{assign}} \mid \overline{\textit{store}_f} \, \textit{Alias} \, \overline{\textit{load}_f})^* \, \\ 90 | \forall \, f \, \in \, Fields 91 | -------------------------------------------------------------------------------- /docs/graphs/data/tradebeans.rst: -------------------------------------------------------------------------------- 1 | .. _tradebeans: 2 | 3 | tradebeans 4 | ===== 5 | 6 | .. contents:: Table of Contents 7 | 8 | Info 9 | ---- 10 | 11 | .. list-table:: 12 | :header-rows: 1 13 | 14 | * - 15 | - 16 | * - Full Name 17 | - tradebeans 18 | * - Version 19 | - 4.0.0 20 | * - Direct download (.csv + .md) 21 | - `.tar.gz `_ 22 | * - Origin 23 | - `link `_ 24 | 25 | 26 | CSV File Structure 27 | ------------------ 28 | 29 | .. list-table:: 30 | :header-rows: 1 31 | 32 | * - Column Number 33 | - Column Type 34 | - Column Description 35 | * - 1 36 | - int 37 | - The tail of the edge 38 | * - 2 39 | - int 40 | - The head of the edge 41 | * - 3 42 | - str 43 | - The label of the edge 44 | 45 | 46 | Graph Statistics 47 | ---------------- 48 | 49 | .. list-table:: 50 | :header-rows: 1 51 | 52 | * - Num Nodes 53 | - Num Edges 54 | * - 439693 55 | - 466969 56 | 57 | 58 | Edges Statistics 59 | ---------------- 60 | 61 | .. note:: 62 | 63 | This graph has edges with labels :math:`\textit{load}_f` and :math:`\textit{store}_f` for all :math:`f \in \textit{Fields} = \{0, \ldots, 8170\}`. 64 | 65 | .. list-table:: 66 | :header-rows: 1 67 | 68 | * - Edge Label 69 | - Num Edge Label 70 | * - :math:`\textit{alloc}` 71 | - 69597 72 | * - :math:`\textit{assign}` 73 | - 335195 74 | * - :math:`\textit{load}_f` 75 | - 49794 76 | * - :math:`\textit{store}_f` 77 | - 12383 78 | 79 | 80 | Canonical grammars 81 | ------------------ 82 | 83 | Grammars for the field-sensitive analysis of Java programs introduced in `"Giga-scale exhaustive points-to analysis for Java in under a minute" `_. 84 | Template for these grammars is described on the :ref:`java_points-to` page. 85 | 86 | .. math:: 87 | \textit{PointsTo} \, \rightarrow \, (\textit{assign} \mid \textit{load}_f \, \textit{Alias} \, \textit{store}_f)^{*} \, \textit{alloc} \, \\ 88 | \textit{Alias} \, \rightarrow \, \textit{PointsTo} \, \textit{FlowsTo} \, \\ 89 | \textit{FlowsTo} \, \rightarrow \, \overline{\textit{alloc}} \, (\overline{\textit{assign}} \mid \overline{\textit{store}_f} \, \textit{Alias} \, \overline{\textit{load}_f})^* \, \\ 90 | \forall \, f \, \in \, Fields 91 | -------------------------------------------------------------------------------- /docs/graphs/data/tradesoap.rst: -------------------------------------------------------------------------------- 1 | .. _tradesoap: 2 | 3 | tradesoap 4 | ===== 5 | 6 | .. contents:: Table of Contents 7 | 8 | Info 9 | ---- 10 | 11 | .. list-table:: 12 | :header-rows: 1 13 | 14 | * - 15 | - 16 | * - Full Name 17 | - tradesoap 18 | * - Version 19 | - 4.0.0 20 | * - Direct download (.csv + .md) 21 | - `.tar.gz `_ 22 | * - Origin 23 | - `link `_ 24 | 25 | 26 | CSV File Structure 27 | ------------------ 28 | 29 | .. list-table:: 30 | :header-rows: 1 31 | 32 | * - Column Number 33 | - Column Type 34 | - Column Description 35 | * - 1 36 | - int 37 | - The tail of the edge 38 | * - 2 39 | - int 40 | - The head of the edge 41 | * - 3 42 | - str 43 | - The label of the edge 44 | 45 | 46 | Graph Statistics 47 | ---------------- 48 | 49 | .. list-table:: 50 | :header-rows: 1 51 | 52 | * - Num Nodes 53 | - Num Edges 54 | * - 440680 55 | - 468263 56 | 57 | 58 | Edges Statistics 59 | ---------------- 60 | 61 | .. note:: 62 | 63 | This graph has edges with labels :math:`\textit{load}_f` and :math:`\textit{store}_f` for all :math:`f \in \textit{Fields} = \{0, \ldots, 8193\}`. 64 | 65 | .. list-table:: 66 | :header-rows: 1 67 | 68 | * - Edge Label 69 | - Num Edge Label 70 | * - :math:`\textit{alloc}` 71 | - 69718 72 | * - :math:`\textit{assign}` 73 | - 336279 74 | * - :math:`\textit{load}_f` 75 | - 49858 76 | * - :math:`\textit{store}_f` 77 | - 12408 78 | 79 | 80 | Canonical grammars 81 | ------------------ 82 | 83 | Grammars for the field-sensitive analysis of Java programs introduced in `"Giga-scale exhaustive points-to analysis for Java in under a minute" `_. 84 | Template for these grammars is described on the :ref:`java_points-to` page. 85 | 86 | .. math:: 87 | \textit{PointsTo} \, \rightarrow \, (\textit{assign} \mid \textit{load}_f \, \textit{Alias} \, \textit{store}_f)^{*} \, \textit{alloc} \, \\ 88 | \textit{Alias} \, \rightarrow \, \textit{PointsTo} \, \textit{FlowsTo} \, \\ 89 | \textit{FlowsTo} \, \rightarrow \, \overline{\textit{alloc}} \, (\overline{\textit{assign}} \mid \overline{\textit{store}_f} \, \textit{Alias} \, \overline{\textit{load}_f})^* \, \\ 90 | \forall \, f \, \in \, Fields 91 | -------------------------------------------------------------------------------- /docs/graphs/data/wc.rst: -------------------------------------------------------------------------------- 1 | .. _wc: 2 | 3 | wc 4 | == 5 | 6 | .. contents:: Table of Contents 7 | 8 | Info 9 | ---- 10 | 11 | .. list-table:: 12 | :header-rows: 1 13 | 14 | * - 15 | - 16 | * - Full Name 17 | - wc 18 | * - Version 19 | - 4.0.0 20 | * - Direct download (.csv + .md) 21 | - `.tar.gz `_ 22 | * - Origin 23 | - `.xml.tar.gz `_ 24 | 25 | 26 | CSV File Structure 27 | ------------------ 28 | 29 | .. list-table:: 30 | :header-rows: 1 31 | 32 | * - Column Number 33 | - Column Type 34 | - Column Description 35 | * - 1 36 | - int 37 | - The tail of the edge 38 | * - 2 39 | - int 40 | - The head of the edge 41 | * - 3 42 | - str 43 | - The label of the edge 44 | 45 | 46 | Graph Statistics 47 | ---------------- 48 | 49 | .. list-table:: 50 | :header-rows: 1 51 | 52 | * - Num Nodes 53 | - Num Edges 54 | * - 332 55 | - 269 56 | 57 | 58 | Edges Statistics 59 | ---------------- 60 | 61 | .. list-table:: 62 | :header-rows: 1 63 | 64 | * - Edge Label 65 | - Num Edge Label 66 | * - d 67 | - 156 68 | * - a 69 | - 113 70 | 71 | Canonical grammars 72 | ------------------ 73 | 74 | .. note:: 75 | 76 | In order to get the original graph you must apply function `cfpq_data.change_edges` with `mapping={"a": "A", "d": "D"}` to this graph. In this case these grammars must be updated. 77 | 78 | Grammars for the alias analysis of C programs introduced in `"Demand-driven alias analysis for C" `_. 79 | Template for these grammars is described on the :ref:`c_alias` page. 80 | 81 | .. math:: 82 | 83 | S \, \rightarrow \, \overline{d} \, V \, d \, \\ 84 | V \, \rightarrow \, V_1 \, V_2 \, V_3 \, \\ 85 | V_1 \, \rightarrow \, \varepsilon \, \\ 86 | V_1 \, \rightarrow \, V_2 \, \overline{a} \, V_1 \, \\ 87 | V_2 \, \rightarrow \, \varepsilon \, \\ 88 | V_2 \, \rightarrow \, S \, \\ 89 | V_3 \, \rightarrow \, \varepsilon \, \\ 90 | V_3 \, \rightarrow \, a \, V_2 \, V_3 \, \\ 91 | 92 | `Pyformlang CFG `_: 93 | 94 | .. code-block:: python 95 | 96 | S -> d_r V d 97 | V -> V1 V2 V3 98 | V1 -> epsilon 99 | V1 -> V2 a_r V1 100 | V2 -> epsilon 101 | V2 -> S 102 | V3 -> epsilon 103 | V3 -> a V2 V3 104 | 105 | ---- 106 | 107 | .. math:: 108 | 109 | S \, \rightarrow \, \overline{d} \, V \, d \, \\ 110 | V \, \rightarrow \, ((S \mid \varepsilon) \, \overline{a})^{*} \, (S \mid \varepsilon) \, (a \, (S \mid \varepsilon))^{*} \, \\ 111 | 112 | `Pyformlang RSA `_: 113 | 114 | .. code-block:: python 115 | 116 | S -> d_r V d 117 | V -> ((S|epsilon) a_r)* (S|epsilon) (a (S|epsilon))* 118 | -------------------------------------------------------------------------------- /docs/graphs/data/xalan.rst: -------------------------------------------------------------------------------- 1 | .. _xalan: 2 | 3 | xalan 4 | ===== 5 | 6 | .. contents:: Table of Contents 7 | 8 | Info 9 | ---- 10 | 11 | .. list-table:: 12 | :header-rows: 1 13 | 14 | * - 15 | - 16 | * - Full Name 17 | - xalan 18 | * - Version 19 | - 4.0.0 20 | * - Direct download (.csv + .md) 21 | - `.tar.gz `_ 22 | * - Origin 23 | - `link `_ 24 | 25 | 26 | CSV File Structure 27 | ------------------ 28 | 29 | .. list-table:: 30 | :header-rows: 1 31 | 32 | * - Column Number 33 | - Column Type 34 | - Column Description 35 | * - 1 36 | - int 37 | - The tail of the edge 38 | * - 2 39 | - int 40 | - The head of the edge 41 | * - 3 42 | - str 43 | - The label of the edge 44 | 45 | 46 | Graph Statistics 47 | ---------------- 48 | 49 | .. list-table:: 50 | :header-rows: 1 51 | 52 | * - Num Nodes 53 | - Num Edges 54 | * - 58476 55 | - 62758 56 | 57 | 58 | Edges Statistics 59 | ---------------- 60 | 61 | .. note:: 62 | 63 | This graph has edges with labels :math:`\textit{load}_f` and :math:`\textit{store}_f` for all :math:`f \in \textit{Fields} = \{0, \ldots, 1270\}`. 64 | 65 | .. list-table:: 66 | :header-rows: 1 67 | 68 | * - Edge Label 69 | - Num Edge Label 70 | * - :math:`\textit{alloc}` 71 | - 8760 72 | * - :math:`\textit{assign}` 73 | - 40102 74 | * - :math:`\textit{load}_f` 75 | - 11813 76 | * - :math:`\textit{store}_f` 77 | - 2083 78 | 79 | 80 | Canonical grammars 81 | ------------------ 82 | 83 | Grammars for the field-sensitive analysis of Java programs introduced in `"Giga-scale exhaustive points-to analysis for Java in under a minute" `_. 84 | Template for these grammars is described on the :ref:`java_points-to` page. 85 | 86 | .. math:: 87 | \textit{PointsTo} \, \rightarrow \, (\textit{assign} \mid \textit{load}_f \, \textit{Alias} \, \textit{store}_f)^{*} \, \textit{alloc} \, \\ 88 | \textit{Alias} \, \rightarrow \, \textit{PointsTo} \, \textit{FlowsTo} \, \\ 89 | \textit{FlowsTo} \, \rightarrow \, \overline{\textit{alloc}} \, (\overline{\textit{assign}} \mid \overline{\textit{store}_f} \, \textit{Alias} \, \overline{\textit{load}_f})^* \, \\ 90 | \forall \, f \, \in \, Fields 91 | -------------------------------------------------------------------------------- /docs/index.rst: -------------------------------------------------------------------------------- 1 | .. _contents: 2 | 3 | Data for Context-Free Path Querying Evaluation 4 | ============================================== 5 | 6 | CFPQ_Data is a Python package for the creation, manipulation, and study of the 7 | structure, dynamics, and functions of complex Graphs and Grammars used for 8 | experimental analysis of Context-Free Path Querying algorithms. 9 | 10 | CFPQ_Data is free software; you can redistribute it and/or modify it under the 11 | terms of the :doc:`Apache-2.0 License `. 12 | 13 | We welcome contributions. Join us on `GitHub `_. 14 | 15 | Documentation 16 | ============= 17 | 18 | .. only:: html 19 | 20 | :Release: |version| 21 | :Date: |today| 22 | 23 | .. toctree:: 24 | :maxdepth: 1 25 | 26 | graphs/index 27 | grammars/index 28 | benchmarks/index 29 | install 30 | tutorial 31 | reference/index 32 | about 33 | license 34 | 35 | Indices and tables 36 | ================== 37 | 38 | * :ref:`genindex` 39 | * :ref:`modindex` 40 | * :ref:`search` 41 | -------------------------------------------------------------------------------- /docs/install.rst: -------------------------------------------------------------------------------- 1 | .. _install: 2 | 3 | Install 4 | ======= 5 | 6 | .. only:: html 7 | 8 | :Release: |release| 9 | :Date: |today| 10 | 11 | CFPQ_Data requires Python 3.7 or later. If you do not already 12 | have a Python environment configured on your computer, please see the 13 | instructions for installing the full `scientific Python stack 14 | `_. 15 | 16 | Below we assume you have the default Python environment already configured on 17 | your computer and you intend to install ``cfpq_data`` inside of it. If you want 18 | to create and work with Python virtual environments, please follow instructions 19 | on `venv `_ and `virtual 20 | environments `_. 21 | 22 | First, make sure you have the latest version of ``pip`` (the Python package manager) 23 | installed. If you do not, refer to the `Pip documentation 24 | `_ and install ``pip`` first. 25 | 26 | Install the released version 27 | ---------------------------- 28 | 29 | Install the current release of ``cfpq_data`` with ``pip``:: 30 | 31 | pip install cfpq_data 32 | 33 | To upgrade to a newer release use the ``--upgrade`` flag:: 34 | 35 | pip install --upgrade cfpq_data 36 | 37 | If you do not have permission to install software systemwide, you can 38 | install into your user directory using the ``--user`` flag:: 39 | 40 | pip install --user cfpq_data 41 | 42 | Alternatively, you can manually download ``cfpq_data`` from 43 | `GitHub `_ or 44 | `PyPI `_. 45 | To install one of these versions, unpack it and run the following from the 46 | top-level source directory using the Terminal:: 47 | 48 | pip install . 49 | -------------------------------------------------------------------------------- /docs/license.rst: -------------------------------------------------------------------------------- 1 | .. _license: 2 | 3 | .. only:: html 4 | 5 | :Release: |release| 6 | :Date: |today| 7 | 8 | .. include:: ../LICENSE.txt 9 | -------------------------------------------------------------------------------- /docs/reference/dataset/index.rst: -------------------------------------------------------------------------------- 1 | .. _dataset: 2 | 3 | .. currentmodule:: cfpq_data 4 | 5 | ***************** 6 | Dataset utilities 7 | ***************** 8 | 9 | .. only:: html 10 | 11 | :Release: |release| 12 | :Date: |today| 13 | 14 | .. automodule:: cfpq_data.dataset 15 | .. autosummary:: 16 | :toctree: generated/ 17 | 18 | download 19 | download_grammars 20 | download_benchmark 21 | DATASET 22 | BENCHMARKS 23 | GRAMMAR_TEMPLATES 24 | -------------------------------------------------------------------------------- /docs/reference/grammars/grammars_converters.rst: -------------------------------------------------------------------------------- 1 | .. _grammars_converters: 2 | 3 | .. currentmodule:: cfpq_data 4 | 5 | ****************** 6 | Grammar converters 7 | ****************** 8 | 9 | .. seealso:: 10 | 11 | `Pyformlang CFG 12 | `_ 13 | 14 | .. automodule:: cfpq_data.grammars.converters 15 | .. autosummary:: 16 | :toctree: generated/ 17 | 18 | cfg 19 | cnf 20 | -------------------------------------------------------------------------------- /docs/reference/grammars/grammars_generators.rst: -------------------------------------------------------------------------------- 1 | .. _grammars_generators: 2 | 3 | .. currentmodule:: cfpq_data 4 | 5 | ****************** 6 | Grammar generators 7 | ****************** 8 | 9 | .. seealso:: 10 | 11 | `Pyformlang CFG 12 | `_ 13 | 14 | .. automodule:: cfpq_data.grammars.generators 15 | .. autosummary:: 16 | :toctree: generated/ 17 | 18 | c_alias_grammar 19 | dyck_grammar 20 | java_points_to_grammar 21 | java_points_to_grammar_from_graph 22 | nested_parentheses_grammar 23 | -------------------------------------------------------------------------------- /docs/reference/grammars/grammars_readwrite.rst: -------------------------------------------------------------------------------- 1 | .. _grammars_readwrite: 2 | 3 | .. currentmodule:: cfpq_data 4 | 5 | **************************** 6 | Reading and writing grammars 7 | **************************** 8 | 9 | .. seealso:: 10 | 11 | `Pyformlang CFG 12 | `_ 13 | 14 | .. automodule:: cfpq_data.grammars.readwrite 15 | .. autosummary:: 16 | :toctree: generated/ 17 | 18 | cfg 19 | cnf 20 | rsa 21 | regex 22 | -------------------------------------------------------------------------------- /docs/reference/grammars/grammars_utils.rst: -------------------------------------------------------------------------------- 1 | .. _grammars_utils: 2 | 3 | .. currentmodule:: cfpq_data 4 | 5 | ***************** 6 | Grammar utilities 7 | ***************** 8 | 9 | .. seealso:: 10 | 11 | `Pyformlang CFG 12 | `_ 13 | 14 | .. automodule:: cfpq_data.grammars.utils 15 | .. autosummary:: 16 | :toctree: generated/ 17 | 18 | change_terminals 19 | -------------------------------------------------------------------------------- /docs/reference/grammars/index.rst: -------------------------------------------------------------------------------- 1 | .. _grammars: 2 | 3 | .. currentmodule:: cfpq_data 4 | 5 | ******** 6 | Grammars 7 | ******** 8 | 9 | .. only:: html 10 | 11 | :Release: |release| 12 | :Date: |today| 13 | 14 | .. toctree:: 15 | :maxdepth: 1 16 | 17 | grammars_converters 18 | grammars_generators 19 | grammars_readwrite 20 | grammars_utils 21 | -------------------------------------------------------------------------------- /docs/reference/graphs/graphs_generators.rst: -------------------------------------------------------------------------------- 1 | .. _graphs_generators: 2 | 3 | .. currentmodule:: cfpq_data 4 | 5 | **************** 6 | Graph generators 7 | **************** 8 | 9 | .. seealso:: 10 | 11 | `NetworkX Graph generators 12 | `_ 13 | 14 | .. automodule:: cfpq_data.graphs.generators 15 | .. autosummary:: 16 | :toctree: generated/ 17 | 18 | fast_labeled_binomial_graph 19 | labeled_barabasi_albert_graph 20 | labeled_binomial_graph 21 | labeled_cycle_graph 22 | labeled_scale_free_graph 23 | labeled_two_cycles_graph 24 | -------------------------------------------------------------------------------- /docs/reference/graphs/graphs_readwrite.rst: -------------------------------------------------------------------------------- 1 | .. _graphs_readwrite: 2 | 3 | .. currentmodule:: cfpq_data 4 | 5 | ************************** 6 | Reading and writing graphs 7 | ************************** 8 | 9 | .. seealso:: 10 | 11 | `NetworkX Reading and writing graphs 12 | `_ 13 | 14 | .. automodule:: cfpq_data.graphs.readwrite 15 | .. autosummary:: 16 | :toctree: generated/ 17 | 18 | csv 19 | txt 20 | rdf 21 | -------------------------------------------------------------------------------- /docs/reference/graphs/graphs_utils.rst: -------------------------------------------------------------------------------- 1 | .. _graphs_utils: 2 | 3 | .. currentmodule:: cfpq_data 4 | 5 | *************** 6 | Graph utilities 7 | *************** 8 | 9 | .. seealso:: 10 | 11 | `NetworkX Utilities 12 | `_ 13 | 14 | .. automodule:: cfpq_data.graphs.utils 15 | .. autosummary:: 16 | :toctree: generated/ 17 | 18 | add_reverse_edges 19 | change_edges 20 | edges_statistics 21 | filter_edges 22 | multiple_source_utils 23 | nodes_to_integers 24 | -------------------------------------------------------------------------------- /docs/reference/graphs/index.rst: -------------------------------------------------------------------------------- 1 | .. _graphs: 2 | 3 | .. currentmodule:: cfpq_data 4 | 5 | ****** 6 | Graphs 7 | ****** 8 | 9 | .. only:: html 10 | 11 | :Release: |release| 12 | :Date: |today| 13 | 14 | .. toctree:: 15 | :maxdepth: 1 16 | 17 | graphs_generators 18 | graphs_readwrite 19 | graphs_utils 20 | -------------------------------------------------------------------------------- /docs/reference/index.rst: -------------------------------------------------------------------------------- 1 | .. _reference: 2 | 3 | .. currentmodule:: cfpq_data 4 | 5 | ********* 6 | Reference 7 | ********* 8 | 9 | .. only:: html 10 | 11 | :Release: |release| 12 | :Date: |today| 13 | 14 | .. seealso:: 15 | 16 | `NetworkX reference `_ 17 | 18 | .. seealso:: 19 | 20 | `Pyformlang reference `_ 21 | 22 | .. toctree:: 23 | :maxdepth: 2 24 | 25 | dataset/index 26 | graphs/index 27 | grammars/index 28 | -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | [build-system] 2 | requires = [ 3 | "setuptools>=42", 4 | "wheel" 5 | ] 6 | build-backend = "setuptools.build_meta" 7 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | -r requirements/default.txt 2 | -------------------------------------------------------------------------------- /requirements/README.md: -------------------------------------------------------------------------------- 1 | # Requirements 2 | 3 | ## Index 4 | 5 | - [`default.txt`](default.txt) 6 | Default requirements 7 | - [`developer.txt`](developer.txt) 8 | Requirements for developers 9 | - [`tests.txt`](tests.txt) 10 | Requirements for running test suite 11 | - [`docs.txt`](docs.txt) 12 | Requirements for building the documentation (see `../doc/`) 13 | 14 | ## Examples 15 | 16 | ### Installing requirements 17 | 18 | ```bash 19 | pip install -U -r requirements/default.txt 20 | ``` 21 | 22 | ### Running the tests 23 | 24 | ```bash 25 | pip install -U -r requirements/default.txt 26 | pip install -U -r requirements/tests.txt 27 | ``` 28 | -------------------------------------------------------------------------------- /requirements/default.txt: -------------------------------------------------------------------------------- 1 | networkx==3.2.1 2 | pandas==2.2.1 3 | pyformlang==1.0.7 4 | rdflib==7.0.0 5 | requests==2.31.0 6 | -------------------------------------------------------------------------------- /requirements/developer.txt: -------------------------------------------------------------------------------- 1 | black==24.2.0 2 | pre-commit==3.6.2 3 | pytest==8.0.1 4 | -------------------------------------------------------------------------------- /requirements/docs.txt: -------------------------------------------------------------------------------- 1 | nb2plots==0.7.2 2 | numpydoc==1.6.0 3 | pydata_sphinx_theme==0.15.2 4 | sphinx==7.2.6 5 | sphinx-copybutton==0.5.2 6 | -------------------------------------------------------------------------------- /requirements/tests.txt: -------------------------------------------------------------------------------- 1 | codecov>=2.1 2 | pytest>=6.2 3 | pytest-cov>=2.10 4 | -------------------------------------------------------------------------------- /tests/dataset/test_data.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | 3 | import cfpq_data 4 | 5 | 6 | def test_download_rise(): 7 | with pytest.raises(FileNotFoundError): 8 | cfpq_data.download("") 9 | 10 | 11 | @pytest.mark.parametrize("template,graph_name", [("", None), ("dyck", "")]) 12 | def test_download_grammars_rise(template, graph_name): 13 | with pytest.raises(FileNotFoundError): 14 | cfpq_data.download_grammars(template, graph_name=graph_name) 15 | 16 | 17 | def test_download_grammars_none(): 18 | assert cfpq_data.download_grammars("java_points_to", graph_name="skos") is None 19 | 20 | 21 | @pytest.mark.parametrize("template,graph_name", [("dyck", None)]) 22 | def test_download_grammars_success(template, graph_name): 23 | assert not cfpq_data.download_grammars(template, graph_name=graph_name) is None 24 | 25 | 26 | def test_download_benchmark_rise(): 27 | with pytest.raises(FileNotFoundError): 28 | cfpq_data.download_benchmark("") 29 | -------------------------------------------------------------------------------- /tests/grammars/converters/test_cfg_converters.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | 3 | import cfpq_data 4 | 5 | cnf_1 = cfpq_data.cnf_from_text("S -> a S b | a b") 6 | cnf_2 = cfpq_data.cnf_from_text("S -> sco_r S sco | t_r S t | sco_r sco | t_r t") 7 | 8 | regex_1 = cfpq_data.regex_from_text("a*") 9 | regex_2 = cfpq_data.regex_from_text("a (bc|d*)") 10 | 11 | rsa_1 = cfpq_data.rsa_from_text("S -> a S b | a b") 12 | rsa_2 = cfpq_data.rsa_from_text("S -> sco_r S sco | t_r S t | sco_r sco | t_r t") 13 | 14 | 15 | @pytest.mark.parametrize("cnf", [cnf_1, cnf_2]) 16 | def test_cfg_from_cnf(cnf): 17 | cfg = cfpq_data.cfg_from_cnf(cnf) 18 | for word in cfg.get_words(4): 19 | assert cfg.contains(word) and cnf.contains(word) 20 | 21 | 22 | @pytest.mark.parametrize("regex", [regex_1, regex_2]) 23 | def test_cfg_from_regex(regex): 24 | cfg = cfpq_data.cfg_from_regex(regex) 25 | for word in cfg.get_words(4): 26 | regex_word = map(lambda x: x.value, word) 27 | assert cfg.contains(word) and regex.accepts(regex_word) 28 | 29 | 30 | @pytest.mark.parametrize("rsa", [rsa_1, rsa_2]) 31 | def test_cfg_from_rsa(rsa): 32 | cfg = cfpq_data.cfg_from_rsa(rsa) 33 | cnf = cfpq_data.cnf_from_rsa(rsa) 34 | for word in cfg.get_words(4): 35 | assert cfg.contains(word) and cnf.contains(word) 36 | -------------------------------------------------------------------------------- /tests/grammars/converters/test_cnf_converters.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | 3 | import cfpq_data 4 | 5 | cfg_1 = cfpq_data.cfg_from_text("S -> a S b | a b") 6 | cfg_2 = cfpq_data.cfg_from_text("S -> sco_r S sco | t_r S t | sco_r sco | t_r t") 7 | 8 | regex_1 = cfpq_data.regex_from_text("a*") 9 | regex_2 = cfpq_data.regex_from_text("a (bc|d*)") 10 | 11 | rsa_1 = cfpq_data.rsa_from_text("S -> a S b | a b") 12 | rsa_2 = cfpq_data.rsa_from_text("S -> sco_r S sco | t_r S t | sco_r sco | t_r t") 13 | 14 | 15 | @pytest.mark.parametrize("cfg", [cfg_1, cfg_2]) 16 | def test_cnf_from_cfg(cfg): 17 | cnf = cfpq_data.cnf_from_cfg(cfg) 18 | for word in cnf.get_words(4): 19 | assert cnf.contains(word) and cfg.contains(word) 20 | 21 | 22 | @pytest.mark.parametrize("regex", [regex_1, regex_2]) 23 | def test_cnf_from_regex(regex): 24 | cnf = cfpq_data.cnf_from_regex(regex) 25 | for word in cnf.get_words(4): 26 | regex_word = map(lambda x: x.value, word) 27 | assert cnf.contains(word) and regex.accepts(regex_word) 28 | 29 | 30 | @pytest.mark.parametrize("rsa", [rsa_1, rsa_2]) 31 | def test_cnf_from_rsa(rsa): 32 | cnf = cfpq_data.cnf_from_rsa(rsa) 33 | cfg = cfpq_data.cfg_from_rsa(rsa) 34 | for word in cnf.get_words(4): 35 | assert cnf.contains(word) and cfg.contains(word) 36 | -------------------------------------------------------------------------------- /tests/grammars/generators/test_c_alias_grammar.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | 3 | import cfpq_data 4 | 5 | cfg_1 = cfpq_data.c_alias_grammar() 6 | expected_cfg_1 = cfpq_data.cfg_from_text( 7 | "S -> d_r V d\nV -> V1 V2 V3\nV1 -> \nV1 -> V2 a_r V1\nV2 -> \nV2 -> S\nV3 -> \nV3 -> a V2 V3" 8 | ) 9 | 10 | cfg_2 = cfpq_data.c_alias_grammar( 11 | assigment_labels=("assign", "assign_r"), dereference_labels=("deref", "deref_r") 12 | ) 13 | expected_cfg_2 = cfpq_data.cfg_from_text( 14 | "S -> deref_r V deref\nV -> V1 V2 V3\nV1 -> \nV1 -> V2 assign_r V1\nV2 -> \nV2 -> S\nV3 -> \nV3 -> assign V2 V3" 15 | ) 16 | 17 | 18 | @pytest.mark.parametrize( 19 | "grammar,expected_grammar", [(cfg_1, expected_cfg_1), (cfg_2, expected_cfg_2)] 20 | ) 21 | def test_c_alias_grammar(grammar, expected_grammar): 22 | for word in expected_grammar.get_words(4): 23 | assert grammar.contains(word) 24 | -------------------------------------------------------------------------------- /tests/grammars/generators/test_dyck_grammar.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | 3 | import cfpq_data 4 | 5 | cfg_1 = cfpq_data.dyck_grammar([("a", "b"), ("c", "d")]) 6 | expected_cfg_1 = cfpq_data.cfg_from_text("S -> epsilon | a S b S | c S d S") 7 | 8 | cfg_2 = cfpq_data.dyck_grammar([("a", "b"), ("c", "d")], eps=False) 9 | expected_cfg_2 = cfpq_data.cfg_from_text("S -> a b | c d | a S b S | c S d S") 10 | 11 | 12 | @pytest.mark.parametrize( 13 | "grammar,expected_grammar", [(cfg_1, expected_cfg_1), (cfg_2, expected_cfg_2)] 14 | ) 15 | def test_dyck_grammar(grammar, expected_grammar): 16 | for word in expected_grammar.get_words(4): 17 | assert grammar.contains(word) 18 | -------------------------------------------------------------------------------- /tests/grammars/generators/test_java_points_to_grammar.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | 3 | import cfpq_data 4 | 5 | cfg_1 = cfpq_data.java_points_to_grammar(["0"]) 6 | expected_cfg_1 = cfpq_data.cfg_from_text( 7 | """S -> PTh alloc 8 | PTh -> epsilon 9 | PTh -> assign PTh 10 | PTh -> load_0 Al store_0 PTh 11 | FT -> alloc_r FTh 12 | FTh -> epsilon 13 | FTh -> assign_r FTh 14 | FTh -> store_0_r Al load_0_r FTh 15 | Al -> S FT""" 16 | ) 17 | 18 | cfg_2 = cfpq_data.java_points_to_grammar(["0", "1"]) 19 | expected_cfg_2 = cfpq_data.cfg_from_text( 20 | """S -> PTh alloc 21 | PTh -> epsilon 22 | PTh -> assign PTh 23 | PTh -> load_0 Al store_0 PTh 24 | PTh -> load_1 Al store_1 PTh 25 | FT -> alloc_r FTh 26 | FTh -> epsilon 27 | FTh -> assign_r FTh 28 | FTh -> store_0_r Al load_0_r FTh 29 | FTh -> store_1_r Al load_1_r FTh 30 | Al -> S FT""" 31 | ) 32 | 33 | 34 | avrora = cfpq_data.download("avrora") 35 | cfg_avrora = cfpq_data.java_points_to_grammar_from_graph( 36 | cfpq_data.graph_from_csv(avrora) 37 | ) 38 | expected_productions_count_avrora = 1723 39 | 40 | eclipse = cfpq_data.download("eclipse") 41 | cfg_eclipse = cfpq_data.java_points_to_grammar_from_graph( 42 | cfpq_data.graph_from_csv(eclipse) 43 | ) 44 | expected_productions_count_eclipse = 1525 45 | 46 | 47 | @pytest.mark.parametrize( 48 | "grammar,expected_grammar", [(cfg_1, expected_cfg_1), (cfg_2, expected_cfg_2)] 49 | ) 50 | def test_java_points_to_grammar(grammar, expected_grammar): 51 | for word in expected_grammar.get_words(4): 52 | assert grammar.contains(word) 53 | 54 | 55 | @pytest.mark.parametrize( 56 | "grammar,expected_productions_count", 57 | [ 58 | (cfg_avrora, expected_productions_count_avrora), 59 | (cfg_eclipse, expected_productions_count_eclipse), 60 | ], 61 | ) 62 | def test_java_points_to_grammar_from_graph(grammar, expected_productions_count): 63 | assert len(grammar.productions) == expected_productions_count 64 | -------------------------------------------------------------------------------- /tests/grammars/generators/test_nested_parentheses_grammar.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | 3 | import cfpq_data 4 | 5 | cfg_1 = cfpq_data.nested_parentheses_grammar([("a", "b"), ("c", "d")]) 6 | expected_cfg_1 = cfpq_data.cfg_from_text("S -> epsilon | a S b | c S d") 7 | 8 | cfg_2 = cfpq_data.nested_parentheses_grammar([("a", "b"), ("c", "d")], eps=False) 9 | expected_cfg_2 = cfpq_data.cfg_from_text("S -> a b | c d | a S b | c S d") 10 | 11 | 12 | @pytest.mark.parametrize( 13 | "grammar,expected_grammar", [(cfg_1, expected_cfg_1), (cfg_2, expected_cfg_2)] 14 | ) 15 | def test_nested_parentheses_grammar(grammar, expected_grammar): 16 | for word in expected_grammar.get_words(4): 17 | assert grammar.contains(word) 18 | -------------------------------------------------------------------------------- /tests/grammars/readwrite/test_cfg_readwrite.py: -------------------------------------------------------------------------------- 1 | import os 2 | import tempfile 3 | 4 | import pytest 5 | 6 | import cfpq_data 7 | 8 | grammar_1 = "S -> a S b S\nS -> \n" 9 | grammar_2 = "S -> a S\nS -> \n" 10 | 11 | 12 | @pytest.mark.parametrize( 13 | "grammar, expected", 14 | [ 15 | (grammar_1, "S -> \nS -> a S b S"), 16 | (grammar_2, "S -> \nS -> a S"), 17 | ], 18 | ) 19 | def test_cfg_from_text(grammar, expected): 20 | cfg = cfpq_data.cfg_from_text(grammar) 21 | 22 | assert cfpq_data.cfg_to_text(cfg) == expected 23 | 24 | 25 | @pytest.mark.parametrize( 26 | "grammar, expected", 27 | [ 28 | (grammar_1, {"S -> a S b S", "S -> "}), 29 | (grammar_2, {"S -> a S", "S -> "}), 30 | ], 31 | ) 32 | def test_cfg_to_text(grammar, expected): 33 | cfg = cfpq_data.cfg_from_text(grammar) 34 | 35 | actual = set(cfpq_data.cfg_to_text(cfg).splitlines()) 36 | 37 | assert actual == expected 38 | 39 | 40 | @pytest.mark.parametrize( 41 | "grammar", 42 | [ 43 | grammar_1, 44 | grammar_2, 45 | ], 46 | ) 47 | def test_cfg_from_and_to_txt(grammar): 48 | (fd, fname) = tempfile.mkstemp() 49 | 50 | cfg_1 = cfpq_data.cfg_from_text(grammar) 51 | 52 | path = cfpq_data.cfg_to_txt(cfg_1, fname) 53 | 54 | cfg_2 = cfpq_data.cfg_from_txt(path) 55 | 56 | os.close(fd) 57 | os.unlink(fname) 58 | 59 | assert set(cfpq_data.cfg_to_text(cfg_1).splitlines()) == set( 60 | cfpq_data.cfg_to_text(cfg_2).splitlines() 61 | ) 62 | -------------------------------------------------------------------------------- /tests/grammars/readwrite/test_cnf_readwrite.py: -------------------------------------------------------------------------------- 1 | import os 2 | import tempfile 3 | 4 | import pytest 5 | 6 | import cfpq_data 7 | 8 | grammar_1 = "\n".join(["S -> A B", "A -> a", "B -> b", "S -> epsilon"]) 9 | grammar_2 = "\n".join(["S -> A S", "A -> A A", "A -> a", "S -> epsilon"]) 10 | 11 | 12 | @pytest.mark.parametrize( 13 | "grammar", 14 | [ 15 | grammar_1, 16 | grammar_2, 17 | ], 18 | ) 19 | def test_cnf_from_and_to_txt(grammar): 20 | (fd, fname) = tempfile.mkstemp() 21 | 22 | cnf_1 = cfpq_data.cnf_from_text(grammar) 23 | 24 | path = cfpq_data.cfg_to_txt(cnf_1, fname) 25 | 26 | cnf_2 = cfpq_data.cnf_from_txt(path) 27 | 28 | os.close(fd) 29 | os.unlink(fname) 30 | 31 | assert set(cfpq_data.cfg_to_text(cnf_1).splitlines()) == set( 32 | cfpq_data.cfg_to_text(cnf_2).splitlines() 33 | ) 34 | -------------------------------------------------------------------------------- /tests/grammars/readwrite/test_regex_readwrite.py: -------------------------------------------------------------------------------- 1 | import os 2 | import tempfile 3 | 4 | import pytest 5 | 6 | import cfpq_data 7 | 8 | expression_1 = "abc|d*" 9 | expression_2 = "a (bc|d*)" 10 | 11 | 12 | @pytest.mark.parametrize( 13 | "expression, expected, not_expected", 14 | [ 15 | (expression_1, [["abc"], ["d", "d", "d"], []], [["a"], ["a", "d"]]), 16 | ( 17 | expression_2, 18 | [["a"], ["a", "bc"], ["a", "d", "d"]], 19 | [[], ["bc"], ["a", "bc", "d"]], 20 | ), 21 | ], 22 | ) 23 | def test_cfg_from_text(expression, expected, not_expected): 24 | regex = cfpq_data.regex_from_text(expression) 25 | 26 | for word in expected: 27 | assert regex.accepts(word) 28 | 29 | for word in not_expected: 30 | assert not regex.accepts(word) 31 | 32 | 33 | @pytest.mark.parametrize( 34 | "expression, expected", 35 | [ 36 | (expression_1, "(abc|(d)*)"), 37 | (expression_2, "(a (bc|(d)*))"), 38 | ], 39 | ) 40 | def test_regex_to_text(expression, expected): 41 | regex = cfpq_data.regex_from_text(expression) 42 | 43 | assert cfpq_data.regex_to_text(regex) == expected 44 | 45 | 46 | @pytest.mark.parametrize( 47 | "expression", 48 | [ 49 | expression_1, 50 | expression_2, 51 | ], 52 | ) 53 | def test_regex_from_and_to_txt(expression): 54 | (fd, fname) = tempfile.mkstemp() 55 | 56 | regex_1 = cfpq_data.regex_from_text(expression) 57 | 58 | path = cfpq_data.regex_to_txt(regex_1, fname) 59 | 60 | regex_2 = cfpq_data.regex_from_txt(path) 61 | 62 | os.close(fd) 63 | os.unlink(fname) 64 | 65 | assert cfpq_data.regex_to_text(regex_1) == cfpq_data.regex_to_text(regex_2) 66 | -------------------------------------------------------------------------------- /tests/grammars/readwrite/test_rsa_readwrite.py: -------------------------------------------------------------------------------- 1 | import os 2 | import tempfile 3 | 4 | import pytest 5 | 6 | import cfpq_data 7 | 8 | grammar_1 = "S -> a b" 9 | grammar_2 = "S -> a" 10 | grammar_3 = "S -> a\nS -> b" 11 | grammar_4 = "S -> \n#comment" 12 | 13 | 14 | @pytest.mark.parametrize( 15 | "grammar, expected", 16 | [ 17 | (grammar_1, ["ab"]), 18 | (grammar_2, ["a"]), 19 | (grammar_3, ["a", "b"]), 20 | (grammar_4, [""]), 21 | ], 22 | ) 23 | def test_rsa_from_text(grammar, expected): 24 | rsa = cfpq_data.rsa_from_text(grammar) 25 | cfg_from_rsa = cfpq_data.cfg_from_rsa(rsa) 26 | 27 | for word in expected: 28 | if word is not None: 29 | assert cfg_from_rsa.contains(word) 30 | 31 | 32 | @pytest.mark.parametrize( 33 | "grammar, expected", 34 | [ 35 | (grammar_1, {"S -> ($.(a.b))"}), 36 | (grammar_2, {"S -> ($.a)"}), 37 | (grammar_3, {"S -> ($.(a|b))", "S -> ($.(b|a))"}), 38 | (grammar_4, {"S -> $"}), 39 | ], 40 | ) 41 | def test_rsa_to_text(grammar, expected): 42 | rsa = cfpq_data.rsa_from_text(grammar) 43 | 44 | actual = set(cfpq_data.rsa_to_text(rsa).splitlines()) 45 | 46 | assert actual.issubset(expected) 47 | -------------------------------------------------------------------------------- /tests/grammars/utils/test_change_terminals.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | 3 | import cfpq_data 4 | 5 | cfg_1 = cfpq_data.cfg_from_text("S -> a S b S\nS -> a b\n") 6 | exp_cfg_1 = cfpq_data.cfg_from_text("S -> b S c S\nS -> b c\n") 7 | 8 | cfg_2 = cfpq_data.cfg_from_text("S -> a b c d\n") 9 | exp_cfg_2 = cfpq_data.cfg_from_text("S -> b c c d\n") 10 | 11 | cnf_1 = cfpq_data.cnf_from_text("S -> a") 12 | exp_cnf_1 = cfpq_data.cnf_from_text("S -> b") 13 | 14 | cnf_2 = cfpq_data.cnf_from_text("S -> b") 15 | exp_cnf_2 = cfpq_data.cnf_from_text("S -> c") 16 | 17 | regex_1 = cfpq_data.regex_from_text("(abc|(d)*)") 18 | exp_regex_1 = cfpq_data.regex_from_text("(bcc|(d)*)") 19 | 20 | regex_2 = cfpq_data.regex_from_text("(a (bc|(d)*))") 21 | exp_regex_2 = cfpq_data.regex_from_text("(b (cc|(d)*))") 22 | 23 | rsa_1 = cfpq_data.rsa_from_text("S -> a b\n") 24 | exp_rsa_1 = cfpq_data.rsa_from_text("S -> b c\n") 25 | 26 | rsa_2 = cfpq_data.rsa_from_text("S -> b a\n") 27 | exp_rsa_2 = cfpq_data.rsa_from_text("S -> c b\n") 28 | 29 | 30 | @pytest.mark.parametrize( 31 | "cfg, exp_cfg", 32 | [ 33 | (cfg_1, exp_cfg_1), 34 | (cfg_2, exp_cfg_2), 35 | ], 36 | ) 37 | def test_change_terminals_in_cfg(cfg, exp_cfg): 38 | act_cfg = cfpq_data.change_terminals_in_cfg(cfg, {"a": "b", "b": "c"}) 39 | assert set(cfpq_data.cfg_to_text(exp_cfg).split("\n")) == set( 40 | cfpq_data.cfg_to_text(act_cfg).split("\n") 41 | ) 42 | 43 | 44 | @pytest.mark.parametrize( 45 | "cnf, exp_cnf", 46 | [ 47 | (cnf_1, exp_cnf_1), 48 | (cnf_2, exp_cnf_2), 49 | ], 50 | ) 51 | def test_change_terminals_in_cnf(cnf, exp_cnf): 52 | act_cnf = cfpq_data.change_terminals_in_cnf(cnf, {"a": "b", "b": "c"}) 53 | assert set(cfpq_data.cfg_to_text(exp_cnf).split("\n")) == set( 54 | cfpq_data.cfg_to_text(act_cnf).split("\n") 55 | ) 56 | 57 | 58 | @pytest.mark.parametrize( 59 | "regex, exp_regex", 60 | [ 61 | (regex_1, exp_regex_1), 62 | (regex_2, exp_regex_2), 63 | ], 64 | ) 65 | def test_change_terminals_in_reg(regex, exp_regex): 66 | act_regex = cfpq_data.change_terminals_in_regex(regex, {"a": "b", "b": "c"}) 67 | assert cfpq_data.regex_to_text(exp_regex) == cfpq_data.regex_to_text(act_regex) 68 | 69 | 70 | @pytest.mark.parametrize( 71 | "rsa, exp_rsa", 72 | [ 73 | (rsa_1, exp_rsa_1), 74 | (rsa_2, exp_rsa_2), 75 | ], 76 | ) 77 | def test_change_terminals_in_rsa(rsa, exp_rsa): 78 | act_rsa = cfpq_data.change_terminals_in_rsa(rsa, {"a": "b", "b": "c"}) 79 | assert set(cfpq_data.rsa_to_text(exp_rsa).split("\n")) == set( 80 | cfpq_data.rsa_to_text(act_rsa).split("\n") 81 | ) 82 | -------------------------------------------------------------------------------- /tests/graphs/generators/test_fast_labeled_binomial_graph.py: -------------------------------------------------------------------------------- 1 | import random 2 | 3 | import pytest 4 | 5 | import cfpq_data 6 | 7 | seed = 42 8 | random.seed(seed) 9 | 10 | g1 = cfpq_data.fast_labeled_binomial_graph(29, 0.1, seed=seed) 11 | g2 = cfpq_data.fast_labeled_binomial_graph(42, 0.1, seed=seed) 12 | 13 | 14 | @pytest.mark.parametrize( 15 | "graph,expected_nodes,expected_edges", [(g1, 29, 85), (g2, 42, 177)] 16 | ) 17 | def test_fast_labeled_binomial_graph(graph, expected_nodes, expected_edges): 18 | assert graph.number_of_nodes() == expected_nodes 19 | assert graph.number_of_edges() == expected_edges 20 | -------------------------------------------------------------------------------- /tests/graphs/generators/test_labeled_barabasi_albert_graph.py: -------------------------------------------------------------------------------- 1 | import random 2 | 3 | import pytest 4 | 5 | import cfpq_data 6 | 7 | seed = 42 8 | random.seed(seed) 9 | 10 | g1 = cfpq_data.labeled_barabasi_albert_graph(100, 1, seed=seed) 11 | g2 = cfpq_data.labeled_barabasi_albert_graph(100, 3, seed=seed) 12 | 13 | 14 | @pytest.mark.parametrize( 15 | "graph,expected_nodes,expected_edges", [(g1, 100, 198), (g2, 100, 582)] 16 | ) 17 | def test_labeled_barabasi_albert_graph(graph, expected_nodes, expected_edges): 18 | assert graph.number_of_nodes() == expected_nodes 19 | assert graph.number_of_edges() == expected_edges 20 | -------------------------------------------------------------------------------- /tests/graphs/generators/test_labeled_binomial_graph.py: -------------------------------------------------------------------------------- 1 | import random 2 | 3 | import pytest 4 | 5 | import cfpq_data 6 | 7 | seed = 42 8 | random.seed(seed) 9 | 10 | g1 = cfpq_data.labeled_binomial_graph(42, 0.42, seed=seed) 11 | g2 = cfpq_data.labeled_binomial_graph(42, 0.73, seed=seed) 12 | 13 | 14 | @pytest.mark.parametrize( 15 | "graph,expected_nodes,expected_edges", [(g1, 42, 692), (g2, 42, 1255)] 16 | ) 17 | def test_labeled_binomial_graph(graph, expected_nodes, expected_edges): 18 | assert graph.number_of_nodes() == expected_nodes 19 | assert graph.number_of_edges() == expected_edges 20 | -------------------------------------------------------------------------------- /tests/graphs/generators/test_labeled_cycle_graph.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | 3 | import cfpq_data 4 | 5 | g1 = cfpq_data.labeled_cycle_graph(29) 6 | g2 = cfpq_data.labeled_cycle_graph(42) 7 | 8 | 9 | @pytest.mark.parametrize( 10 | "graph,expected_nodes,expected_edges", [(g1, 29, 29), (g2, 42, 42)] 11 | ) 12 | def test_labeled_cycle_graph(graph, expected_nodes, expected_edges): 13 | assert graph.number_of_nodes() == expected_nodes 14 | assert graph.number_of_edges() == expected_edges 15 | -------------------------------------------------------------------------------- /tests/graphs/generators/test_labeled_scale_free_graph.py: -------------------------------------------------------------------------------- 1 | import random 2 | 3 | import pytest 4 | 5 | import cfpq_data 6 | 7 | seed = 42 8 | random.seed(seed) 9 | 10 | g1 = cfpq_data.labeled_scale_free_graph(29, seed=seed) 11 | g2 = cfpq_data.labeled_scale_free_graph(42, seed=seed) 12 | 13 | 14 | @pytest.mark.parametrize( 15 | "graph,expected_nodes,expected_edges", [(g1, 29, 54), (g2, 42, 81)] 16 | ) 17 | def test_labeled_scale_free_graph(graph, expected_nodes, expected_edges): 18 | assert graph.number_of_nodes() == expected_nodes 19 | assert graph.number_of_edges() == expected_edges 20 | -------------------------------------------------------------------------------- /tests/graphs/generators/test_labeled_two_cycles_graph.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | 3 | import cfpq_data 4 | 5 | g1 = cfpq_data.labeled_two_cycles_graph(42, 29) 6 | g2 = cfpq_data.labeled_two_cycles_graph(84, 58) 7 | 8 | 9 | @pytest.mark.parametrize( 10 | "graph,expected_nodes,expected_edges", [(g1, 72, 73), (g2, 143, 144)] 11 | ) 12 | def test_labeled_two_cycles_graph(graph, expected_nodes, expected_edges): 13 | assert graph.number_of_nodes() == expected_nodes 14 | assert graph.number_of_edges() == expected_edges 15 | -------------------------------------------------------------------------------- /tests/graphs/readwrite/test_rdf.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | import pytest 4 | 5 | import cfpq_data 6 | 7 | 8 | @pytest.mark.parametrize( 9 | "graph_name", 10 | [ 11 | "people", 12 | "foaf", 13 | "pizza", 14 | "core", 15 | ], 16 | ) 17 | def test_rdf(graph_name): 18 | path_csv = cfpq_data.download(graph_name) 19 | graph_csv = cfpq_data.graph_from_csv(path_csv) 20 | 21 | path_rdf = cfpq_data.graph_to_rdf(graph_csv, "test.ttl") 22 | graph_rdf = cfpq_data.graph_from_rdf(path_rdf) 23 | 24 | os.remove("test.ttl") 25 | 26 | assert graph_csv.number_of_nodes() == graph_rdf.number_of_nodes() 27 | assert graph_csv.number_of_edges() == graph_rdf.number_of_edges() 28 | 29 | 30 | def test_nodes(): 31 | tmp = cfpq_data.graph_from_text(["1 A 2"]) 32 | path = cfpq_data.graph_to_rdf(tmp, "test.ttl") 33 | g = cfpq_data.graph_from_rdf(path) 34 | 35 | os.remove("test.ttl") 36 | 37 | assert tmp.number_of_nodes() == g.number_of_nodes() 38 | assert tmp.number_of_edges() == g.number_of_edges() 39 | -------------------------------------------------------------------------------- /tests/graphs/readwrite/test_txt.py: -------------------------------------------------------------------------------- 1 | from itertools import product 2 | import os 3 | import random 4 | 5 | import networkx as nx 6 | import pytest 7 | 8 | import cfpq_data 9 | 10 | seed = 42 11 | random.seed(seed) 12 | 13 | g1 = cfpq_data.labeled_binomial_graph(42, 0.42, seed=seed) 14 | g2 = cfpq_data.labeled_binomial_graph(42, 0.73, seed=seed) 15 | g3 = cfpq_data.graph_from_text(["1 A 2"]) 16 | 17 | 18 | @pytest.mark.parametrize( 19 | "graph, quoting", 20 | list( 21 | product( 22 | [ 23 | g1, 24 | g2, 25 | g3, 26 | ], 27 | [True, False], 28 | ) 29 | ), 30 | ) 31 | def test_txt(graph, quoting): 32 | path = cfpq_data.graph_to_txt(graph, "test.txt", quoting=quoting) 33 | gin = cfpq_data.graph_from_txt(path) 34 | 35 | os.remove("test.txt") 36 | 37 | assert graph.number_of_nodes() == gin.number_of_nodes() 38 | assert graph.number_of_edges() == gin.number_of_edges() 39 | 40 | 41 | @pytest.mark.parametrize( 42 | "graph, quoting", 43 | list( 44 | product( 45 | [ 46 | ["1 A 2"], 47 | ["1 A 2", "2 B 3"], 48 | ], 49 | [True, False], 50 | ) 51 | ), 52 | ) 53 | def test_text(graph, quoting): 54 | g = cfpq_data.graph_from_text(graph) 55 | text = cfpq_data.graph_to_text(g, quoting=quoting) 56 | gin = cfpq_data.graph_from_text(text) 57 | 58 | assert g.number_of_nodes() == gin.number_of_nodes() 59 | assert g.number_of_edges() == gin.number_of_edges() 60 | 61 | 62 | def test_text_format(): 63 | with pytest.raises(ValueError): 64 | cfpq_data.graph_from_text(["1 2 3 4"]) 65 | -------------------------------------------------------------------------------- /tests/graphs/utils/test_add_reverse_edges.py: -------------------------------------------------------------------------------- 1 | import random 2 | 3 | import pytest 4 | 5 | import cfpq_data 6 | 7 | seed = 42 8 | random.seed(seed) 9 | 10 | g1 = cfpq_data.labeled_barabasi_albert_graph(42, 3, seed=seed, labels="a") 11 | g2 = cfpq_data.labeled_binomial_graph(42, 0.73, seed=seed, labels=["a"]) 12 | g3 = cfpq_data.labeled_two_cycles_graph(42, 29) 13 | 14 | rg1 = cfpq_data.add_reverse_edges(g1) 15 | rg2 = cfpq_data.add_reverse_edges(g2, mapping={"a": "b"}) 16 | rg3 = cfpq_data.add_reverse_edges(g3) 17 | 18 | 19 | @pytest.mark.parametrize( 20 | "graph,expected_nodes,expected_edges", 21 | [ 22 | (rg1, g1.number_of_nodes(), 2 * g1.number_of_edges()), 23 | (rg2, g2.number_of_nodes(), 2 * g2.number_of_edges()), 24 | (rg3, g3.number_of_nodes(), 2 * g3.number_of_edges()), 25 | ], 26 | ) 27 | def test_add_reverse_edges(graph, expected_nodes, expected_edges): 28 | assert ( 29 | graph.number_of_nodes() == expected_nodes 30 | and graph.number_of_edges() == expected_edges 31 | ) 32 | -------------------------------------------------------------------------------- /tests/graphs/utils/test_change_edges.py: -------------------------------------------------------------------------------- 1 | import random 2 | 3 | import pytest 4 | 5 | import cfpq_data 6 | 7 | seed = 42 8 | random.seed(seed) 9 | 10 | g1 = cfpq_data.labeled_barabasi_albert_graph(42, 3, seed=seed, labels="a") 11 | g2 = cfpq_data.labeled_binomial_graph(42, 0.73, seed=seed, labels=["a"]) 12 | g3 = cfpq_data.labeled_two_cycles_graph(42, 29) 13 | 14 | rg1 = cfpq_data.change_edges(g1, {"a": "b"}) 15 | rg2 = cfpq_data.change_edges(g2, {"a": "b"}) 16 | rg3 = cfpq_data.change_edges(g3, {"b": "c"}) 17 | 18 | 19 | @pytest.mark.parametrize( 20 | "graph,expected_nodes,expected_edges", 21 | [ 22 | (rg1, g1.number_of_nodes(), g1.number_of_edges()), 23 | (rg2, g2.number_of_nodes(), g2.number_of_edges()), 24 | (rg3, g3.number_of_nodes(), g3.number_of_edges()), 25 | ], 26 | ) 27 | def test_change_edges(graph, expected_nodes, expected_edges): 28 | assert ( 29 | graph.number_of_nodes() == expected_nodes 30 | and graph.number_of_edges() == expected_edges 31 | ) 32 | -------------------------------------------------------------------------------- /tests/graphs/utils/test_edges_statistics.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | 3 | import cfpq_data 4 | 5 | g1 = cfpq_data.labeled_two_cycles_graph(42, 29) 6 | g2 = cfpq_data.labeled_cycle_graph(42) 7 | g3 = cfpq_data.labeled_two_cycles_graph(42, 42, labels=("b", "a")) 8 | 9 | 10 | @pytest.mark.parametrize( 11 | "graph,expected_frequency", 12 | [ 13 | (g1, {"a": 43, "b": 30}), 14 | (g2, {"a": 42}), 15 | (g3, {"a": 43, "b": 43}), 16 | ], 17 | ) 18 | def test_get_labels_frequency(graph, expected_frequency): 19 | assert cfpq_data.get_labels_frequency(graph) == expected_frequency 20 | 21 | 22 | @pytest.mark.parametrize( 23 | "graph,expected_list", 24 | [(g1, ["a", "b"]), (g2, ["a"]), (g3, ["a", "b"])], 25 | ) 26 | def test_get_sorted_labels(graph, expected_list): 27 | assert cfpq_data.get_sorted_labels(graph) == expected_list 28 | -------------------------------------------------------------------------------- /tests/graphs/utils/test_filter_edges.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | 3 | import cfpq_data 4 | 5 | g1 = cfpq_data.labeled_two_cycles_graph(42, 29) 6 | g2 = cfpq_data.labeled_cycle_graph(42) 7 | 8 | rg1 = cfpq_data.filter_edges(g1, ["a"]) 9 | rg2 = cfpq_data.filter_edges(g2, ["a"]) 10 | 11 | 12 | @pytest.mark.parametrize( 13 | "graph,expected_nodes,expected_edges", 14 | [ 15 | (rg1, g1.number_of_nodes(), 43), 16 | (rg2, g2.number_of_nodes(), 42), 17 | ], 18 | ) 19 | def test_change_edges(graph, expected_nodes, expected_edges): 20 | assert ( 21 | graph.number_of_nodes() == expected_nodes 22 | and graph.number_of_edges() == expected_edges 23 | ) 24 | -------------------------------------------------------------------------------- /tests/graphs/utils/test_nodes_to_integers.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | 3 | import cfpq_data 4 | 5 | foaf = cfpq_data.download("foaf") 6 | core = cfpq_data.download("core") 7 | 8 | g1 = cfpq_data.graph_from_csv(foaf) 9 | g2 = cfpq_data.graph_from_csv(core) 10 | 11 | 12 | @pytest.mark.parametrize( 13 | "graph", 14 | [ 15 | g1, 16 | g2, 17 | ], 18 | ) 19 | def test_nodes_to_integers(graph): 20 | actual = list(cfpq_data.nodes_to_integers(graph).nodes()) 21 | 22 | expected = list(range(graph.number_of_nodes())) 23 | 24 | assert actual == expected 25 | -------------------------------------------------------------------------------- /utils/config.py: -------------------------------------------------------------------------------- 1 | from pathlib import Path 2 | 3 | MAIN_FOLDER = Path(__file__).parent.parent 4 | -------------------------------------------------------------------------------- /utils/fetch_dataset.py: -------------------------------------------------------------------------------- 1 | import re 2 | from collections import defaultdict 3 | from json import dumps 4 | 5 | from boto3 import client 6 | 7 | from cfpq_data import __version__ as VERSION 8 | from cfpq_data.config import AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, BUCKET_NAME 9 | from config import MAIN_FOLDER 10 | 11 | 12 | def fetch_dataset(): 13 | DATASET_VERSION = VERSION 14 | 15 | if re.match(r"^(\d+)\.(\d+)\.(\d+)$", DATASET_VERSION) is not None: 16 | DATASET_VERSION = ( 17 | str(re.match(r"^(\d+)\.(\d+)\.(\d+)$", DATASET_VERSION).group(1)) + ".0.0" 18 | ) 19 | 20 | s3 = client( 21 | "s3", 22 | aws_access_key_id=AWS_ACCESS_KEY_ID, 23 | aws_secret_access_key=AWS_SECRET_ACCESS_KEY, 24 | ) 25 | 26 | dataset = defaultdict(dict) 27 | 28 | for graph in s3.list_objects(Bucket="cfpq-data", Prefix=DATASET_VERSION)[ 29 | "Contents" 30 | ]: 31 | graph_key = graph["Key"] 32 | graph_class, graph_full_name = graph_key.split("/")[1:] 33 | graph_name = graph_full_name.split(".")[0] 34 | graph_file_extension = "." + graph_full_name.split(".")[1] 35 | graph_archive_extension = graph_full_name.split(graph_file_extension)[1] 36 | dataset[graph_class][graph_name] = { 37 | "VersionId": s3.head_object(Bucket=BUCKET_NAME, Key=graph_key)["VersionId"], 38 | "FileExtension": graph_file_extension, 39 | "ArchiveExtension": graph_archive_extension, 40 | } 41 | 42 | return dataset 43 | 44 | 45 | def update_dataset(dataset): 46 | with open(MAIN_FOLDER / "cfpq_data" / "dataset.py", "w") as fout: 47 | fout.write("DATASET = " + dumps(dataset, indent=4)) 48 | 49 | 50 | if __name__ == "__main__": 51 | dataset = fetch_dataset() 52 | update_dataset(dataset) 53 | -------------------------------------------------------------------------------- /utils/update_dataset_tables.py: -------------------------------------------------------------------------------- 1 | from csv import DictWriter, QUOTE_MINIMAL 2 | 3 | from cfpq_data import graph_from_dataset 4 | from cfpq_data.dataset import DATASET 5 | from config import MAIN_FOLDER 6 | 7 | 8 | def update_dataset_tables(dataset): 9 | for graph_class in dataset.keys(): 10 | table = list() 11 | fieldnames = ["Graph", "#Vertices", "#Edges"] 12 | 13 | for graph_name in dataset[graph_class]: 14 | graph = graph_from_dataset(graph_name) 15 | table.append( 16 | [ 17 | graph_name, 18 | f"{graph.number_of_nodes():,}", 19 | f"{graph.number_of_edges():,}", 20 | ] 21 | ) 22 | 23 | table.sort(key=lambda row: int(row[2].replace(",", ""))) 24 | 25 | with open( 26 | MAIN_FOLDER / "docs" / "dataset" / f"{graph_class}.csv", mode="w" 27 | ) as csv_file: 28 | csv_writer = DictWriter( 29 | csv_file, 30 | fieldnames=fieldnames, 31 | delimiter=";", 32 | quotechar='"', 33 | quoting=QUOTE_MINIMAL, 34 | ) 35 | csv_writer.writeheader() 36 | 37 | for row in table: 38 | csv_writer.writerow( 39 | dict( 40 | zip( 41 | fieldnames, 42 | row, 43 | ) 44 | ) 45 | ) 46 | 47 | 48 | if __name__ == "__main__": 49 | update_dataset_tables(DATASET) 50 | --------------------------------------------------------------------------------