├── .checkignore
├── .gitattributes
├── .github
├── ISSUE_TEMPLATE
│ ├── bug_report.md
│ ├── feature_request.md
│ └── help-wanted.md
└── workflows
│ ├── ci.yml
│ ├── pypi-publish.yml
│ ├── sphinx-build.yml
│ └── testing_pr.yml
├── .gitignore
├── .pylintrc
├── .travis.yml
├── LICENSE
├── README.md
├── code_formatter.sh
├── docs
├── .nojekyll
├── Makefile
├── index.html
├── make_rst.sh
└── source
│ ├── LICENSE.rst
│ ├── _summaries
│ ├── grape.fault_diagnosis.FaultDiagnosis.apply_perturbation.rst
│ ├── grape.fault_diagnosis.FaultDiagnosis.check_input_with_gephi.rst
│ ├── grape.fault_diagnosis.FaultDiagnosis.check_paths_and_measures.rst
│ ├── grape.fault_diagnosis.FaultDiagnosis.delete_a_node.rst
│ ├── grape.fault_diagnosis.FaultDiagnosis.fitness_evaluation.rst
│ ├── grape.fault_diagnosis.FaultDiagnosis.fitness_evaluation_parallel.rst
│ ├── grape.fault_diagnosis.FaultDiagnosis.fitness_iteration_parallel.rst
│ ├── grape.fault_diagnosis.FaultDiagnosis.graph_characterization_to_file.rst
│ ├── grape.fault_diagnosis.FaultDiagnosis.optimizer.rst
│ ├── grape.fault_diagnosis.FaultDiagnosis.rm_nodes.rst
│ ├── grape.fault_diagnosis.FaultDiagnosis.rst
│ ├── grape.fault_diagnosis.FaultDiagnosis.simulate_area_perturbation.rst
│ ├── grape.fault_diagnosis.FaultDiagnosis.simulate_element_perturbation.rst
│ ├── grape.fault_diagnosis.FaultDiagnosis.update_output.rst
│ ├── grape.fault_diagnosis.FaultDiagnosis.update_status_areas.rst
│ ├── grape.general_graph.GeneralGraph.area.rst
│ ├── grape.general_graph.GeneralGraph.betweenness_centrality.rst
│ ├── grape.general_graph.GeneralGraph.betweenness_centrality_kernel.rst
│ ├── grape.general_graph.GeneralGraph.calculate_shortest_path.rst
│ ├── grape.general_graph.GeneralGraph.clear_data.rst
│ ├── grape.general_graph.GeneralGraph.closeness_centrality.rst
│ ├── grape.general_graph.GeneralGraph.closeness_centrality_kernel.rst
│ ├── grape.general_graph.GeneralGraph.compute_betweenness_centrality.rst
│ ├── grape.general_graph.GeneralGraph.compute_closeness_centrality.rst
│ ├── grape.general_graph.GeneralGraph.compute_degree_centrality.rst
│ ├── grape.general_graph.GeneralGraph.compute_efficiency.rst
│ ├── grape.general_graph.GeneralGraph.compute_indegree_centrality.rst
│ ├── grape.general_graph.GeneralGraph.compute_local_efficiency.rst
│ ├── grape.general_graph.GeneralGraph.compute_nodal_efficiency.rst
│ ├── grape.general_graph.GeneralGraph.compute_outdegree_centrality.rst
│ ├── grape.general_graph.GeneralGraph.compute_service.rst
│ ├── grape.general_graph.GeneralGraph.construct_path_kernel.rst
│ ├── grape.general_graph.GeneralGraph.degree_centrality.rst
│ ├── grape.general_graph.GeneralGraph.degree_centrality_kernel.rst
│ ├── grape.general_graph.GeneralGraph.description.rst
│ ├── grape.general_graph.GeneralGraph.dijkstra_single_source_shortest_path.rst
│ ├── grape.general_graph.GeneralGraph.efficiency.rst
│ ├── grape.general_graph.GeneralGraph.efficiency_kernel.rst
│ ├── grape.general_graph.GeneralGraph.father_condition.rst
│ ├── grape.general_graph.GeneralGraph.final_status.rst
│ ├── grape.general_graph.GeneralGraph.floyd_warshall_initialization.rst
│ ├── grape.general_graph.GeneralGraph.floyd_warshall_kernel.rst
│ ├── grape.general_graph.GeneralGraph.floyd_warshall_predecessor_and_distance.rst
│ ├── grape.general_graph.GeneralGraph.global_efficiency.rst
│ ├── grape.general_graph.GeneralGraph.indegree_centrality.rst
│ ├── grape.general_graph.GeneralGraph.indegree_centrality_kernel.rst
│ ├── grape.general_graph.GeneralGraph.init_status.rst
│ ├── grape.general_graph.GeneralGraph.initial_service.rst
│ ├── grape.general_graph.GeneralGraph.load.rst
│ ├── grape.general_graph.GeneralGraph.local_efficiency.rst
│ ├── grape.general_graph.GeneralGraph.local_efficiency_kernel.rst
│ ├── grape.general_graph.GeneralGraph.mark.rst
│ ├── grape.general_graph.GeneralGraph.mark_status.rst
│ ├── grape.general_graph.GeneralGraph.nodal_efficiency.rst
│ ├── grape.general_graph.GeneralGraph.nodal_efficiency_kernel.rst
│ ├── grape.general_graph.GeneralGraph.outdegree_centrality.rst
│ ├── grape.general_graph.GeneralGraph.outdegree_centrality_kernel.rst
│ ├── grape.general_graph.GeneralGraph.perturbation_resistant.rst
│ ├── grape.general_graph.GeneralGraph.rst
│ ├── grape.general_graph.GeneralGraph.service.rst
│ ├── grape.general_graph.GeneralGraph.shortest_path.rst
│ ├── grape.general_graph.GeneralGraph.shortest_path_length.rst
│ ├── grape.general_graph.GeneralGraph.shortest_path_list_kernel.rst
│ ├── grape.general_graph.GeneralGraph.sources.rst
│ ├── grape.general_graph.GeneralGraph.status_area.rst
│ ├── grape.general_graph.GeneralGraph.switches.rst
│ ├── grape.general_graph.GeneralGraph.type.rst
│ ├── grape.general_graph.GeneralGraph.users.rst
│ ├── grape.general_graph.GeneralGraph.weight.rst
│ ├── grape.parallel_general_graph.ParallelGeneralGraph.calculate_shortest_path.rst
│ ├── grape.parallel_general_graph.ParallelGeneralGraph.compute_betweenness_centrality.rst
│ ├── grape.parallel_general_graph.ParallelGeneralGraph.compute_closeness_centrality.rst
│ ├── grape.parallel_general_graph.ParallelGeneralGraph.compute_degree_centrality.rst
│ ├── grape.parallel_general_graph.ParallelGeneralGraph.compute_efficiency.rst
│ ├── grape.parallel_general_graph.ParallelGeneralGraph.compute_indegree_centrality.rst
│ ├── grape.parallel_general_graph.ParallelGeneralGraph.compute_local_efficiency.rst
│ ├── grape.parallel_general_graph.ParallelGeneralGraph.compute_nodal_efficiency.rst
│ ├── grape.parallel_general_graph.ParallelGeneralGraph.compute_outdegree_centrality.rst
│ ├── grape.parallel_general_graph.ParallelGeneralGraph.dijkstra_iteration_parallel.rst
│ ├── grape.parallel_general_graph.ParallelGeneralGraph.dijkstra_single_source_shortest_path.rst
│ ├── grape.parallel_general_graph.ParallelGeneralGraph.floyd_warshall_predecessor_and_distance.rst
│ ├── grape.parallel_general_graph.ParallelGeneralGraph.measure_iteration.rst
│ ├── grape.parallel_general_graph.ParallelGeneralGraph.measure_processes.rst
│ ├── grape.parallel_general_graph.ParallelGeneralGraph.rst
│ ├── grape.parallel_general_graph.ParallelGeneralGraph.shortest_path_list_iteration.rst
│ └── grape.utils.chunk_it.rst
│ ├── code.rst
│ ├── conf.py
│ ├── contact.rst
│ ├── contributing.rst
│ ├── fault_diagnosis.rst
│ ├── general_code_output.log
│ ├── general_graph.rst
│ ├── index.rst
│ ├── parallel_general_graph.rst
│ └── utils.rst
├── grape
├── __init__.py
├── fault_diagnosis.py
├── general_graph.py
├── meta.py
├── parallel_general_graph.py
└── utils.py
├── readme
├── logo_grape_resized.pdf
└── logo_grape_resized.png
├── setup.py
├── tests
├── TOY_graph.csv
├── TOY_graph_one_node.csv
├── __init__.py
├── general_graph.py
├── test_fault_diagnosis.py
├── test_input_graph.py
├── test_integer_graph.py
├── test_parallel_integer_graph.py
└── test_shortest_path.py
└── tutorials
├── README.md
├── tutorial01
├── 01_element_perturbation.ipynb
├── 01_element_perturbation.py
├── input_files
│ └── TOY_graph.csv
└── output_files
│ ├── check_import_edges.csv
│ ├── check_import_nodes.csv
│ ├── element_perturbation.csv
│ ├── results_generations.dat
│ └── service_paths_element_perturbation.csv
├── tutorial02
├── 02_multi_element_perturbation.ipynb
├── 02_multi_element_perturbation.py
├── input_files
│ └── TOY_graph.csv
└── output_files
│ ├── check_import_edges.csv
│ ├── check_import_nodes.csv
│ ├── element_perturbation.csv
│ ├── results_generations.dat
│ └── service_paths_element_perturbation.csv
└── tutorial03
├── 03_switch_activation.ipynb
├── 03_switch_activation.py
├── input_files
├── TOY_graph.csv
├── switch_line.csv
├── switch_state.png
└── switch_state_alltrue.png
└── output_files
├── check_import_edges.csv
├── check_import_nodes.csv
├── element_perturbation.csv
├── results_generations.dat
└── service_paths_element_perturbation.csv
/.checkignore:
--------------------------------------------------------------------------------
1 | # Ignore folder content
2 | tests/*
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | tutorials/** linguist-vendored=true
2 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug report
3 | about: Create a report to help us improve
4 | title: ''
5 | labels: bug
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Describe the bug**
11 | A clear and concise description of what the bug is.
12 |
13 | **To Reproduce**
14 | The piece of code that reproduce the bug.
15 |
16 | **Expected behavior**
17 | A clear and concise description of what you expected to happen.
18 |
19 | **Output**
20 | The obtained output. Please include the entire error trace.
21 |
22 | **Additional context**
23 | Add any other context about the problem here.
24 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Feature request
3 | about: Suggest an idea for this project
4 | title: ''
5 | labels: enhancement
6 | assignees: ''
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/help-wanted.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Help wanted
3 | about: Ask help for using the package
4 | title: ''
5 | labels: help wanted
6 | assignees: ''
7 |
8 | ---
9 |
10 | **The objective**
11 | A clear description of the purpose of your application.
12 |
13 | **Already tried tests**
14 | The snippet of code you have already tried in order to obtain the wanted outcome.
15 |
--------------------------------------------------------------------------------
/.github/workflows/ci.yml:
--------------------------------------------------------------------------------
1 | name: "Coverage Deploy to Codacy"
2 |
3 | on:
4 | push:
5 | branches:
6 | - master
7 |
8 | jobs:
9 | test_deploy:
10 | runs-on: ubuntu-latest
11 |
12 | steps:
13 | - uses: actions/checkout@v2
14 |
15 |
16 | - name: Set up Python
17 | uses: actions/setup-python@v2
18 | with:
19 | python-version: 3.8
20 |
21 | - name: Install Python dependencies
22 | run: |
23 | python3 -m pip install --upgrade pip
24 | python3 -m pip install numpy scipy matplotlib pytest pytest-cov future networkx pandas deap
25 |
26 | - name: Test with pytest
27 | env:
28 | CODACY_API_TOKEN: ${{ secrets.CODACY_API_TOKEN }}
29 | shell: bash
30 | run: |
31 | python3 -m pytest --cov-report term --cov-report xml:cobertura.xml --cov=grape
32 | curl -s https://coverage.codacy.com/get.sh -o CodacyCoverageReporter.sh
33 | chmod +x CodacyCoverageReporter.sh
34 | ./CodacyCoverageReporter.sh report -r cobertura.xml -t $CODACY_API_TOKEN
35 |
--------------------------------------------------------------------------------
/.github/workflows/pypi-publish.yml:
--------------------------------------------------------------------------------
1 | name: "PYPI Publish"
2 |
3 | on:
4 | push:
5 | tags:
6 | - "*"
7 |
8 | jobs:
9 | docs:
10 | runs-on: ubuntu-18.04
11 | steps:
12 | - uses: actions/checkout@v2
13 |
14 | - name: Set up Python 3.7
15 | uses: actions/setup-python@v1
16 | with:
17 | python-version: 3.7
18 |
19 | - name: Install build
20 | run: >-
21 | python -m pip install build --user
22 |
23 | - name: Build a binary wheel and a source tarball
24 | run: >-
25 | python -m build --sdist --wheel --outdir dist/ .
26 |
27 | - name: Publish distribution to PyPI
28 | if: startsWith(github.ref, 'refs/tags')
29 | uses: pypa/gh-action-pypi-publish@master
30 | with:
31 | password: ${{ secrets.PYPI }}
32 |
--------------------------------------------------------------------------------
/.github/workflows/sphinx-build.yml:
--------------------------------------------------------------------------------
1 | name: "Pull Request Docs Check"
2 |
3 | on:
4 | push:
5 | tags:
6 | - "*"
7 |
8 | jobs:
9 | docs:
10 | runs-on: ubuntu-18.04
11 | steps:
12 | - uses: actions/checkout@v2
13 |
14 | - name: Create the new documentation
15 | uses: ammaraskar/sphinx-action@master
16 | with:
17 | pre-build-command: "python -m pip install pip sphinx_rtd_theme networkx numpy scipy future matplotlib pandas deap -U"
18 | docs-folder: "docs/"
19 |
20 | - name: Deploy
21 | uses: peaceiris/actions-gh-pages@v3
22 | with:
23 | github_token: ${{ secrets.GITHUB_TOKEN }}
24 | #deploy_key: ${{ secrets.DEPLOY_PRIVATE_KEY }}
25 | publish_dir: ./docs/build/html
26 | allow_empty_commit: true
27 |
--------------------------------------------------------------------------------
/.github/workflows/testing_pr.yml:
--------------------------------------------------------------------------------
1 | name: "Testing Pull Request"
2 |
3 | on:
4 | pull_request:
5 | branches:
6 | - "master"
7 |
8 |
9 | jobs:
10 | build:
11 | runs-on: ${{ matrix.os }}
12 | strategy:
13 | fail-fast: false
14 | matrix:
15 | os: [windows-latest, macos-latest, ubuntu-latest]
16 | python-version: [3.7, 3.8]
17 |
18 | steps:
19 | - uses: actions/checkout@v2
20 |
21 |
22 | - name: Set up Python
23 | uses: actions/setup-python@v2
24 | with:
25 | python-version: ${{ matrix.python-version }}
26 |
27 | - name: Install Python dependencies
28 | run: |
29 | python3 -m pip install --upgrade pip
30 | python3 -m pip install .[test]
31 |
32 | - name: Test with pytest
33 | run: |
34 | python3 -m pytest
35 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # mac file systems
2 | .DS_Store
3 |
4 | # compiled python codes
5 | *.pyc
6 |
7 | build/
8 | dist/
9 | grape.egg-info/
10 | grape/__pycache__/
11 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | sudo: true
2 | dist: trusty
3 |
4 | language: python
5 |
6 | matrix:
7 | include:
8 | - os: linux
9 | python: 3.6
10 | env: TOXENV=py36
11 |
12 | before_script:
13 | - "export DISPLAY=:99.0"
14 | - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
15 | sh -e /etc/init.d/xvfb start;
16 | sleep 3;
17 | fi
18 |
19 | before_install:
20 | # We do this conditionally because it saves us some downloading if the
21 | # version is the same.
22 | - if [[ "$TRAVIS_PYTHON_VERSION" == "3.6" ]]; then
23 | wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh;
24 | fi
25 | - python --version
26 | - chmod +x miniconda.sh
27 | - bash miniconda.sh -b -p $HOME/miniconda
28 | - export PATH="$HOME/miniconda/bin:$HOME/miniconda/lib:$PATH"
29 | - hash -r
30 | - conda config --set always_yes yes --set changeps1 no
31 | - conda update -q conda
32 | # Useful for debugging any issues with conda
33 | - conda info -a
34 | - conda config --add channels conda-forge
35 |
36 | install:
37 | - conda create --yes -n test python=$TRAVIS_PYTHON_VERSION
38 | - source activate test
39 | - pip install coverage numpy scipy matplotlib networkx nose coveralls pandas deap
40 | - python setup.py install
41 |
42 | script:
43 | - coverage run test.py
44 |
45 | after_success:
46 | - coveralls
47 |
48 | branches:
49 | only:
50 | - master
51 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2019 SISSA mathLab
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 | **GRAPE**: GRAph Parallel Environment
24 |
25 | ## Table of contents
26 |
27 | * [Description](#description)
28 | * [Dependencies and installation](#dependencies-and-installation)
29 | * [Installing from pip](#installing-from-pip)
30 | * [Installing from source](#installing-from-source)
31 | * [Documentation](#documentation)
32 | * [Testing](#testing)
33 | * [Authors and contributors](#authors-and-contributors)
34 | * [How to contribute](#how-to-contribute)
35 | * [Submitting a patch](#submitting-a-patch)
36 | * [License](#license)
37 |
38 | ## Description
39 |
40 | **GRAPE** (GRAph Parallel Environment) is a Python package that takes advantage of **Graph Theory** into a *High Performance Computing* (HPC) environment to develope a screening tool aimed at studying the effect of different kinds of perturbations in interconnected systems, such as industrial plants.
41 |
42 | The package represents the dependencies between graph elements and predicts the effects of a perturbation. The results obtained from the graph analysis can be therefore used to improve the robustness, and resilience profile of industrial facilities against domino effect propagation.
43 |
44 | In particular, the contribution to the cascade effects resulting from adverse events can be evaluated through centrality and efficiency measures, highlighting the plants major criticalities, vulnerabilities and potential weak points.
45 |
46 | Considering that the most computationally expensive parts of the program involve the calculation of shortest paths, parallelization of shortest path computation in large unweighted graphs was integrated in the program. This was done taking advantage of the Python modules multiprocessing and threading. Two different sequential algorithms for the solution of the shortest path problem have been parallelized including a Single Source Shortest Path (SSSP) algorithm for sparse graphs and an All Pairs Shortest Path one (APSP) for dense graphs.
47 |
48 | We acknowledge Aurora Maurizio for her substantial contributions to this package, including the conception of the algorithm and the implementation of the original code.
49 |
50 | ## Dependencies and installation
51 |
52 | **GRAPE** requires `numpy`, `scipy`, `matplotlib`, `networkx`, `deap`,
53 | `pandas`, `pytest` (for local test) and `sphinx` (to generate the documentation).
54 | The code is compatible with Python 3.6, NetworkX 2.5, Pandas 1.1 and DEAP 1.3.
55 |
56 | ### Installing from pip
57 | To install the latest release of the package, which corresponds to the online documentation, just type:
58 | ```bash
59 | > pip install grape-mathlab
60 | ```
61 |
62 | ### Installing from source
63 | The official distribution is on GitHub, and you can clone the repository using
64 |
65 | ```bash
66 | > git clone https://github.com/mathLab/GRAPE
67 | ```
68 |
69 | To install the package just type:
70 |
71 | ```bash
72 | > pip install -e .
73 | ```
74 |
75 | To uninstall the package you have to rerun the installation and record the installed files in order to remove them:
76 |
77 | ```bash
78 | > pip uninstall grape-mathlab
79 | ```
80 |
81 | ## Documentation
82 |
83 | **GRAPE** uses [Sphinx](http://www.sphinx-doc.org/en/stable/) for code documentation. To build the html versions of the docs simply:
84 |
85 | ```bash
86 | > cd docs
87 | > make html
88 | ```
89 |
90 | The generated html can be found in `docs/build/html`. Open up the `index.html` you find there to browse.
91 |
92 | ## Testing
93 |
94 | We are using Travis CI for continuous intergration testing. You can check out the current status [here](https://github.com/mathLab/GRAPE/actions/workflows/testing_pr.yml).
95 |
96 |
97 | To run tests locally:
98 |
99 | ```bash
100 | > pytest
101 | ```
102 |
103 |
104 |
105 | ## Authors and contributors
106 |
107 | **GRAPE** is currently developed and mantained at [SISSA mathLab](http://mathlab.sissa.it/) by
108 |
109 | - [Aurora Maurizio](mailto:auroramaurizio1@gmail.com)
110 | - [Teruzzi Martina](mailto:teruzzi.martina@gmail.com)
111 | - [Nicola Demo](mailto:demo.nicola@gmail.com)
112 |
113 | under the supervision of [Prof. Gianluigi Rozza](mailto:gianluigi.rozza@sissa.it).
114 |
115 | Contact us by email for further information or questions about **GRAPE**, or
116 | suggest pull requests. **GRAPE** is at an early development stage, so
117 | contributions improving either the code or the documentation are welcome!
118 |
119 | ## How to contribute
120 |
121 | We'd love to accept your patches and contributions to this project. There are
122 | just a few small guidelines you need to follow.
123 |
124 | ### Submitting a patch
125 |
126 | 1. It's generally best to start by opening a new issue describing the bug or
127 | feature you're intending to fix. Even if you think it's relatively minor,
128 | it's helpful to know what people are working on. Mention in the initial issue
129 | that you are planning to work on that bug or feature so that it can be assigned
130 | to you.
131 |
132 | 2. Follow the normal process of [forking][] the project, and setup a new
133 | branch to work in. It's important that each group of changes be done in
134 | separate branches in order to ensure that a pull request only includes the
135 | commits related to that bug or feature.
136 |
137 | 3. To ensure properly formatted code, please make sure to use 4
138 | spaces to indent the code. The easy way is to run on your bash the provided
139 | script: ./code_formatter.sh. You should also run [pylint][] over your code.
140 | It's not strictly necessary that your code be completely "lint-free",
141 | but this will help you find common style issues.
142 |
143 | 4. Any significant changes should almost always be accompanied by tests. The
144 | project already has good test coverage, so look at some of the existing
145 | tests if you're unsure how to go about it. We're using [coveralls][] that
146 | is an invaluable tools for seeing which parts of your code aren't being
147 | exercised by your tests.
148 |
149 | 5. Do your best to have [well-formed commit messages][] for each change.
150 | This provides consistency throughout the project, and ensures that commit
151 | messages are able to be formatted properly by various git tools.
152 |
153 | 6. Finally, push the commits to your fork and submit a [pull request][]. Please,
154 | remember to rebase properly in order to maintain a clean, linear git history.
155 |
156 | [forking]: https://help.github.com/articles/fork-a-repo
157 | [pylint]: https://www.pylint.org/
158 | [coveralls]: https://coveralls.io
159 | [well-formed commit messages]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
160 | [pull request]: https://help.github.com/articles/creating-a-pull-request
161 |
162 | ## License
163 |
164 | See the [LICENSE](LICENSE.rst) file for license rights and limitations (MIT).
165 |
--------------------------------------------------------------------------------
/code_formatter.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | #######################################
4 |
5 | required_command="yapf unexpand"
6 | code_directories="grape tests"
7 |
8 | #######################################
9 |
10 | usage() {
11 | echo
12 | echo -e "\tUsage: $0 [files]"
13 | echo
14 | echo -e "\tIf not files are specified, script formats all ".py" files"
15 | echo -e "\tin code directories ($code_directories); otherwise, formats"
16 | echo -e "\tall given files"
17 | echo
18 | echo -e "\tRequired command: $required_command"
19 | echo
20 | exit 0
21 | }
22 |
23 |
24 | [[ $1 == "-h" ]] && usage
25 |
26 | # Test for required program
27 | for comm in $required_command; do
28 | command -v $comm >/dev/null 2>&1 || {
29 | echo "I require $comm but it's not installed. Aborting." >&2;
30 | exit 1
31 | }
32 | done
33 |
34 | # Find all python files in code directories
35 | python_files=""
36 | for dir in $code_directories; do
37 | python_files="$python_files $(find $dir -name '*.py')"
38 | done
39 | [[ $# != 0 ]] && python_files=$@
40 |
41 |
42 | # Here the important part: yapf format the files.
43 | for file in $python_files; do
44 | echo "Making beatiful $file..."
45 | [[ ! -f $file ]] && echo "$file does not exist; $0 -h for more info" && exit
46 |
47 | yapf --style='{
48 | based_on_style: pep8,
49 | indent_width: 4,
50 | column_limit: 80
51 | }' -i $file
52 | done
53 |
--------------------------------------------------------------------------------
/docs/.nojekyll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mathLab/GRAPE/f9ed0f5d5c757817ee38fa06b7de2788ad86470c/docs/.nojekyll
--------------------------------------------------------------------------------
/docs/Makefile:
--------------------------------------------------------------------------------
1 | # Makefile for Sphinx documentation
2 | #
3 |
4 | # You can set these variables from the command line.
5 | SPHINXOPTS =
6 | SPHINXBUILD = sphinx-build
7 | PAPER =
8 | BUILDDIR = build
9 |
10 | # User-friendly check for sphinx-build
11 | ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
12 | $(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don\'t have Sphinx installed, grab it from http://sphinx-doc.org/)
13 | endif
14 |
15 | # Internal variables.
16 | PAPEROPT_a4 = -D latex_paper_size=a4
17 | PAPEROPT_letter = -D latex_paper_size=letter
18 | ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
19 | # the i18n builder cannot share the environment and doctrees with the others
20 | I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
21 |
22 | .PHONY: help
23 | help:
24 | @echo "Please use \`make ' where is one of"
25 | @echo " html to make standalone HTML files"
26 | @echo " dirhtml to make HTML files named index.html in directories"
27 | @echo " singlehtml to make a single large HTML file"
28 | @echo " pickle to make pickle files"
29 | @echo " json to make JSON files"
30 | @echo " htmlhelp to make HTML files and a HTML help project"
31 | @echo " qthelp to make HTML files and a qthelp project"
32 | @echo " applehelp to make an Apple Help Book"
33 | @echo " devhelp to make HTML files and a Devhelp project"
34 | @echo " epub to make an epub"
35 | @echo " epub3 to make an epub3"
36 | @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
37 | @echo " latexpdf to make LaTeX files and run them through pdflatex"
38 | @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
39 | @echo " text to make text files"
40 | @echo " man to make manual pages"
41 | @echo " texinfo to make Texinfo files"
42 | @echo " info to make Texinfo files and run them through makeinfo"
43 | @echo " gettext to make PO message catalogs"
44 | @echo " changes to make an overview of all changed/added/deprecated items"
45 | @echo " xml to make Docutils-native XML files"
46 | @echo " pseudoxml to make pseudoxml-XML files for display purposes"
47 | @echo " linkcheck to check all external links for integrity"
48 | @echo " doctest to run all doctests embedded in the documentation (if enabled)"
49 | @echo " coverage to run coverage check of the documentation (if enabled)"
50 |
51 | .PHONY: clean
52 | clean:
53 | rm -rf $(BUILDDIR)/*
54 |
55 | .PHONY: html
56 | html:
57 | $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
58 | @echo
59 | @echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
60 |
61 | .PHONY: dirhtml
62 | dirhtml:
63 | $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
64 | @echo
65 | @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
66 |
67 | .PHONY: singlehtml
68 | singlehtml:
69 | $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
70 | @echo
71 | @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
72 |
73 | .PHONY: pickle
74 | pickle:
75 | $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
76 | @echo
77 | @echo "Build finished; now you can process the pickle files."
78 |
79 | .PHONY: json
80 | json:
81 | $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
82 | @echo
83 | @echo "Build finished; now you can process the JSON files."
84 |
85 | .PHONY: htmlhelp
86 | htmlhelp:
87 | $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
88 | @echo
89 | @echo "Build finished; now you can run HTML Help Workshop with the" \
90 | ".hhp project file in $(BUILDDIR)/htmlhelp."
91 |
92 | .PHONY: qthelp
93 | qthelp:
94 | $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
95 | @echo
96 | @echo "Build finished; now you can run "qcollectiongenerator" with the" \
97 | ".qhcp project file in $(BUILDDIR)/qthelp, like this:"
98 | @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/GRAPE.qhcp"
99 | @echo "To view the help file:"
100 | @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/GRAPE.qhc"
101 |
102 | .PHONY: applehelp
103 | applehelp:
104 | $(SPHINXBUILD) -b applehelp $(ALLSPHINXOPTS) $(BUILDDIR)/applehelp
105 | @echo
106 | @echo "Build finished. The help book is in $(BUILDDIR)/applehelp."
107 | @echo "N.B. You won't be able to view it unless you put it in" \
108 | "~/Library/Documentation/Help or install it in your application" \
109 | "bundle."
110 |
111 | .PHONY: devhelp
112 | devhelp:
113 | $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
114 | @echo
115 | @echo "Build finished."
116 | @echo "To view the help file:"
117 | @echo "# mkdir -p $$HOME/.local/share/devhelp/GRAPE"
118 | @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/GRAPE"
119 | @echo "# devhelp"
120 |
121 | .PHONY: epub
122 | epub:
123 | $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
124 | @echo
125 | @echo "Build finished. The epub file is in $(BUILDDIR)/epub."
126 |
127 | .PHONY: epub3
128 | epub3:
129 | $(SPHINXBUILD) -b epub3 $(ALLSPHINXOPTS) $(BUILDDIR)/epub3
130 | @echo
131 | @echo "Build finished. The epub3 file is in $(BUILDDIR)/epub3."
132 |
133 | .PHONY: latex
134 | latex:
135 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
136 | @echo
137 | @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
138 | @echo "Run \`make' in that directory to run these through (pdf)latex" \
139 | "(use \`make latexpdf' here to do that automatically)."
140 |
141 | .PHONY: latexpdf
142 | latexpdf:
143 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
144 | @echo "Running LaTeX files through pdflatex..."
145 | $(MAKE) -C $(BUILDDIR)/latex all-pdf
146 | @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
147 |
148 | .PHONY: latexpdfja
149 | latexpdfja:
150 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
151 | @echo "Running LaTeX files through platex and dvipdfmx..."
152 | $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
153 | @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
154 |
155 | .PHONY: text
156 | text:
157 | $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
158 | @echo
159 | @echo "Build finished. The text files are in $(BUILDDIR)/text."
160 |
161 | .PHONY: man
162 | man:
163 | $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
164 | @echo
165 | @echo "Build finished. The manual pages are in $(BUILDDIR)/man."
166 |
167 | .PHONY: texinfo
168 | texinfo:
169 | $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
170 | @echo
171 | @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
172 | @echo "Run \`make' in that directory to run these through makeinfo" \
173 | "(use \`make info' here to do that automatically)."
174 |
175 | .PHONY: info
176 | info:
177 | $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
178 | @echo "Running Texinfo files through makeinfo..."
179 | make -C $(BUILDDIR)/texinfo info
180 | @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
181 |
182 | .PHONY: gettext
183 | gettext:
184 | $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
185 | @echo
186 | @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
187 |
188 | .PHONY: changes
189 | changes:
190 | $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
191 | @echo
192 | @echo "The overview file is in $(BUILDDIR)/changes."
193 |
194 | .PHONY: linkcheck
195 | linkcheck:
196 | $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
197 | @echo
198 | @echo "Link check complete; look for any errors in the above output " \
199 | "or in $(BUILDDIR)/linkcheck/output.txt."
200 |
201 | .PHONY: doctest
202 | doctest:
203 | $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
204 | @echo "Testing of doctests in the sources finished, look at the " \
205 | "results in $(BUILDDIR)/doctest/output.txt."
206 |
207 | .PHONY: coverage
208 | coverage:
209 | $(SPHINXBUILD) -b coverage $(ALLSPHINXOPTS) $(BUILDDIR)/coverage
210 | @echo "Testing of coverage in the sources finished, look at the " \
211 | "results in $(BUILDDIR)/coverage/python.txt."
212 |
213 | .PHONY: xml
214 | xml:
215 | $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
216 | @echo
217 | @echo "Build finished. The XML files are in $(BUILDDIR)/xml."
218 |
219 | .PHONY: pseudoxml
220 | pseudoxml:
221 | $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
222 | @echo
223 | @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."
224 |
--------------------------------------------------------------------------------
/docs/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/docs/make_rst.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | ################################################################################
3 | ## Bash file for the automatic creation of .RST file ##
4 | ## ##
5 | ## This script does not work on modules that not contains class definition ##
6 | ################################################################################
7 |
8 | module='grape'
9 |
10 | files=`ls ../$module/[a-z]*.py`
11 |
12 | for f in $files; do
13 |
14 | filename=$(basename $f .py)
15 |
16 | classname=`grep "class.*(.*):$" $f | awk '{print $2}' | cut -d"(" -f 1`
17 | [[ -z $classname ]] && echo "WARNING: class not found in file $f"
18 |
19 | methodnames=`grep -e 'def .*(.*):$' $f | awk '{print $2}' | cut -d "(" -f 1`
20 | [[ -z $classname ]] && echo "WARNING: methods not found in file $f"
21 |
22 | methodnames=`sed -r 's/\b(__init__|__new__)\b//g' <<< $methodnames`
23 |
24 | output="source/$filename.rst"
25 |
26 | echo -e "$classname" > $output
27 | echo -e "=====================" >> $output
28 | echo -e "" >> $output
29 | echo -e ".. currentmodule:: $module.$filename" >> $output
30 | echo -e "" >> $output
31 | echo -e ".. automodule:: $module.$filename" >> $output
32 | echo -e "" >> $output
33 | echo -e ".. autosummary::" >> $output
34 | echo -e " :toctree: _summaries" >> $output
35 | echo -e " :nosignatures:" >> $output
36 | echo -e "" >> $output
37 | echo -e " $classname" >> $output
38 | for methodname in $methodnames; do
39 | echo -e " $classname.$methodname" >> $output
40 | done
41 | echo -e "" >> $output
42 | echo -e ".. autoclass:: $classname" >> $output
43 | echo -e " :members:" >> $output
44 | echo -e " :private-members:" >> $output
45 | echo -e " :undoc-members:" >> $output
46 | echo -e " :show-inheritance:" >> $output
47 | echo -e " :noindex:" >> $output
48 |
49 | cat $output
50 | done
51 |
--------------------------------------------------------------------------------
/docs/source/LICENSE.rst:
--------------------------------------------------------------------------------
1 | License
2 | ==============
3 |
4 | .. include:: ../../LICENSE
5 |
--------------------------------------------------------------------------------
/docs/source/_summaries/grape.fault_diagnosis.FaultDiagnosis.apply_perturbation.rst:
--------------------------------------------------------------------------------
1 | grape.fault\_diagnosis.FaultDiagnosis.apply\_perturbation
2 | =========================================================
3 |
4 | .. currentmodule:: grape.fault_diagnosis
5 |
6 | .. automethod:: FaultDiagnosis.apply_perturbation
--------------------------------------------------------------------------------
/docs/source/_summaries/grape.fault_diagnosis.FaultDiagnosis.check_input_with_gephi.rst:
--------------------------------------------------------------------------------
1 | grape.fault\_diagnosis.FaultDiagnosis.check\_input\_with\_gephi
2 | ===============================================================
3 |
4 | .. currentmodule:: grape.fault_diagnosis
5 |
6 | .. automethod:: FaultDiagnosis.check_input_with_gephi
--------------------------------------------------------------------------------
/docs/source/_summaries/grape.fault_diagnosis.FaultDiagnosis.check_paths_and_measures.rst:
--------------------------------------------------------------------------------
1 | grape.fault\_diagnosis.FaultDiagnosis.check\_paths\_and\_measures
2 | =================================================================
3 |
4 | .. currentmodule:: grape.fault_diagnosis
5 |
6 | .. automethod:: FaultDiagnosis.check_paths_and_measures
--------------------------------------------------------------------------------
/docs/source/_summaries/grape.fault_diagnosis.FaultDiagnosis.delete_a_node.rst:
--------------------------------------------------------------------------------
1 | grape.fault\_diagnosis.FaultDiagnosis.delete\_a\_node
2 | =====================================================
3 |
4 | .. currentmodule:: grape.fault_diagnosis
5 |
6 | .. automethod:: FaultDiagnosis.delete_a_node
--------------------------------------------------------------------------------
/docs/source/_summaries/grape.fault_diagnosis.FaultDiagnosis.fitness_evaluation.rst:
--------------------------------------------------------------------------------
1 | grape.fault\_diagnosis.FaultDiagnosis.fitness\_evaluation
2 | =========================================================
3 |
4 | .. currentmodule:: grape.fault_diagnosis
5 |
6 | .. automethod:: FaultDiagnosis.fitness_evaluation
--------------------------------------------------------------------------------
/docs/source/_summaries/grape.fault_diagnosis.FaultDiagnosis.fitness_evaluation_parallel.rst:
--------------------------------------------------------------------------------
1 | grape.fault\_diagnosis.FaultDiagnosis.fitness\_evaluation\_parallel
2 | ===================================================================
3 |
4 | .. currentmodule:: grape.fault_diagnosis
5 |
6 | .. automethod:: FaultDiagnosis.fitness_evaluation_parallel
--------------------------------------------------------------------------------
/docs/source/_summaries/grape.fault_diagnosis.FaultDiagnosis.fitness_iteration_parallel.rst:
--------------------------------------------------------------------------------
1 | grape.fault\_diagnosis.FaultDiagnosis.fitness\_iteration\_parallel
2 | ==================================================================
3 |
4 | .. currentmodule:: grape.fault_diagnosis
5 |
6 | .. automethod:: FaultDiagnosis.fitness_iteration_parallel
--------------------------------------------------------------------------------
/docs/source/_summaries/grape.fault_diagnosis.FaultDiagnosis.graph_characterization_to_file.rst:
--------------------------------------------------------------------------------
1 | grape.fault\_diagnosis.FaultDiagnosis.graph\_characterization\_to\_file
2 | =======================================================================
3 |
4 | .. currentmodule:: grape.fault_diagnosis
5 |
6 | .. automethod:: FaultDiagnosis.graph_characterization_to_file
--------------------------------------------------------------------------------
/docs/source/_summaries/grape.fault_diagnosis.FaultDiagnosis.optimizer.rst:
--------------------------------------------------------------------------------
1 | grape.fault\_diagnosis.FaultDiagnosis.optimizer
2 | ===============================================
3 |
4 | .. currentmodule:: grape.fault_diagnosis
5 |
6 | .. automethod:: FaultDiagnosis.optimizer
--------------------------------------------------------------------------------
/docs/source/_summaries/grape.fault_diagnosis.FaultDiagnosis.rm_nodes.rst:
--------------------------------------------------------------------------------
1 | grape.fault\_diagnosis.FaultDiagnosis.rm\_nodes
2 | ===============================================
3 |
4 | .. currentmodule:: grape.fault_diagnosis
5 |
6 | .. automethod:: FaultDiagnosis.rm_nodes
--------------------------------------------------------------------------------
/docs/source/_summaries/grape.fault_diagnosis.FaultDiagnosis.rst:
--------------------------------------------------------------------------------
1 | grape.fault\_diagnosis.FaultDiagnosis
2 | =====================================
3 |
4 | .. currentmodule:: grape.fault_diagnosis
5 |
6 | .. autoclass:: FaultDiagnosis
7 |
8 |
9 | .. automethod:: __init__
10 |
11 |
12 | .. rubric:: Methods
13 |
14 | .. autosummary::
15 |
16 | ~FaultDiagnosis.__init__
17 | ~FaultDiagnosis.apply_perturbation
18 | ~FaultDiagnosis.check_input_with_gephi
19 | ~FaultDiagnosis.check_paths_and_measures
20 | ~FaultDiagnosis.delete_a_node
21 | ~FaultDiagnosis.fitness_evaluation
22 | ~FaultDiagnosis.fitness_evaluation_parallel
23 | ~FaultDiagnosis.fitness_iteration_parallel
24 | ~FaultDiagnosis.graph_characterization_to_file
25 | ~FaultDiagnosis.optimizer
26 | ~FaultDiagnosis.rm_nodes
27 | ~FaultDiagnosis.simulate_area_perturbation
28 | ~FaultDiagnosis.simulate_element_perturbation
29 | ~FaultDiagnosis.update_output
30 | ~FaultDiagnosis.update_status_areas
31 |
32 |
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/docs/source/_summaries/grape.fault_diagnosis.FaultDiagnosis.simulate_area_perturbation.rst:
--------------------------------------------------------------------------------
1 | grape.fault\_diagnosis.FaultDiagnosis.simulate\_area\_perturbation
2 | ==================================================================
3 |
4 | .. currentmodule:: grape.fault_diagnosis
5 |
6 | .. automethod:: FaultDiagnosis.simulate_area_perturbation
--------------------------------------------------------------------------------
/docs/source/_summaries/grape.fault_diagnosis.FaultDiagnosis.simulate_element_perturbation.rst:
--------------------------------------------------------------------------------
1 | grape.fault\_diagnosis.FaultDiagnosis.simulate\_element\_perturbation
2 | =====================================================================
3 |
4 | .. currentmodule:: grape.fault_diagnosis
5 |
6 | .. automethod:: FaultDiagnosis.simulate_element_perturbation
--------------------------------------------------------------------------------
/docs/source/_summaries/grape.fault_diagnosis.FaultDiagnosis.update_output.rst:
--------------------------------------------------------------------------------
1 | grape.fault\_diagnosis.FaultDiagnosis.update\_output
2 | ====================================================
3 |
4 | .. currentmodule:: grape.fault_diagnosis
5 |
6 | .. automethod:: FaultDiagnosis.update_output
--------------------------------------------------------------------------------
/docs/source/_summaries/grape.fault_diagnosis.FaultDiagnosis.update_status_areas.rst:
--------------------------------------------------------------------------------
1 | grape.fault\_diagnosis.FaultDiagnosis.update\_status\_areas
2 | ===========================================================
3 |
4 | .. currentmodule:: grape.fault_diagnosis
5 |
6 | .. automethod:: FaultDiagnosis.update_status_areas
--------------------------------------------------------------------------------
/docs/source/_summaries/grape.general_graph.GeneralGraph.area.rst:
--------------------------------------------------------------------------------
1 | grape.general\_graph.GeneralGraph.area
2 | ======================================
3 |
4 | .. currentmodule:: grape.general_graph
5 |
6 | .. autoproperty:: GeneralGraph.area
--------------------------------------------------------------------------------
/docs/source/_summaries/grape.general_graph.GeneralGraph.betweenness_centrality.rst:
--------------------------------------------------------------------------------
1 | grape.general\_graph.GeneralGraph.betweenness\_centrality
2 | =========================================================
3 |
4 | .. currentmodule:: grape.general_graph
5 |
6 | .. autoproperty:: GeneralGraph.betweenness_centrality
--------------------------------------------------------------------------------
/docs/source/_summaries/grape.general_graph.GeneralGraph.betweenness_centrality_kernel.rst:
--------------------------------------------------------------------------------
1 | grape.general\_graph.GeneralGraph.betweenness\_centrality\_kernel
2 | =================================================================
3 |
4 | .. currentmodule:: grape.general_graph
5 |
6 | .. automethod:: GeneralGraph.betweenness_centrality_kernel
--------------------------------------------------------------------------------
/docs/source/_summaries/grape.general_graph.GeneralGraph.calculate_shortest_path.rst:
--------------------------------------------------------------------------------
1 | grape.general\_graph.GeneralGraph.calculate\_shortest\_path
2 | ===========================================================
3 |
4 | .. currentmodule:: grape.general_graph
5 |
6 | .. automethod:: GeneralGraph.calculate_shortest_path
--------------------------------------------------------------------------------
/docs/source/_summaries/grape.general_graph.GeneralGraph.clear_data.rst:
--------------------------------------------------------------------------------
1 | grape.general\_graph.GeneralGraph.clear\_data
2 | =============================================
3 |
4 | .. currentmodule:: grape.general_graph
5 |
6 | .. automethod:: GeneralGraph.clear_data
--------------------------------------------------------------------------------
/docs/source/_summaries/grape.general_graph.GeneralGraph.closeness_centrality.rst:
--------------------------------------------------------------------------------
1 | grape.general\_graph.GeneralGraph.closeness\_centrality
2 | =======================================================
3 |
4 | .. currentmodule:: grape.general_graph
5 |
6 | .. autoproperty:: GeneralGraph.closeness_centrality
--------------------------------------------------------------------------------
/docs/source/_summaries/grape.general_graph.GeneralGraph.closeness_centrality_kernel.rst:
--------------------------------------------------------------------------------
1 | grape.general\_graph.GeneralGraph.closeness\_centrality\_kernel
2 | ===============================================================
3 |
4 | .. currentmodule:: grape.general_graph
5 |
6 | .. automethod:: GeneralGraph.closeness_centrality_kernel
--------------------------------------------------------------------------------
/docs/source/_summaries/grape.general_graph.GeneralGraph.compute_betweenness_centrality.rst:
--------------------------------------------------------------------------------
1 | grape.general\_graph.GeneralGraph.compute\_betweenness\_centrality
2 | ==================================================================
3 |
4 | .. currentmodule:: grape.general_graph
5 |
6 | .. automethod:: GeneralGraph.compute_betweenness_centrality
--------------------------------------------------------------------------------
/docs/source/_summaries/grape.general_graph.GeneralGraph.compute_closeness_centrality.rst:
--------------------------------------------------------------------------------
1 | grape.general\_graph.GeneralGraph.compute\_closeness\_centrality
2 | ================================================================
3 |
4 | .. currentmodule:: grape.general_graph
5 |
6 | .. automethod:: GeneralGraph.compute_closeness_centrality
--------------------------------------------------------------------------------
/docs/source/_summaries/grape.general_graph.GeneralGraph.compute_degree_centrality.rst:
--------------------------------------------------------------------------------
1 | grape.general\_graph.GeneralGraph.compute\_degree\_centrality
2 | =============================================================
3 |
4 | .. currentmodule:: grape.general_graph
5 |
6 | .. automethod:: GeneralGraph.compute_degree_centrality
--------------------------------------------------------------------------------
/docs/source/_summaries/grape.general_graph.GeneralGraph.compute_efficiency.rst:
--------------------------------------------------------------------------------
1 | grape.general\_graph.GeneralGraph.compute\_efficiency
2 | =====================================================
3 |
4 | .. currentmodule:: grape.general_graph
5 |
6 | .. automethod:: GeneralGraph.compute_efficiency
--------------------------------------------------------------------------------
/docs/source/_summaries/grape.general_graph.GeneralGraph.compute_indegree_centrality.rst:
--------------------------------------------------------------------------------
1 | grape.general\_graph.GeneralGraph.compute\_indegree\_centrality
2 | ===============================================================
3 |
4 | .. currentmodule:: grape.general_graph
5 |
6 | .. automethod:: GeneralGraph.compute_indegree_centrality
--------------------------------------------------------------------------------
/docs/source/_summaries/grape.general_graph.GeneralGraph.compute_local_efficiency.rst:
--------------------------------------------------------------------------------
1 | grape.general\_graph.GeneralGraph.compute\_local\_efficiency
2 | ============================================================
3 |
4 | .. currentmodule:: grape.general_graph
5 |
6 | .. automethod:: GeneralGraph.compute_local_efficiency
--------------------------------------------------------------------------------
/docs/source/_summaries/grape.general_graph.GeneralGraph.compute_nodal_efficiency.rst:
--------------------------------------------------------------------------------
1 | grape.general\_graph.GeneralGraph.compute\_nodal\_efficiency
2 | ============================================================
3 |
4 | .. currentmodule:: grape.general_graph
5 |
6 | .. automethod:: GeneralGraph.compute_nodal_efficiency
--------------------------------------------------------------------------------
/docs/source/_summaries/grape.general_graph.GeneralGraph.compute_outdegree_centrality.rst:
--------------------------------------------------------------------------------
1 | grape.general\_graph.GeneralGraph.compute\_outdegree\_centrality
2 | ================================================================
3 |
4 | .. currentmodule:: grape.general_graph
5 |
6 | .. automethod:: GeneralGraph.compute_outdegree_centrality
--------------------------------------------------------------------------------
/docs/source/_summaries/grape.general_graph.GeneralGraph.compute_service.rst:
--------------------------------------------------------------------------------
1 | grape.general\_graph.GeneralGraph.compute\_service
2 | ==================================================
3 |
4 | .. currentmodule:: grape.general_graph
5 |
6 | .. automethod:: GeneralGraph.compute_service
--------------------------------------------------------------------------------
/docs/source/_summaries/grape.general_graph.GeneralGraph.construct_path_kernel.rst:
--------------------------------------------------------------------------------
1 | grape.general\_graph.GeneralGraph.construct\_path\_kernel
2 | =========================================================
3 |
4 | .. currentmodule:: grape.general_graph
5 |
6 | .. automethod:: GeneralGraph.construct_path_kernel
--------------------------------------------------------------------------------
/docs/source/_summaries/grape.general_graph.GeneralGraph.degree_centrality.rst:
--------------------------------------------------------------------------------
1 | grape.general\_graph.GeneralGraph.degree\_centrality
2 | ====================================================
3 |
4 | .. currentmodule:: grape.general_graph
5 |
6 | .. autoproperty:: GeneralGraph.degree_centrality
--------------------------------------------------------------------------------
/docs/source/_summaries/grape.general_graph.GeneralGraph.degree_centrality_kernel.rst:
--------------------------------------------------------------------------------
1 | grape.general\_graph.GeneralGraph.degree\_centrality\_kernel
2 | ============================================================
3 |
4 | .. currentmodule:: grape.general_graph
5 |
6 | .. automethod:: GeneralGraph.degree_centrality_kernel
--------------------------------------------------------------------------------
/docs/source/_summaries/grape.general_graph.GeneralGraph.description.rst:
--------------------------------------------------------------------------------
1 | grape.general\_graph.GeneralGraph.description
2 | =============================================
3 |
4 | .. currentmodule:: grape.general_graph
5 |
6 | .. autoproperty:: GeneralGraph.description
--------------------------------------------------------------------------------
/docs/source/_summaries/grape.general_graph.GeneralGraph.dijkstra_single_source_shortest_path.rst:
--------------------------------------------------------------------------------
1 | grape.general\_graph.GeneralGraph.dijkstra\_single\_source\_shortest\_path
2 | ==========================================================================
3 |
4 | .. currentmodule:: grape.general_graph
5 |
6 | .. automethod:: GeneralGraph.dijkstra_single_source_shortest_path
--------------------------------------------------------------------------------
/docs/source/_summaries/grape.general_graph.GeneralGraph.efficiency.rst:
--------------------------------------------------------------------------------
1 | grape.general\_graph.GeneralGraph.efficiency
2 | ============================================
3 |
4 | .. currentmodule:: grape.general_graph
5 |
6 | .. autoproperty:: GeneralGraph.efficiency
--------------------------------------------------------------------------------
/docs/source/_summaries/grape.general_graph.GeneralGraph.efficiency_kernel.rst:
--------------------------------------------------------------------------------
1 | grape.general\_graph.GeneralGraph.efficiency\_kernel
2 | ====================================================
3 |
4 | .. currentmodule:: grape.general_graph
5 |
6 | .. automethod:: GeneralGraph.efficiency_kernel
--------------------------------------------------------------------------------
/docs/source/_summaries/grape.general_graph.GeneralGraph.father_condition.rst:
--------------------------------------------------------------------------------
1 | grape.general\_graph.GeneralGraph.father\_condition
2 | ===================================================
3 |
4 | .. currentmodule:: grape.general_graph
5 |
6 | .. autoproperty:: GeneralGraph.father_condition
--------------------------------------------------------------------------------
/docs/source/_summaries/grape.general_graph.GeneralGraph.final_status.rst:
--------------------------------------------------------------------------------
1 | grape.general\_graph.GeneralGraph.final\_status
2 | ===============================================
3 |
4 | .. currentmodule:: grape.general_graph
5 |
6 | .. autoproperty:: GeneralGraph.final_status
--------------------------------------------------------------------------------
/docs/source/_summaries/grape.general_graph.GeneralGraph.floyd_warshall_initialization.rst:
--------------------------------------------------------------------------------
1 | grape.general\_graph.GeneralGraph.floyd\_warshall\_initialization
2 | =================================================================
3 |
4 | .. currentmodule:: grape.general_graph
5 |
6 | .. automethod:: GeneralGraph.floyd_warshall_initialization
--------------------------------------------------------------------------------
/docs/source/_summaries/grape.general_graph.GeneralGraph.floyd_warshall_kernel.rst:
--------------------------------------------------------------------------------
1 | grape.general\_graph.GeneralGraph.floyd\_warshall\_kernel
2 | =========================================================
3 |
4 | .. currentmodule:: grape.general_graph
5 |
6 | .. automethod:: GeneralGraph.floyd_warshall_kernel
--------------------------------------------------------------------------------
/docs/source/_summaries/grape.general_graph.GeneralGraph.floyd_warshall_predecessor_and_distance.rst:
--------------------------------------------------------------------------------
1 | grape.general\_graph.GeneralGraph.floyd\_warshall\_predecessor\_and\_distance
2 | =============================================================================
3 |
4 | .. currentmodule:: grape.general_graph
5 |
6 | .. automethod:: GeneralGraph.floyd_warshall_predecessor_and_distance
--------------------------------------------------------------------------------
/docs/source/_summaries/grape.general_graph.GeneralGraph.global_efficiency.rst:
--------------------------------------------------------------------------------
1 | grape.general\_graph.GeneralGraph.global\_efficiency
2 | ====================================================
3 |
4 | .. currentmodule:: grape.general_graph
5 |
6 | .. autoproperty:: GeneralGraph.global_efficiency
--------------------------------------------------------------------------------
/docs/source/_summaries/grape.general_graph.GeneralGraph.indegree_centrality.rst:
--------------------------------------------------------------------------------
1 | grape.general\_graph.GeneralGraph.indegree\_centrality
2 | ======================================================
3 |
4 | .. currentmodule:: grape.general_graph
5 |
6 | .. autoproperty:: GeneralGraph.indegree_centrality
--------------------------------------------------------------------------------
/docs/source/_summaries/grape.general_graph.GeneralGraph.indegree_centrality_kernel.rst:
--------------------------------------------------------------------------------
1 | grape.general\_graph.GeneralGraph.indegree\_centrality\_kernel
2 | ==============================================================
3 |
4 | .. currentmodule:: grape.general_graph
5 |
6 | .. automethod:: GeneralGraph.indegree_centrality_kernel
--------------------------------------------------------------------------------
/docs/source/_summaries/grape.general_graph.GeneralGraph.init_status.rst:
--------------------------------------------------------------------------------
1 | grape.general\_graph.GeneralGraph.init\_status
2 | ==============================================
3 |
4 | .. currentmodule:: grape.general_graph
5 |
6 | .. autoproperty:: GeneralGraph.init_status
--------------------------------------------------------------------------------
/docs/source/_summaries/grape.general_graph.GeneralGraph.initial_service.rst:
--------------------------------------------------------------------------------
1 | grape.general\_graph.GeneralGraph.initial\_service
2 | ==================================================
3 |
4 | .. currentmodule:: grape.general_graph
5 |
6 | .. autoproperty:: GeneralGraph.initial_service
--------------------------------------------------------------------------------
/docs/source/_summaries/grape.general_graph.GeneralGraph.load.rst:
--------------------------------------------------------------------------------
1 | grape.general\_graph.GeneralGraph.load
2 | ======================================
3 |
4 | .. currentmodule:: grape.general_graph
5 |
6 | .. automethod:: GeneralGraph.load
--------------------------------------------------------------------------------
/docs/source/_summaries/grape.general_graph.GeneralGraph.local_efficiency.rst:
--------------------------------------------------------------------------------
1 | grape.general\_graph.GeneralGraph.local\_efficiency
2 | ===================================================
3 |
4 | .. currentmodule:: grape.general_graph
5 |
6 | .. autoproperty:: GeneralGraph.local_efficiency
--------------------------------------------------------------------------------
/docs/source/_summaries/grape.general_graph.GeneralGraph.local_efficiency_kernel.rst:
--------------------------------------------------------------------------------
1 | grape.general\_graph.GeneralGraph.local\_efficiency\_kernel
2 | ===========================================================
3 |
4 | .. currentmodule:: grape.general_graph
5 |
6 | .. automethod:: GeneralGraph.local_efficiency_kernel
--------------------------------------------------------------------------------
/docs/source/_summaries/grape.general_graph.GeneralGraph.mark.rst:
--------------------------------------------------------------------------------
1 | grape.general\_graph.GeneralGraph.mark
2 | ======================================
3 |
4 | .. currentmodule:: grape.general_graph
5 |
6 | .. autoproperty:: GeneralGraph.mark
--------------------------------------------------------------------------------
/docs/source/_summaries/grape.general_graph.GeneralGraph.mark_status.rst:
--------------------------------------------------------------------------------
1 | grape.general\_graph.GeneralGraph.mark\_status
2 | ==============================================
3 |
4 | .. currentmodule:: grape.general_graph
5 |
6 | .. autoproperty:: GeneralGraph.mark_status
--------------------------------------------------------------------------------
/docs/source/_summaries/grape.general_graph.GeneralGraph.nodal_efficiency.rst:
--------------------------------------------------------------------------------
1 | grape.general\_graph.GeneralGraph.nodal\_efficiency
2 | ===================================================
3 |
4 | .. currentmodule:: grape.general_graph
5 |
6 | .. autoproperty:: GeneralGraph.nodal_efficiency
--------------------------------------------------------------------------------
/docs/source/_summaries/grape.general_graph.GeneralGraph.nodal_efficiency_kernel.rst:
--------------------------------------------------------------------------------
1 | grape.general\_graph.GeneralGraph.nodal\_efficiency\_kernel
2 | ===========================================================
3 |
4 | .. currentmodule:: grape.general_graph
5 |
6 | .. automethod:: GeneralGraph.nodal_efficiency_kernel
--------------------------------------------------------------------------------
/docs/source/_summaries/grape.general_graph.GeneralGraph.outdegree_centrality.rst:
--------------------------------------------------------------------------------
1 | grape.general\_graph.GeneralGraph.outdegree\_centrality
2 | =======================================================
3 |
4 | .. currentmodule:: grape.general_graph
5 |
6 | .. autoproperty:: GeneralGraph.outdegree_centrality
--------------------------------------------------------------------------------
/docs/source/_summaries/grape.general_graph.GeneralGraph.outdegree_centrality_kernel.rst:
--------------------------------------------------------------------------------
1 | grape.general\_graph.GeneralGraph.outdegree\_centrality\_kernel
2 | ===============================================================
3 |
4 | .. currentmodule:: grape.general_graph
5 |
6 | .. automethod:: GeneralGraph.outdegree_centrality_kernel
--------------------------------------------------------------------------------
/docs/source/_summaries/grape.general_graph.GeneralGraph.perturbation_resistant.rst:
--------------------------------------------------------------------------------
1 | grape.general\_graph.GeneralGraph.perturbation\_resistant
2 | =========================================================
3 |
4 | .. currentmodule:: grape.general_graph
5 |
6 | .. autoproperty:: GeneralGraph.perturbation_resistant
--------------------------------------------------------------------------------
/docs/source/_summaries/grape.general_graph.GeneralGraph.rst:
--------------------------------------------------------------------------------
1 | grape.general\_graph.GeneralGraph
2 | =================================
3 |
4 | .. currentmodule:: grape.general_graph
5 |
6 | .. autoclass:: GeneralGraph
7 |
8 |
9 | .. automethod:: __init__
10 |
11 |
12 | .. rubric:: Methods
13 |
14 | .. autosummary::
15 |
16 | ~GeneralGraph.__init__
17 | ~GeneralGraph.add_edge
18 | ~GeneralGraph.add_edges_from
19 | ~GeneralGraph.add_node
20 | ~GeneralGraph.add_nodes_from
21 | ~GeneralGraph.add_weighted_edges_from
22 | ~GeneralGraph.adjacency
23 | ~GeneralGraph.betweenness_centrality_kernel
24 | ~GeneralGraph.calculate_shortest_path
25 | ~GeneralGraph.clear
26 | ~GeneralGraph.clear_data
27 | ~GeneralGraph.clear_edges
28 | ~GeneralGraph.closeness_centrality_kernel
29 | ~GeneralGraph.compute_betweenness_centrality
30 | ~GeneralGraph.compute_closeness_centrality
31 | ~GeneralGraph.compute_degree_centrality
32 | ~GeneralGraph.compute_efficiency
33 | ~GeneralGraph.compute_indegree_centrality
34 | ~GeneralGraph.compute_local_efficiency
35 | ~GeneralGraph.compute_nodal_efficiency
36 | ~GeneralGraph.compute_outdegree_centrality
37 | ~GeneralGraph.compute_service
38 | ~GeneralGraph.construct_path_kernel
39 | ~GeneralGraph.copy
40 | ~GeneralGraph.degree_centrality_kernel
41 | ~GeneralGraph.dijkstra_single_source_shortest_path
42 | ~GeneralGraph.edge_subgraph
43 | ~GeneralGraph.efficiency_kernel
44 | ~GeneralGraph.floyd_warshall_initialization
45 | ~GeneralGraph.floyd_warshall_kernel
46 | ~GeneralGraph.floyd_warshall_predecessor_and_distance
47 | ~GeneralGraph.get_edge_data
48 | ~GeneralGraph.has_edge
49 | ~GeneralGraph.has_node
50 | ~GeneralGraph.has_predecessor
51 | ~GeneralGraph.has_successor
52 | ~GeneralGraph.indegree_centrality_kernel
53 | ~GeneralGraph.is_directed
54 | ~GeneralGraph.is_multigraph
55 | ~GeneralGraph.load
56 | ~GeneralGraph.local_efficiency_kernel
57 | ~GeneralGraph.nbunch_iter
58 | ~GeneralGraph.neighbors
59 | ~GeneralGraph.nodal_efficiency_kernel
60 | ~GeneralGraph.number_of_edges
61 | ~GeneralGraph.number_of_nodes
62 | ~GeneralGraph.order
63 | ~GeneralGraph.outdegree_centrality_kernel
64 | ~GeneralGraph.predecessors
65 | ~GeneralGraph.remove_edge
66 | ~GeneralGraph.remove_edges_from
67 | ~GeneralGraph.remove_node
68 | ~GeneralGraph.remove_nodes_from
69 | ~GeneralGraph.reverse
70 | ~GeneralGraph.shortest_path_list_kernel
71 | ~GeneralGraph.size
72 | ~GeneralGraph.subgraph
73 | ~GeneralGraph.successors
74 | ~GeneralGraph.to_directed
75 | ~GeneralGraph.to_directed_class
76 | ~GeneralGraph.to_undirected
77 | ~GeneralGraph.to_undirected_class
78 | ~GeneralGraph.update
79 |
80 |
81 |
82 |
83 |
84 | .. rubric:: Attributes
85 |
86 | .. autosummary::
87 |
88 | ~GeneralGraph.adj
89 | ~GeneralGraph.area
90 | ~GeneralGraph.betweenness_centrality
91 | ~GeneralGraph.closeness_centrality
92 | ~GeneralGraph.degree
93 | ~GeneralGraph.degree_centrality
94 | ~GeneralGraph.description
95 | ~GeneralGraph.edges
96 | ~GeneralGraph.efficiency
97 | ~GeneralGraph.father_condition
98 | ~GeneralGraph.final_status
99 | ~GeneralGraph.global_efficiency
100 | ~GeneralGraph.in_degree
101 | ~GeneralGraph.in_edges
102 | ~GeneralGraph.indegree_centrality
103 | ~GeneralGraph.init_status
104 | ~GeneralGraph.initial_service
105 | ~GeneralGraph.local_efficiency
106 | ~GeneralGraph.mark
107 | ~GeneralGraph.mark_status
108 | ~GeneralGraph.name
109 | ~GeneralGraph.nodal_efficiency
110 | ~GeneralGraph.nodes
111 | ~GeneralGraph.out_degree
112 | ~GeneralGraph.out_edges
113 | ~GeneralGraph.outdegree_centrality
114 | ~GeneralGraph.perturbation_resistant
115 | ~GeneralGraph.pred
116 | ~GeneralGraph.service
117 | ~GeneralGraph.shortest_path
118 | ~GeneralGraph.shortest_path_length
119 | ~GeneralGraph.sources
120 | ~GeneralGraph.status_area
121 | ~GeneralGraph.succ
122 | ~GeneralGraph.switches
123 | ~GeneralGraph.type
124 | ~GeneralGraph.users
125 | ~GeneralGraph.weight
126 |
127 |
--------------------------------------------------------------------------------
/docs/source/_summaries/grape.general_graph.GeneralGraph.service.rst:
--------------------------------------------------------------------------------
1 | grape.general\_graph.GeneralGraph.service
2 | =========================================
3 |
4 | .. currentmodule:: grape.general_graph
5 |
6 | .. autoproperty:: GeneralGraph.service
--------------------------------------------------------------------------------
/docs/source/_summaries/grape.general_graph.GeneralGraph.shortest_path.rst:
--------------------------------------------------------------------------------
1 | grape.general\_graph.GeneralGraph.shortest\_path
2 | ================================================
3 |
4 | .. currentmodule:: grape.general_graph
5 |
6 | .. autoproperty:: GeneralGraph.shortest_path
--------------------------------------------------------------------------------
/docs/source/_summaries/grape.general_graph.GeneralGraph.shortest_path_length.rst:
--------------------------------------------------------------------------------
1 | grape.general\_graph.GeneralGraph.shortest\_path\_length
2 | ========================================================
3 |
4 | .. currentmodule:: grape.general_graph
5 |
6 | .. autoproperty:: GeneralGraph.shortest_path_length
--------------------------------------------------------------------------------
/docs/source/_summaries/grape.general_graph.GeneralGraph.shortest_path_list_kernel.rst:
--------------------------------------------------------------------------------
1 | grape.general\_graph.GeneralGraph.shortest\_path\_list\_kernel
2 | ==============================================================
3 |
4 | .. currentmodule:: grape.general_graph
5 |
6 | .. automethod:: GeneralGraph.shortest_path_list_kernel
--------------------------------------------------------------------------------
/docs/source/_summaries/grape.general_graph.GeneralGraph.sources.rst:
--------------------------------------------------------------------------------
1 | grape.general\_graph.GeneralGraph.sources
2 | =========================================
3 |
4 | .. currentmodule:: grape.general_graph
5 |
6 | .. autoproperty:: GeneralGraph.sources
--------------------------------------------------------------------------------
/docs/source/_summaries/grape.general_graph.GeneralGraph.status_area.rst:
--------------------------------------------------------------------------------
1 | grape.general\_graph.GeneralGraph.status\_area
2 | ==============================================
3 |
4 | .. currentmodule:: grape.general_graph
5 |
6 | .. autoproperty:: GeneralGraph.status_area
--------------------------------------------------------------------------------
/docs/source/_summaries/grape.general_graph.GeneralGraph.switches.rst:
--------------------------------------------------------------------------------
1 | grape.general\_graph.GeneralGraph.switches
2 | ==========================================
3 |
4 | .. currentmodule:: grape.general_graph
5 |
6 | .. autoproperty:: GeneralGraph.switches
--------------------------------------------------------------------------------
/docs/source/_summaries/grape.general_graph.GeneralGraph.type.rst:
--------------------------------------------------------------------------------
1 | grape.general\_graph.GeneralGraph.type
2 | ======================================
3 |
4 | .. currentmodule:: grape.general_graph
5 |
6 | .. autoproperty:: GeneralGraph.type
--------------------------------------------------------------------------------
/docs/source/_summaries/grape.general_graph.GeneralGraph.users.rst:
--------------------------------------------------------------------------------
1 | grape.general\_graph.GeneralGraph.users
2 | =======================================
3 |
4 | .. currentmodule:: grape.general_graph
5 |
6 | .. autoproperty:: GeneralGraph.users
--------------------------------------------------------------------------------
/docs/source/_summaries/grape.general_graph.GeneralGraph.weight.rst:
--------------------------------------------------------------------------------
1 | grape.general\_graph.GeneralGraph.weight
2 | ========================================
3 |
4 | .. currentmodule:: grape.general_graph
5 |
6 | .. autoproperty:: GeneralGraph.weight
--------------------------------------------------------------------------------
/docs/source/_summaries/grape.parallel_general_graph.ParallelGeneralGraph.calculate_shortest_path.rst:
--------------------------------------------------------------------------------
1 | grape.parallel\_general\_graph.ParallelGeneralGraph.calculate\_shortest\_path
2 | =============================================================================
3 |
4 | .. currentmodule:: grape.parallel_general_graph
5 |
6 | .. automethod:: ParallelGeneralGraph.calculate_shortest_path
--------------------------------------------------------------------------------
/docs/source/_summaries/grape.parallel_general_graph.ParallelGeneralGraph.compute_betweenness_centrality.rst:
--------------------------------------------------------------------------------
1 | grape.parallel\_general\_graph.ParallelGeneralGraph.compute\_betweenness\_centrality
2 | ====================================================================================
3 |
4 | .. currentmodule:: grape.parallel_general_graph
5 |
6 | .. automethod:: ParallelGeneralGraph.compute_betweenness_centrality
--------------------------------------------------------------------------------
/docs/source/_summaries/grape.parallel_general_graph.ParallelGeneralGraph.compute_closeness_centrality.rst:
--------------------------------------------------------------------------------
1 | grape.parallel\_general\_graph.ParallelGeneralGraph.compute\_closeness\_centrality
2 | ==================================================================================
3 |
4 | .. currentmodule:: grape.parallel_general_graph
5 |
6 | .. automethod:: ParallelGeneralGraph.compute_closeness_centrality
--------------------------------------------------------------------------------
/docs/source/_summaries/grape.parallel_general_graph.ParallelGeneralGraph.compute_degree_centrality.rst:
--------------------------------------------------------------------------------
1 | grape.parallel\_general\_graph.ParallelGeneralGraph.compute\_degree\_centrality
2 | ===============================================================================
3 |
4 | .. currentmodule:: grape.parallel_general_graph
5 |
6 | .. automethod:: ParallelGeneralGraph.compute_degree_centrality
--------------------------------------------------------------------------------
/docs/source/_summaries/grape.parallel_general_graph.ParallelGeneralGraph.compute_efficiency.rst:
--------------------------------------------------------------------------------
1 | grape.parallel\_general\_graph.ParallelGeneralGraph.compute\_efficiency
2 | =======================================================================
3 |
4 | .. currentmodule:: grape.parallel_general_graph
5 |
6 | .. automethod:: ParallelGeneralGraph.compute_efficiency
--------------------------------------------------------------------------------
/docs/source/_summaries/grape.parallel_general_graph.ParallelGeneralGraph.compute_indegree_centrality.rst:
--------------------------------------------------------------------------------
1 | grape.parallel\_general\_graph.ParallelGeneralGraph.compute\_indegree\_centrality
2 | =================================================================================
3 |
4 | .. currentmodule:: grape.parallel_general_graph
5 |
6 | .. automethod:: ParallelGeneralGraph.compute_indegree_centrality
--------------------------------------------------------------------------------
/docs/source/_summaries/grape.parallel_general_graph.ParallelGeneralGraph.compute_local_efficiency.rst:
--------------------------------------------------------------------------------
1 | grape.parallel\_general\_graph.ParallelGeneralGraph.compute\_local\_efficiency
2 | ==============================================================================
3 |
4 | .. currentmodule:: grape.parallel_general_graph
5 |
6 | .. automethod:: ParallelGeneralGraph.compute_local_efficiency
--------------------------------------------------------------------------------
/docs/source/_summaries/grape.parallel_general_graph.ParallelGeneralGraph.compute_nodal_efficiency.rst:
--------------------------------------------------------------------------------
1 | grape.parallel\_general\_graph.ParallelGeneralGraph.compute\_nodal\_efficiency
2 | ==============================================================================
3 |
4 | .. currentmodule:: grape.parallel_general_graph
5 |
6 | .. automethod:: ParallelGeneralGraph.compute_nodal_efficiency
--------------------------------------------------------------------------------
/docs/source/_summaries/grape.parallel_general_graph.ParallelGeneralGraph.compute_outdegree_centrality.rst:
--------------------------------------------------------------------------------
1 | grape.parallel\_general\_graph.ParallelGeneralGraph.compute\_outdegree\_centrality
2 | ==================================================================================
3 |
4 | .. currentmodule:: grape.parallel_general_graph
5 |
6 | .. automethod:: ParallelGeneralGraph.compute_outdegree_centrality
--------------------------------------------------------------------------------
/docs/source/_summaries/grape.parallel_general_graph.ParallelGeneralGraph.dijkstra_iteration_parallel.rst:
--------------------------------------------------------------------------------
1 | grape.parallel\_general\_graph.ParallelGeneralGraph.dijkstra\_iteration\_parallel
2 | =================================================================================
3 |
4 | .. currentmodule:: grape.parallel_general_graph
5 |
6 | .. automethod:: ParallelGeneralGraph.dijkstra_iteration_parallel
--------------------------------------------------------------------------------
/docs/source/_summaries/grape.parallel_general_graph.ParallelGeneralGraph.dijkstra_single_source_shortest_path.rst:
--------------------------------------------------------------------------------
1 | grape.parallel\_general\_graph.ParallelGeneralGraph.dijkstra\_single\_source\_shortest\_path
2 | ============================================================================================
3 |
4 | .. currentmodule:: grape.parallel_general_graph
5 |
6 | .. automethod:: ParallelGeneralGraph.dijkstra_single_source_shortest_path
--------------------------------------------------------------------------------
/docs/source/_summaries/grape.parallel_general_graph.ParallelGeneralGraph.floyd_warshall_predecessor_and_distance.rst:
--------------------------------------------------------------------------------
1 | grape.parallel\_general\_graph.ParallelGeneralGraph.floyd\_warshall\_predecessor\_and\_distance
2 | ===============================================================================================
3 |
4 | .. currentmodule:: grape.parallel_general_graph
5 |
6 | .. automethod:: ParallelGeneralGraph.floyd_warshall_predecessor_and_distance
--------------------------------------------------------------------------------
/docs/source/_summaries/grape.parallel_general_graph.ParallelGeneralGraph.measure_iteration.rst:
--------------------------------------------------------------------------------
1 | grape.parallel\_general\_graph.ParallelGeneralGraph.measure\_iteration
2 | ======================================================================
3 |
4 | .. currentmodule:: grape.parallel_general_graph
5 |
6 | .. automethod:: ParallelGeneralGraph.measure_iteration
--------------------------------------------------------------------------------
/docs/source/_summaries/grape.parallel_general_graph.ParallelGeneralGraph.measure_processes.rst:
--------------------------------------------------------------------------------
1 | grape.parallel\_general\_graph.ParallelGeneralGraph.measure\_processes
2 | ======================================================================
3 |
4 | .. currentmodule:: grape.parallel_general_graph
5 |
6 | .. automethod:: ParallelGeneralGraph.measure_processes
--------------------------------------------------------------------------------
/docs/source/_summaries/grape.parallel_general_graph.ParallelGeneralGraph.rst:
--------------------------------------------------------------------------------
1 | grape.parallel\_general\_graph.ParallelGeneralGraph
2 | ===================================================
3 |
4 | .. currentmodule:: grape.parallel_general_graph
5 |
6 | .. autoclass:: ParallelGeneralGraph
7 |
8 |
9 | .. automethod:: __init__
10 |
11 |
12 | .. rubric:: Methods
13 |
14 | .. autosummary::
15 |
16 | ~ParallelGeneralGraph.__init__
17 | ~ParallelGeneralGraph.add_edge
18 | ~ParallelGeneralGraph.add_edges_from
19 | ~ParallelGeneralGraph.add_node
20 | ~ParallelGeneralGraph.add_nodes_from
21 | ~ParallelGeneralGraph.add_weighted_edges_from
22 | ~ParallelGeneralGraph.adjacency
23 | ~ParallelGeneralGraph.betweenness_centrality_kernel
24 | ~ParallelGeneralGraph.calculate_shortest_path
25 | ~ParallelGeneralGraph.clear
26 | ~ParallelGeneralGraph.clear_data
27 | ~ParallelGeneralGraph.clear_edges
28 | ~ParallelGeneralGraph.closeness_centrality_kernel
29 | ~ParallelGeneralGraph.compute_betweenness_centrality
30 | ~ParallelGeneralGraph.compute_closeness_centrality
31 | ~ParallelGeneralGraph.compute_degree_centrality
32 | ~ParallelGeneralGraph.compute_efficiency
33 | ~ParallelGeneralGraph.compute_indegree_centrality
34 | ~ParallelGeneralGraph.compute_local_efficiency
35 | ~ParallelGeneralGraph.compute_nodal_efficiency
36 | ~ParallelGeneralGraph.compute_outdegree_centrality
37 | ~ParallelGeneralGraph.compute_service
38 | ~ParallelGeneralGraph.construct_path_kernel
39 | ~ParallelGeneralGraph.copy
40 | ~ParallelGeneralGraph.degree_centrality_kernel
41 | ~ParallelGeneralGraph.dijkstra_iteration_parallel
42 | ~ParallelGeneralGraph.dijkstra_single_source_shortest_path
43 | ~ParallelGeneralGraph.edge_subgraph
44 | ~ParallelGeneralGraph.efficiency_kernel
45 | ~ParallelGeneralGraph.floyd_warshall_initialization
46 | ~ParallelGeneralGraph.floyd_warshall_kernel
47 | ~ParallelGeneralGraph.floyd_warshall_predecessor_and_distance
48 | ~ParallelGeneralGraph.get_edge_data
49 | ~ParallelGeneralGraph.has_edge
50 | ~ParallelGeneralGraph.has_node
51 | ~ParallelGeneralGraph.has_predecessor
52 | ~ParallelGeneralGraph.has_successor
53 | ~ParallelGeneralGraph.indegree_centrality_kernel
54 | ~ParallelGeneralGraph.is_directed
55 | ~ParallelGeneralGraph.is_multigraph
56 | ~ParallelGeneralGraph.load
57 | ~ParallelGeneralGraph.local_efficiency_kernel
58 | ~ParallelGeneralGraph.measure_iteration
59 | ~ParallelGeneralGraph.measure_processes
60 | ~ParallelGeneralGraph.nbunch_iter
61 | ~ParallelGeneralGraph.neighbors
62 | ~ParallelGeneralGraph.nodal_efficiency_kernel
63 | ~ParallelGeneralGraph.number_of_edges
64 | ~ParallelGeneralGraph.number_of_nodes
65 | ~ParallelGeneralGraph.order
66 | ~ParallelGeneralGraph.outdegree_centrality_kernel
67 | ~ParallelGeneralGraph.predecessors
68 | ~ParallelGeneralGraph.remove_edge
69 | ~ParallelGeneralGraph.remove_edges_from
70 | ~ParallelGeneralGraph.remove_node
71 | ~ParallelGeneralGraph.remove_nodes_from
72 | ~ParallelGeneralGraph.reverse
73 | ~ParallelGeneralGraph.shortest_path_list_iteration
74 | ~ParallelGeneralGraph.shortest_path_list_kernel
75 | ~ParallelGeneralGraph.size
76 | ~ParallelGeneralGraph.subgraph
77 | ~ParallelGeneralGraph.successors
78 | ~ParallelGeneralGraph.to_directed
79 | ~ParallelGeneralGraph.to_directed_class
80 | ~ParallelGeneralGraph.to_undirected
81 | ~ParallelGeneralGraph.to_undirected_class
82 | ~ParallelGeneralGraph.update
83 |
84 |
85 |
86 |
87 |
88 | .. rubric:: Attributes
89 |
90 | .. autosummary::
91 |
92 | ~ParallelGeneralGraph.adj
93 | ~ParallelGeneralGraph.area
94 | ~ParallelGeneralGraph.betweenness_centrality
95 | ~ParallelGeneralGraph.closeness_centrality
96 | ~ParallelGeneralGraph.degree
97 | ~ParallelGeneralGraph.degree_centrality
98 | ~ParallelGeneralGraph.description
99 | ~ParallelGeneralGraph.edges
100 | ~ParallelGeneralGraph.efficiency
101 | ~ParallelGeneralGraph.father_condition
102 | ~ParallelGeneralGraph.final_status
103 | ~ParallelGeneralGraph.global_efficiency
104 | ~ParallelGeneralGraph.in_degree
105 | ~ParallelGeneralGraph.in_edges
106 | ~ParallelGeneralGraph.indegree_centrality
107 | ~ParallelGeneralGraph.init_status
108 | ~ParallelGeneralGraph.initial_service
109 | ~ParallelGeneralGraph.local_efficiency
110 | ~ParallelGeneralGraph.mark
111 | ~ParallelGeneralGraph.mark_status
112 | ~ParallelGeneralGraph.name
113 | ~ParallelGeneralGraph.nodal_efficiency
114 | ~ParallelGeneralGraph.nodes
115 | ~ParallelGeneralGraph.out_degree
116 | ~ParallelGeneralGraph.out_edges
117 | ~ParallelGeneralGraph.outdegree_centrality
118 | ~ParallelGeneralGraph.perturbation_resistant
119 | ~ParallelGeneralGraph.pred
120 | ~ParallelGeneralGraph.service
121 | ~ParallelGeneralGraph.shortest_path
122 | ~ParallelGeneralGraph.shortest_path_length
123 | ~ParallelGeneralGraph.sources
124 | ~ParallelGeneralGraph.status_area
125 | ~ParallelGeneralGraph.succ
126 | ~ParallelGeneralGraph.switches
127 | ~ParallelGeneralGraph.type
128 | ~ParallelGeneralGraph.users
129 | ~ParallelGeneralGraph.weight
130 |
131 |
--------------------------------------------------------------------------------
/docs/source/_summaries/grape.parallel_general_graph.ParallelGeneralGraph.shortest_path_list_iteration.rst:
--------------------------------------------------------------------------------
1 | grape.parallel\_general\_graph.ParallelGeneralGraph.shortest\_path\_list\_iteration
2 | ===================================================================================
3 |
4 | .. currentmodule:: grape.parallel_general_graph
5 |
6 | .. automethod:: ParallelGeneralGraph.shortest_path_list_iteration
--------------------------------------------------------------------------------
/docs/source/_summaries/grape.utils.chunk_it.rst:
--------------------------------------------------------------------------------
1 | grape.utils.chunk\_it
2 | =====================
3 |
4 | .. currentmodule:: grape.utils
5 |
6 | .. autofunction:: chunk_it
--------------------------------------------------------------------------------
/docs/source/code.rst:
--------------------------------------------------------------------------------
1 | Code Documentation
2 | =======================
3 |
4 |
5 | .. toctree::
6 | :maxdepth: 2
7 |
8 |
9 | general_graph
10 | parallel_general_graph
11 | fault_diagnosis
12 | utils
13 |
--------------------------------------------------------------------------------
/docs/source/conf.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | #
3 | # pydmd documentation build configuration file, created by
4 | # sphinx-quickstart on Mon Jun 22 16:09:40 2015.
5 | #
6 | # This file is execfile()d with the current directory set to its
7 | # containing dir.
8 | #
9 | # Note that not all possible configuration values are present in this
10 | # autogenerated file.
11 | #
12 | # All configuration values have a default; values that are commented out
13 | # serve to show the default.
14 |
15 | import sys
16 | import os
17 | import shlex
18 | import sphinx
19 | from sphinx.errors import VersionRequirementError
20 | import sphinx_rtd_theme
21 |
22 | # If extensions (or modules to document with autodoc) are in another directory,
23 | # add these directories to sys.path here. If the directory is relative to the
24 | # documentation root, use os.path.abspath to make it absolute, like shown here.
25 | sys.path.insert(0, os.path.abspath('../..'))
26 | import grape
27 |
28 | # -- General configuration ------------------------------------------------
29 |
30 | # If your documentation needs a minimal Sphinx version, state it here.
31 | #needs_sphinx = '1.4'
32 | #if needs_sphinx > sphinx.__display_version__:
33 | # message = 'This project needs at least Sphinx v{0!s}'.format(needs_sphinx)
34 | # raise VersionRequirementError(message)
35 |
36 | # Add any Sphinx extension module names here, as strings. They can be
37 | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
38 | # ones.
39 | extensions = [
40 | 'sphinx.ext.autodoc',
41 | 'sphinx.ext.autosummary',
42 | 'sphinx.ext.coverage',
43 | 'sphinx.ext.graphviz',
44 | 'sphinx.ext.doctest',
45 | 'sphinx.ext.intersphinx',
46 | 'sphinx.ext.todo',
47 | 'sphinx.ext.coverage',
48 | 'sphinx.ext.viewcode',
49 | # 'sphinx.ext.imgmath',
50 | 'sphinx.ext.ifconfig',
51 | 'sphinx.ext.napoleon'
52 | ]
53 |
54 | intersphinx_mapping = {'python': ('http://docs.python.org/2', None),
55 | 'numpy': ('http://docs.scipy.org/doc/numpy/', None),
56 | 'networkx': ('https://networkx.github.io/documentation/stable/', None),
57 | 'scipy': ('http://docs.scipy.org/doc/scipy/reference/', None),
58 | 'matplotlib': ('http://matplotlib.sourceforge.net/', None),
59 | 'pandas': ('https://pandas.pydata.org/docs/', None),
60 | 'deap': ('https://deap.readthedocs.io/en/master/', None)}
61 |
62 | autosummary_generate = True
63 |
64 | # Add any paths that contain templates here, relative to this directory.
65 | templates_path = ['_templates']
66 |
67 | # The suffix(es) of source filenames.
68 | # You can specify multiple suffix as a list of string:
69 | # source_suffix = ['.rst', '.md']
70 | source_suffix = '.rst'
71 |
72 | # The encoding of source files.
73 | #source_encoding = 'utf-8-sig'
74 |
75 | # The master toctree document.
76 | master_doc = 'index'
77 |
78 | # General information about the project.
79 | project = u'GRAPE'
80 | copyright = u'2018-2019, GRAPE contributors'
81 | author = u'GRAPE contributors'
82 |
83 | # autoclass
84 | autoclass_content = 'both'
85 |
86 | # The version info for the project you're documenting, acts as replacement for
87 | # |version| and |release|, also used in various other places throughout the
88 | # built documents.
89 | #
90 | # The short X.Y version.
91 | version = grape.__version__
92 | # The full version, including alpha/beta/rc tags.
93 | release = version
94 |
95 | # The language for content autogenerated by Sphinx. Refer to documentation
96 | # for a list of supported languages.
97 | #
98 | # This is also used if you do content translation via gettext catalogs.
99 | # Usually you set "language" from the command line for these cases.
100 | language = None
101 |
102 | # There are two options for replacing |today|: either, you set today to some
103 | # non-false value, then it is used:
104 | #today = ''
105 | # Else, today_fmt is used as the format for a strftime call.
106 | #today_fmt = '%B %d, %Y'
107 |
108 | # List of patterns, relative to source directory, that match files and
109 | # directories to ignore when looking for source files.
110 | exclude_patterns = []
111 |
112 | # The reST default role (used for this markup: `text`) to use for all
113 | # documents.
114 | #default_role = None
115 |
116 | # If true, '()' will be appended to :func: etc. cross-reference text.
117 | add_function_parentheses = True
118 |
119 | # If true, the current module name will be prepended to all description
120 | # unit titles (such as .. function::).
121 | add_module_names = False
122 |
123 | # If true, sectionauthor and moduleauthor directives will be shown in the
124 | # output. They are ignored by default.
125 | #show_authors = False
126 |
127 | # The name of the Pygments (syntax highlighting) style to use.
128 | pygments_style = 'sphinx'
129 |
130 | # A list of ignored prefixes for module index sorting.
131 | #modindex_common_prefix = []
132 |
133 | # If true, keep warnings as "system message" paragraphs in the built documents.
134 | keep_warnings = False
135 |
136 | # If true, `todo` and `todoList` produce output, else they produce nothing.
137 | todo_include_todos = True
138 |
139 |
140 | # -- Options for viewcode extension ---------------------------------------
141 |
142 | # Follow alias objects that are imported from another module such as functions,
143 | # classes and attributes. As side effects, this option ... ???
144 | # If false, ... ???.
145 | # The default is True.
146 | viewcode_import = True
147 |
148 |
149 | # -- Options for HTML output ----------------------------------------------
150 |
151 | # The theme to use for HTML and HTML Help pages. See the documentation for
152 | # a list of builtin themes.
153 | #html_theme = 'bizstyle'
154 | html_theme = "sphinx_rtd_theme"
155 |
156 | # Theme options are theme-specific and customize the look and feel of a theme
157 | # further. For a list of options available for each theme, see the
158 | # documentation.
159 | #html_theme_options = {}
160 |
161 | # Add any paths that contain custom themes here, relative to this directory.
162 | html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
163 |
164 | # The name for this set of Sphinx documents. If None, it defaults to
165 | # " v documentation".
166 | #html_title = None
167 |
168 | # A shorter title for the navigation bar. Default is the same as html_title.
169 | #html_short_title = None
170 |
171 | # The name of an image file (relative to this directory) to place at the top
172 | # of the sidebar.
173 | #html_logo = None
174 |
175 | # The name of an image file (within the static path) to use as favicon of the
176 | # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
177 | # pixels large.
178 | #html_favicon = None
179 |
180 | # Add any paths that contain custom static files (such as style sheets) here,
181 | # relative to this directory. They are copied after the builtin static files,
182 | # so a file named "default.css" will overwrite the builtin "default.css".
183 | html_static_path = ['_static']
184 |
185 | # Add any extra paths that contain custom files (such as robots.txt or
186 | # .htaccess) here, relative to this directory. These files are copied
187 | # directly to the root of the documentation.
188 | html_extra_path = ['_tutorials']
189 |
190 | # If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
191 | # using the given strftime format.
192 | html_last_updated_fmt = '%b %d, %Y'
193 |
194 | # If true, SmartyPants will be used to convert quotes and dashes to
195 | # typographically correct entities.
196 | #html_use_smartypants = True
197 |
198 | # Custom sidebar templates, maps document names to template names.
199 | #html_sidebars = {}
200 |
201 | # Additional templates that should be rendered to pages, maps page names to
202 | # template names.
203 | #html_additional_pages = {}
204 |
205 | # If false, no module index is generated.
206 | #html_domain_indices = True
207 |
208 | # If false, no index is generated.
209 | html_use_index = True
210 |
211 | # If true, the index is split into individual pages for each letter.
212 | #html_split_index = False
213 |
214 | # If true, links to the reST sources are added to the pages.
215 | html_show_sourcelink = True
216 |
217 | # If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
218 | #html_show_sphinx = True
219 |
220 | # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
221 | html_show_copyright = True
222 |
223 | # If true, an OpenSearch description file will be output, and all pages will
224 | # contain a tag referring to it. The value of this option must be the
225 | # base URL from which the finished HTML is served.
226 | #html_use_opensearch = ''
227 |
228 | # This is the file name suffix for HTML files (e.g. ".xhtml").
229 | #html_file_suffix = None
230 |
231 | # Language to be used for generating the HTML full-text search index.
232 | # Sphinx supports the following languages:
233 | # 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja'
234 | # 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr'
235 | #html_search_language = 'en'
236 |
237 | # A dictionary with options for the search language support, empty by default.
238 | # Now only 'ja' uses this config value
239 | #html_search_options = {'type': 'default'}
240 |
241 | # The name of a javascript file (relative to the configuration directory) that
242 | # implements a search results scorer. If empty, the default will be used.
243 | #html_search_scorer = 'scorer.js'
244 |
245 | # Output file base name for HTML help builder.
246 | htmlhelp_basename = 'grapedoc'
247 |
248 | # -- Options for LaTeX output ---------------------------------------------
249 |
250 | latex_elements = {
251 | # The paper size ('letterpaper' or 'a4paper').
252 | #'papersize': 'letterpaper',
253 |
254 | # The font size ('10pt', '11pt' or '12pt').
255 | #'pointsize': '10pt',
256 |
257 | # Additional stuff for the LaTeX preamble.
258 | #'preamble': '',
259 |
260 | # Latex figure (float) alignment
261 | #'figure_align': 'htbp',
262 | }
263 |
264 | # Grouping the document tree into LaTeX files. List of tuples
265 | # (source start file, target name, title,
266 | # author, documentclass [howto, manual, or own class]).
267 | #latex_documents = [
268 | # (master_doc, 'pydmd.tex', u'pydmd Documentation',
269 | # u'PyDMD contributors', 'manual'),
270 | #]
271 |
272 | # The name of an image file (relative to this directory) to place at the top of
273 | # the title page.
274 | #latex_logo = None
275 |
276 | # For "manual" documents, if this is true, then toplevel headings are parts,
277 | # not chapters.
278 | #latex_use_parts = False
279 |
280 | # If true, show page references after internal links.
281 | #latex_show_pagerefs = False
282 |
283 | # If true, show URL addresses after external links.
284 | #latex_show_urls = False
285 |
286 | # Documents to append as an appendix to all manuals.
287 | #latex_appendices = []
288 |
289 | # If false, no module index is generated.
290 | #latex_domain_indices = True
291 |
292 |
293 | # -- Options for manual page output ---------------------------------------
294 |
295 | # One entry per manual page. List of tuples
296 | # (source start file, name, description, authors, manual section).
297 | man_pages = [
298 | (master_doc, 'grape', u'GRAPE Documentation',
299 | [author], 1)
300 | ]
301 |
302 | # If true, show URL addresses after external links.
303 | #man_show_urls = False
304 |
305 |
306 | # -- Options for Texinfo output -------------------------------------------
307 |
308 | # Grouping the document tree into Texinfo files. List of tuples
309 | # (source start file, target name, title, author,
310 | # dir menu entry, description, category)
311 | texinfo_documents = [
312 | (master_doc, 'grape', u'GRAPE Documentation',
313 | author, 'grape', 'One line description of project.',
314 | 'Miscellaneous'),
315 | ]
316 |
317 | # Documents to append as an appendix to all manuals.
318 | #texinfo_appendices = []
319 |
320 | # If false, no module index is generated.
321 | #texinfo_domain_indices = True
322 |
323 | # How to display URL addresses: 'footnote', 'no', or 'inline'.
324 | #texinfo_show_urls = 'footnote'
325 |
326 | # If true, do not generate a @detailmenu in the "Top" node's menu.
327 | #texinfo_no_detailmenu = False
328 |
--------------------------------------------------------------------------------
/docs/source/contact.rst:
--------------------------------------------------------------------------------
1 | Contact
2 | =======
3 |
4 | Feel free to contact the authors for any informations.
5 |
6 | - auroramaurizio1@gmail.com
7 | - teruzzi.martina@gmail.com
8 | - demo.nicola@gmail.com
9 |
--------------------------------------------------------------------------------
/docs/source/contributing.rst:
--------------------------------------------------------------------------------
1 | How to contribute
2 | ===================
3 |
4 | We'd love to accept your patches and contributions to this project. There are
5 | just a few small guidelines you need to follow.
6 |
7 | Submitting a patch:
8 |
9 | 1. It's generally best to start by opening a new issue describing the bug or feature you're intending to fix. Even if you think it's relatively minor, it's helpful to know what people are working on. Mention in the initial issue that you are planning to work on that bug or feature so that it can be assigned to you.
10 |
11 | 2. Follow the normal process of forking the project, and setup a new branch to work in. It's important that each group of changes be done in separate branches in order to ensure that a pull request only includes the commits related to that bug or feature.
12 |
13 | 3. To ensure properly formatted code, please make sure to use 4 spaces to indent the code. The easy way is to run on your bash the provided script: ./code_formatter.sh. You should also run pylint over your code. It's not strictly necessary that your code be completely "lint-free", but this will help you find common style issues.
14 |
15 | 4. Any significant changes should almost always be accompanied by tests. The project already has good test coverage, so look at some of the existing tests if you're unsure how to go about it. We're using coveralls that is an invaluable tools for seeing which parts of your code aren't being exercised by your tests.
16 |
17 | 5. Do your best to have well-formed commit messages for each change. This provides consistency throughout the project, and ensures that commit messages are able to be formatted properly by various git tools.
18 |
19 | 6. Finally, push the commits to your fork and submit a pull request. Please, remember to rebase properly in order to maintain a clean, linear git history.
20 |
--------------------------------------------------------------------------------
/docs/source/fault_diagnosis.rst:
--------------------------------------------------------------------------------
1 | FaultDiagnosis
2 | =====================
3 |
4 | .. currentmodule:: grape.fault_diagnosis
5 |
6 | .. automodule:: grape.fault_diagnosis
7 |
8 | .. autosummary::
9 | :toctree: _summaries
10 | :nosignatures:
11 |
12 | FaultDiagnosis
13 | FaultDiagnosis.check_input_with_gephi
14 | FaultDiagnosis.fitness_iteration_parallel
15 | FaultDiagnosis.fitness_evaluation_parallel
16 | FaultDiagnosis.fitness_evaluation
17 | FaultDiagnosis.optimizer
18 | FaultDiagnosis.check_paths_and_measures
19 | FaultDiagnosis.rm_nodes
20 | FaultDiagnosis.update_output
21 | FaultDiagnosis.update_status_areas
22 | FaultDiagnosis.delete_a_node
23 | FaultDiagnosis.apply_perturbation
24 | FaultDiagnosis.simulate_element_perturbation
25 | FaultDiagnosis.simulate_area_perturbation
26 | FaultDiagnosis.graph_characterization_to_file
27 |
28 | .. autoclass:: FaultDiagnosis
29 | :members:
30 | :private-members:
31 | :undoc-members:
32 | :show-inheritance:
33 | :noindex:
34 |
--------------------------------------------------------------------------------
/docs/source/general_code_output.log:
--------------------------------------------------------------------------------
1 | DEBUG:urllib3.connectionpool:Starting new HTTP connection (1): docs.scipy.org:80
2 | DEBUG:urllib3.connectionpool:Starting new HTTP connection (1): docs.python.org:80
3 | DEBUG:urllib3.connectionpool:Starting new HTTP connection (1): docs.scipy.org:80
4 | DEBUG:urllib3.connectionpool:Starting new HTTP connection (1): matplotlib.sourceforge.net:80
5 | DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): networkx.github.io:443
6 | DEBUG:urllib3.connectionpool:http://docs.python.org:80 "GET /2/objects.inv HTTP/1.1" 301 0
7 | DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): docs.python.org:443
8 | DEBUG:urllib3.connectionpool:http://docs.scipy.org:80 "GET /doc/scipy/reference/objects.inv HTTP/1.1" 301 342
9 | DEBUG:urllib3.connectionpool:http://docs.scipy.org:80 "GET /doc/numpy/objects.inv HTTP/1.1" 301 332
10 | DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): docs.scipy.org:443
11 | DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): docs.scipy.org:443
12 | DEBUG:urllib3.connectionpool:https://networkx.github.io:443 "GET /documentation/stable/objects.inv HTTP/1.1" 301 162
13 | DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): networkx.org:443
14 | DEBUG:urllib3.connectionpool:http://matplotlib.sourceforge.net:80 "GET /objects.inv HTTP/1.1" 301 241
15 | DEBUG:urllib3.connectionpool:Starting new HTTP connection (1): matplotlib.org:80
16 | DEBUG:urllib3.connectionpool:https://docs.python.org:443 "GET /2/objects.inv HTTP/1.1" 200 85381
17 | DEBUG:urllib3.connectionpool:http://matplotlib.org:80 "GET /objects.inv HTTP/1.1" 301 None
18 | DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): matplotlib.org:443
19 | DEBUG:urllib3.connectionpool:https://docs.scipy.org:443 "GET /doc/scipy/reference/objects.inv HTTP/1.1" 200 81641
20 | DEBUG:urllib3.connectionpool:https://docs.scipy.org:443 "GET /doc/numpy/objects.inv HTTP/1.1" 301 329
21 | DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): numpy.org:443
22 | DEBUG:urllib3.connectionpool:https://matplotlib.org:443 "GET /objects.inv HTTP/1.1" 200 98623
23 | DEBUG:urllib3.connectionpool:https://networkx.org:443 "GET /documentation/stable/objects.inv HTTP/1.1" 200 36576
24 | DEBUG:urllib3.connectionpool:https://numpy.org:443 "GET /doc/stable/objects.inv HTTP/1.1" 200 62911
25 |
--------------------------------------------------------------------------------
/docs/source/general_graph.rst:
--------------------------------------------------------------------------------
1 | GeneralGraph
2 | =====================
3 |
4 | .. currentmodule:: grape.general_graph
5 |
6 | .. automodule:: grape.general_graph
7 |
8 | .. autosummary::
9 | :toctree: _summaries
10 | :nosignatures:
11 |
12 | GeneralGraph
13 | GeneralGraph.load
14 | GeneralGraph.mark
15 | GeneralGraph.area
16 | GeneralGraph.perturbation_resistant
17 | GeneralGraph.description
18 | GeneralGraph.init_status
19 | GeneralGraph.final_status
20 | GeneralGraph.mark_status
21 | GeneralGraph.status_area
22 | GeneralGraph.father_condition
23 | GeneralGraph.weight
24 | GeneralGraph.type
25 | GeneralGraph.sources
26 | GeneralGraph.users
27 | GeneralGraph.switches
28 | GeneralGraph.initial_service
29 | GeneralGraph.service
30 | GeneralGraph.shortest_path
31 | GeneralGraph.shortest_path_length
32 | GeneralGraph.efficiency
33 | GeneralGraph.nodal_efficiency
34 | GeneralGraph.local_efficiency
35 | GeneralGraph.global_efficiency
36 | GeneralGraph.betweenness_centrality
37 | GeneralGraph.closeness_centrality
38 | GeneralGraph.degree_centrality
39 | GeneralGraph.indegree_centrality
40 | GeneralGraph.outdegree_centrality
41 | GeneralGraph.clear_data
42 | GeneralGraph.construct_path_kernel
43 | GeneralGraph.floyd_warshall_initialization
44 | GeneralGraph.floyd_warshall_kernel
45 | GeneralGraph.floyd_warshall_predecessor_and_distance
46 | GeneralGraph.dijkstra_single_source_shortest_path
47 | GeneralGraph.calculate_shortest_path
48 | GeneralGraph.efficiency_kernel
49 | GeneralGraph.compute_efficiency
50 | GeneralGraph.nodal_efficiency_kernel
51 | GeneralGraph.compute_nodal_efficiency
52 | GeneralGraph.local_efficiency_kernel
53 | GeneralGraph.compute_local_efficiency
54 | GeneralGraph.shortest_path_list_kernel
55 | GeneralGraph.betweenness_centrality_kernel
56 | GeneralGraph.compute_betweenness_centrality
57 | GeneralGraph.closeness_centrality_kernel
58 | GeneralGraph.compute_closeness_centrality
59 | GeneralGraph.degree_centrality_kernel
60 | GeneralGraph.compute_degree_centrality
61 | GeneralGraph.indegree_centrality_kernel
62 | GeneralGraph.compute_indegree_centrality
63 | GeneralGraph.outdegree_centrality_kernel
64 | GeneralGraph.compute_outdegree_centrality
65 | GeneralGraph.compute_service
66 |
67 | .. autoclass:: GeneralGraph
68 | :members:
69 | :private-members:
70 | :undoc-members:
71 | :show-inheritance:
72 | :noindex:
73 |
--------------------------------------------------------------------------------
/docs/source/index.rst:
--------------------------------------------------------------------------------
1 | Welcome to GRAPE's documentation!
2 | ===================================================
3 |
4 | GRAph Parallel Environment
5 |
6 | Description
7 | --------------------
8 | GRAPE (GRAph Parallel Environment) is a Python package that takes advantage of
9 | Graph Theory into a High Performance Computing (HPC) environment to develope a
10 | screening tool aimed at studying the effect of different kinds of perturbations
11 | in interconnected systems, such as indsutrial plants.
12 |
13 | The tool allows to represent the dependencies between components and predict
14 | the state of health and the residual functionality of degradable systems after
15 | a casualty, suggesting the proper reconfiguration strategies to mitigate the
16 | damage. The results obtained from the graph analysis can be therefore used to
17 | improve topology, robustness, and resilience profile of industrial facilities
18 | against domino effect propagation.
19 |
20 | In particular, the components contribution to the cascade effects resulting
21 | from adverse events can be evaluated through centrality and efficiency
22 | measures, highlighting the plants major criticalities, vulnerabilities and
23 | potential weak points.
24 |
25 | Considering that the most computationally expensive parts of the program
26 | involve the calculation of shortest paths, parallelization of shortest path
27 | computation in large unweighted graphs was integrated in the program. This was
28 | done taking advantage of the Python modules multiprocessing and threading. Two
29 | different sequential algorithms for the solution of the shortest path problem
30 | have been parallelized including a Single Source Shortest Path (SSSP) algorythm
31 | for sparse graphs and an All Pairs Shortest Path one (APSP) for dense graphs.
32 |
33 |
34 | Installation
35 | --------------------
36 | The official distribution is on GitHub, and you can clone the repository using
37 | ::
38 |
39 | git clone https://github.com/mathLab/GRAPE
40 |
41 | To install the package just type:
42 | ::
43 |
44 | python setup.py install
45 |
46 | To uninstall the package you have to rerun the installation and record the installed files in order to remove them:
47 |
48 | ::
49 |
50 | python setup.py install --record installed_files.txt
51 | cat installed_files.txt | xargs rm -rf
52 |
53 |
54 | Developer's Guide
55 | --------------------
56 |
57 | .. toctree::
58 | :maxdepth: 1
59 |
60 | code
61 | contact
62 | contributing
63 | LICENSE
64 |
65 |
66 | Indices and tables
67 | --------------------
68 |
69 | * :ref:`genindex`
70 | * :ref:`modindex`
71 | * :ref:`search`
72 |
73 |
--------------------------------------------------------------------------------
/docs/source/parallel_general_graph.rst:
--------------------------------------------------------------------------------
1 | ParallelGeneralGraph
2 | =====================
3 |
4 | .. currentmodule:: grape.parallel_general_graph
5 |
6 | .. automodule:: grape.parallel_general_graph
7 |
8 | .. autosummary::
9 | :toctree: _summaries
10 | :nosignatures:
11 |
12 | ParallelGeneralGraph
13 | ParallelGeneralGraph.measure_iteration
14 | ParallelGeneralGraph.measure_processes
15 | ParallelGeneralGraph.floyd_warshall_predecessor_and_distance
16 | ParallelGeneralGraph.dijkstra_iteration_parallel
17 | ParallelGeneralGraph.dijkstra_single_source_shortest_path
18 | ParallelGeneralGraph.calculate_shortest_path
19 | ParallelGeneralGraph.compute_efficiency
20 | ParallelGeneralGraph.compute_nodal_efficiency
21 | ParallelGeneralGraph.compute_local_efficiency
22 | ParallelGeneralGraph.shortest_path_list_iteration
23 | ParallelGeneralGraph.compute_betweenness_centrality
24 | ParallelGeneralGraph.compute_closeness_centrality
25 | ParallelGeneralGraph.compute_degree_centrality
26 | ParallelGeneralGraph.compute_indegree_centrality
27 | ParallelGeneralGraph.compute_outdegree_centrality
28 |
29 | .. autoclass:: ParallelGeneralGraph
30 | :members:
31 | :inherited-members: load, mark, area, perturbation_resistant, description,
32 | init_status, final_status, mark_status, status_area, father_condition,
33 | weight, type, sources, users, switches, initial_service, service,
34 | shortest_path, shortest_path_length, efficiency, nodal_efficiency,
35 | local_efficiency, global_efficiency, betweenness_centrality,
36 | closeness_centrality, degree_centrality, indegree_centrality,
37 | outdegree_centrality, clear_data, construct_path_kernel,
38 | floyd_warshall_initialization, floyd_warshall_kernel,
39 | efficiency_kernel, nodal_efficiency_kernel, local_efficiency_kernel,
40 | shortest_path_list_kernel, betweenness_centrality_kernel,
41 | closeness_centrality_kernel, degree_centrality_kernel,
42 | indegree_centrality_kernel, outdegree_centrality_kernel, compute_service
43 | :private-members:
44 | :undoc-members:
45 | :show-inheritance: GeneralGraph
46 | :noindex:
47 |
--------------------------------------------------------------------------------
/docs/source/utils.rst:
--------------------------------------------------------------------------------
1 | utils
2 | =====================
3 |
4 | .. currentmodule:: grape.utils
5 |
6 | .. automodule:: grape.utils
7 |
8 | .. autosummary::
9 | :toctree: _summaries
10 | :nosignatures:
11 |
12 | chunk_it
13 |
--------------------------------------------------------------------------------
/grape/__init__.py:
--------------------------------------------------------------------------------
1 | """
2 | GRAPE init
3 | """
4 | __all__ = ['general_graph', 'parallel_general_graph', 'fault_diagnosis']
5 |
6 |
7 | from .meta import *
8 | from .general_graph import GeneralGraph
9 | from .parallel_general_graph import ParallelGeneralGraph
10 | from .fault_diagnosis import FaultDiagnosis
11 |
--------------------------------------------------------------------------------
/grape/meta.py:
--------------------------------------------------------------------------------
1 | """Package information"""
2 |
3 | def get_current_year():
4 | """ Return current year """
5 | from datetime import datetime
6 | return datetime.now().year
7 |
8 | __all__ = [
9 | '__project__',
10 | '__title__',
11 | '__author__',
12 | '__copyright__',
13 | '__license__',
14 | '__version__',
15 | '__mail__',
16 | '__maintainer__',
17 | '__status__',
18 | '__packagename__']
19 |
20 | __project__ = 'GRAPE'
21 | __packagename__ = 'grape-mathlab'
22 | __project__ = 'GRAPE'
23 | __title__ = "grape"
24 | __author__ = "Aurora Maurizio, Martina Teruzzi, Nicola Demo"
25 | __copyright__ = "Copyright 2019-{}, GRAPE contributors".format(get_current_year())
26 | __license__ = "MIT"
27 | __version__ = "2.0.0"
28 | __mail__ = 'auroramaurizio1@gmail.com, teruzzi.martina@gmail.com, demo.nicola@gmail.com'
29 | __maintainer__ = __author__
30 | __status__ = "Alpha"
31 |
--------------------------------------------------------------------------------
/grape/utils.py:
--------------------------------------------------------------------------------
1 | """Utility functions module"""
2 |
3 |
4 | def chunk_it(elements, n_procs):
5 | """
6 |
7 | Divide elements in chunks according to number of processes.
8 |
9 | :param list elements: list of elements to be divided in chunks
10 | :param int n_procs: number of available processes
11 |
12 | :return: list of elements to be assigned to every process
13 | :rtype: list
14 | """
15 |
16 | avg = len(elements) / n_procs
17 | out = []
18 | last = 0.0
19 |
20 | while last < len(elements):
21 | out.append(elements[int(last):int(last + avg)])
22 | last += avg
23 | return out
24 |
--------------------------------------------------------------------------------
/readme/logo_grape_resized.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mathLab/GRAPE/f9ed0f5d5c757817ee38fa06b7de2788ad86470c/readme/logo_grape_resized.pdf
--------------------------------------------------------------------------------
/readme/logo_grape_resized.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mathLab/GRAPE/f9ed0f5d5c757817ee38fa06b7de2788ad86470c/readme/logo_grape_resized.png
--------------------------------------------------------------------------------
/setup.py:
--------------------------------------------------------------------------------
1 | from setuptools import setup, find_packages
2 |
3 | meta = {}
4 | with open("grape/meta.py") as fp:
5 | exec(fp.read(), meta)
6 |
7 | # Package meta-data.
8 | IMPORTNAME = meta['__title__']
9 | PIPNAME = meta['__packagename__']
10 | NAME = meta['__title__']
11 | DESCRIPTION = 'GRAph Parallel Environment.'
12 | URL = 'https://github.com/mathLab/GRAPE'
13 | MAIL = meta['__mail__']
14 | AUTHOR = meta['__author__']
15 | VERSION = meta['__version__']
16 | KEYWORDS = (
17 | 'risk-analysis graph-theory parallel-programming shortest-path '
18 | 'system-analysis fault-diagnostics'
19 | )
20 |
21 | REQUIRED = [
22 | 'networkx', 'numpy', 'scipy', 'matplotlib', 'pandas', 'deap',
23 | ]
24 |
25 | EXTRAS = {
26 | 'docs': ['sphinx', 'sphinx_rtd_theme'],
27 | 'test': ['pytest', 'pytest-cov'],
28 | }
29 |
30 | LDESCRIPTION = (
31 | "GRAPE is a Python package that takes advantage of Graph Theory "
32 | "into a High Performance Computing (HPC) environment to develop a "
33 | "screening tool aimed at studying the effect of different kinds of "
34 | "perturbations in interconnected systems, such as indsutrial plants."
35 | "\n"
36 | "The tool allows to represent the dependencies between components and "
37 | "predict the state of health and the residual functionality of degradable "
38 | "systems after a damage, suggesting the proper reconfiguration strategies "
39 | "to mitigate it. The results obtained from the graph analysis can be "
40 | "therefore used to improve topology, robustness, and resilience profile "
41 | "of industrial facilities against domino effect propagation."
42 | "In particular, the components contribution to the cascade effects "
43 | "resulting from adverse events can be evaluated through centrality and "
44 | "efficiency measures, highlighting the plants major criticalities, "
45 | "vulnerabilities and potential weak points."
46 | "\n"
47 | "Considering that the most computationally expensive parts of the program "
48 | "involve the calculation of shortest paths, parallelization of shortest "
49 | "path computation in large unweighted graphs was integrated in the "
50 | "program. This was done taking advantage of the Python module "
51 | "multiprocessing. Two different sequential algorithms for the solution of "
52 | "the shortest path problem have been parallelized including a Single "
53 | "Source Shortest Path (SSSP) algorythm for sparse graphs and an All Pairs "
54 | "Shortest Path one (APSP) for dense graphs.\n"
55 | )
56 |
57 | setup(
58 | name=PIPNAME,
59 | version=VERSION,
60 | description=DESCRIPTION,
61 | long_description=LDESCRIPTION,
62 | author=AUTHOR,
63 | author_email=MAIL,
64 | classifiers=[
65 | 'Development Status :: 5 - Production/Stable',
66 | 'License :: OSI Approved :: MIT License',
67 | 'Programming Language :: Python :: 3.6',
68 | 'Intended Audience :: Science/Research',
69 | 'Topic :: Scientific/Engineering :: Mathematics'
70 | ],
71 | keywords=KEYWORDS,
72 | url=URL,
73 | license='MIT',
74 | packages=find_packages(),
75 | install_requires=REQUIRED,
76 | extras_require=EXTRAS,
77 | include_package_data=True,
78 | zip_safe=False
79 | )
80 |
--------------------------------------------------------------------------------
/tests/TOY_graph.csv:
--------------------------------------------------------------------------------
1 | mark,father_mark,init_status,description,type,weight,initial_service
2 | "1","NULL",,,"SOURCE",1.0,1.0
3 | "2","1",1,,"SWITCH",1.0,0.0
4 | "3","1",1,,"SWITCH",1.0,0.0
5 | "4","2",,,"HUB",1.0,0.0
6 | "5","3",,,"HUB",1.0,0.0
7 | "6","4",,,"HUB",1.0,0.0
8 | "6","7",,,"HUB",1.0,0.0
9 | "7","6",,,"HUB",1.0,0.0
10 | "8","6",,,"HUB",1.0,0.0
11 | "6","8",,,"HUB",1.0,0.0
12 | "9","8",,,"HUB",1.0,0.0
13 | "9","15",,,"HUB",1.0,0.0
14 | "15","NULL",,,"SOURCE",1.0,2.0
15 | "16","9",,,"HUB",1.0,0.0
16 | "16","17",,,"HUB",1.0,0.0
17 | "17","16",,,"HUB",1.0,0.0
18 | "10","17",,,"HUB",1.0,0.0
19 | "11","10",,,"HUB",1.0,0.0
20 | "11","5",,,"HUB",1.0,0.0
21 | "19","11",,,"HUB",1.0,0.0
22 | "19","12",,,"HUB",1.0,0.0
23 | "19","14",,,"HUB",1.0,0.0
24 | "12","19",,,"HUB",1.0,0.0
25 | "12","13",,,"HUB",1.0,0.0
26 | "13","14",,,"HUB",1.0,0.0
27 | "13","12",,,"HUB",1.0,0.0
28 | "14","19",,,"HUB",1.0,0.0
29 | "14","13",,,"HUB",1.0,0.0
30 | "18","14",,,"USER",1.0,0.0
31 |
--------------------------------------------------------------------------------
/tests/TOY_graph_one_node.csv:
--------------------------------------------------------------------------------
1 | mark,father_mark,init_status,description,type,weight,initial_service
2 | "1","NULL",,,"SOURCE",1.0,1.0
3 |
--------------------------------------------------------------------------------
/tests/__init__.py:
--------------------------------------------------------------------------------
1 | import matplotlib
2 |
3 | matplotlib.use('Agg')
4 |
--------------------------------------------------------------------------------
/tests/general_graph.py:
--------------------------------------------------------------------------------
1 | from unittest import TestCase
2 | from .grape import GeneralGraph
3 |
4 |
5 | class TestGeneralGraph(TestCase):
6 | """
7 | Class TestGeneralGraph to check creating an instance of
8 | GeneralGraph object
9 | """
10 | def create_instance(self):
11 | GeneralGraph()
12 |
--------------------------------------------------------------------------------
/tests/test_fault_diagnosis.py:
--------------------------------------------------------------------------------
1 | """TestFaultDiagnosis to check FaultDiagnosis"""
2 |
3 | from unittest import TestCase
4 | import numpy as np
5 | from grape.fault_diagnosis import FaultDiagnosis
6 |
7 |
8 | def test_closeness_centrality_after_element_perturbation():
9 | """
10 | The following test checks the closeness centrality after a perturbation.
11 | The perturbation here considered is the perturbation of element '1'.
12 | """
13 | F = FaultDiagnosis("tests/TOY_graph.csv")
14 | F.simulate_element_perturbation(["1"])
15 |
16 | clo_cen_after_element_perturbation = {
17 | '2': 0,
18 | '3': 0,
19 | '4': 0.058823529411764705,
20 | '5': 0.058823529411764705,
21 | '6': 0.18823529411764706,
22 | '7': 0.11764705882352941,
23 | '8': 0.11764705882352941,
24 | '9': 0.15126050420168066,
25 | '10': 0.12538699690402477,
26 | '11': 0.1660899653979239,
27 | '12': 0.1859114015976761,
28 | '13': 0.16020025031289112,
29 | '14': 0.1859114015976761,
30 | '15': 0,
31 | '16': 0.1711229946524064,
32 | '17': 0.12981744421906694,
33 | '18': 0.17346938775510204,
34 | '19': 0.22145328719723184
35 | }
36 |
37 | np.testing.assert_array_almost_equal(
38 | np.asarray(sorted(clo_cen_after_element_perturbation.values())),
39 | np.asarray(sorted(F.G.closeness_centrality.values())),
40 | err_msg="FINAL CLOSENESS CENTRALITY failure: perturbation of element 1")
41 |
42 | def test_closeness_centrality_after_element_perturbation_parallel():
43 | """
44 | The following test checks the closeness centrality after a perturbation.
45 | The perturbation here considered is the perturbation of element '1'.
46 | This time, in FaultDiagnosis class we set parallel flag as True.
47 | """
48 | F = FaultDiagnosis("tests/TOY_graph.csv", parallel=True)
49 | F.simulate_element_perturbation(["1"])
50 |
51 | clo_cen_after_element_perturbation = {
52 | '2': 0,
53 | '3': 0,
54 | '4': 0.058823529411764705,
55 | '5': 0.058823529411764705,
56 | '6': 0.18823529411764706,
57 | '7': 0.11764705882352941,
58 | '8': 0.11764705882352941,
59 | '9': 0.15126050420168066,
60 | '10': 0.12538699690402477,
61 | '11': 0.1660899653979239,
62 | '12': 0.1859114015976761,
63 | '13': 0.16020025031289112,
64 | '14': 0.1859114015976761,
65 | '15': 0,
66 | '16': 0.1711229946524064,
67 | '17': 0.12981744421906694,
68 | '18': 0.17346938775510204,
69 | '19': 0.22145328719723184
70 | }
71 |
72 | np.testing.assert_array_almost_equal(
73 | np.asarray(sorted(clo_cen_after_element_perturbation.values())),
74 | np.asarray(sorted(F.G.closeness_centrality.values())),
75 | err_msg="FINAL CLOSENESS CENTRALITY failure: perturbation of element 1")
76 |
77 | def test_degree_centrality_after_element_perturbation():
78 | """
79 | The following test checks the degree centrality after a perturbation.
80 | The perturbation here considered is the perturbation of element '1'.
81 | """
82 | F = FaultDiagnosis("tests/TOY_graph.csv")
83 | F.simulate_element_perturbation(["1"])
84 |
85 | deg_cen_after_element_perturbation = {
86 | '2': 0.058823529411764705,
87 | '3': 0.058823529411764705,
88 | '4': 0.11764705882352941,
89 | '5': 0.11764705882352941,
90 | '6': 0.29411764705882354,
91 | '7': 0.11764705882352941,
92 | '8': 0.17647058823529413,
93 | '9': 0.17647058823529413,
94 | '10': 0.11764705882352941,
95 | '11': 0.17647058823529413,
96 | '12': 0.23529411764705882,
97 | '13': 0.23529411764705882,
98 | '14': 0.29411764705882354,
99 | '15': 0.058823529411764705,
100 | '16': 0.17647058823529413,
101 | '17': 0.17647058823529413,
102 | '18': 0.058823529411764705,
103 | '19': 0.29411764705882354
104 | }
105 |
106 | np.testing.assert_array_almost_equal(
107 | np.asarray(sorted(deg_cen_after_element_perturbation.values())),
108 | np.asarray(sorted(F.G.degree_centrality.values())),
109 | err_msg="FINAL DEGREE CENTRALITY failure: perturbation of element 1")
110 |
111 | def test_indegree_centrality_after_element_perturbation():
112 | """
113 | The following test checks the indegree centrality after a perturbation.
114 | The perturbation here considered is the perturbation of element '1'.
115 | """
116 | F = FaultDiagnosis("tests/TOY_graph.csv")
117 | F.simulate_element_perturbation(["1"])
118 |
119 | indeg_cen_after_element_perturbation = {
120 | '2': 0.0,
121 | '3': 0.0,
122 | '4': 0.058823529411764705,
123 | '5': 0.058823529411764705,
124 | '6': 0.17647058823529413,
125 | '7': 0.058823529411764705,
126 | '8': 0.058823529411764705,
127 | '9': 0.11764705882352941,
128 | '10': 0.058823529411764705,
129 | '11': 0.11764705882352941,
130 | '12': 0.11764705882352941,
131 | '13': 0.11764705882352941,
132 | '14': 0.11764705882352941,
133 | '15': 0.0,
134 | '16': 0.11764705882352941,
135 | '17': 0.058823529411764705,
136 | '18': 0.058823529411764705,
137 | '19': 0.17647058823529413
138 | }
139 |
140 | np.testing.assert_array_almost_equal(
141 | np.asarray(sorted(indeg_cen_after_element_perturbation.values())),
142 | np.asarray(sorted(F.G.indegree_centrality.values())),
143 | err_msg="FINAL INDEGREE CENTRALITY failure: perturbation of element 1")
144 |
145 | def test_outdegree_centrality_after_element_perturbation():
146 | """
147 | The following test checks the outdegree centrality after a perturbation.
148 | The perturbation here considered is the perturbation of element '1'.
149 | """
150 | F = FaultDiagnosis("tests/TOY_graph.csv")
151 | F.simulate_element_perturbation(["1"])
152 |
153 | outdeg_cen_after_element_perturbation = {
154 | '2': 0.058823529411764705,
155 | '3': 0.058823529411764705,
156 | '4': 0.058823529411764705,
157 | '5': 0.058823529411764705,
158 | '6': 0.11764705882352941,
159 | '7': 0.058823529411764705,
160 | '8': 0.11764705882352941,
161 | '9': 0.058823529411764705,
162 | '10': 0.058823529411764705,
163 | '11': 0.058823529411764705,
164 | '12': 0.11764705882352941,
165 | '13': 0.11764705882352941,
166 | '14': 0.17647058823529413,
167 | '15': 0.058823529411764705,
168 | '16': 0.058823529411764705,
169 | '17': 0.11764705882352941,
170 | '18': 0.0,
171 | '19': 0.11764705882352941
172 | }
173 |
174 | np.testing.assert_array_almost_equal(
175 | np.asarray(sorted(outdeg_cen_after_element_perturbation.values())),
176 | np.asarray(sorted(F.G.outdegree_centrality.values())),
177 | err_msg="FINAL OUTDEGREE CENTRALITY failure: perturbation of element 1")
178 |
179 | def test_nodal_efficiency_after_element_perturbation():
180 | """
181 | The following test checks the nodal efficiency after a perturbation.
182 | The perturbation here considered is the perturbation of element '1'.
183 | """
184 | F = FaultDiagnosis("tests/TOY_graph.csv")
185 | F.simulate_element_perturbation(["1"])
186 |
187 | nodal_eff_after_element_perturbation = {
188 | '2': 0.20847763347763348,
189 | '3': 0.1607843137254902,
190 | '4': 0.21412231559290384,
191 | '5': 0.1568627450980392,
192 | '6': 0.2391223155929038,
193 | '7': 0.18471055088702149,
194 | '8': 0.2638655462184874,
195 | '9': 0.17072829131652661,
196 | '10': 0.1568627450980392,
197 | '11': 0.1568627450980392,
198 | '12': 0.16666666666666666,
199 | '13': 0.17647058823529413,
200 | '14': 0.20588235294117646,
201 | '15': 0.17563025210084035,
202 | '16': 0.16568627450980392,
203 | '17': 0.21960784313725493,
204 | '18': 0.0,
205 | '19': 0.17647058823529413
206 | }
207 |
208 | np.testing.assert_array_almost_equal(
209 | np.asarray(sorted(nodal_eff_after_element_perturbation.values())),
210 | np.asarray(sorted(F.G.nodal_efficiency.values())),
211 | err_msg="FINAL NODAL EFFICIENCY failure: perturbation of element 1")
212 |
213 | def test_local_efficiency_after_element_perturbation():
214 | """
215 | The following test checks the local efficiency after a perturbation.
216 | The perturbation here considered is the perturbation of element '1'.
217 | """
218 | F = FaultDiagnosis("tests/TOY_graph.csv")
219 | F.simulate_element_perturbation(["1"])
220 |
221 | local_eff_after_element_perturbation = {
222 | '2': 0.21412231559290384,
223 | '3': 0.1568627450980392,
224 | '4': 0.2391223155929038,
225 | '5': 0.1568627450980392,
226 | '6': 0.22428804855275444,
227 | '7': 0.2391223155929038,
228 | '8': 0.2049253034547152,
229 | '9': 0.16568627450980392,
230 | '10': 0.1568627450980392,
231 | '11': 0.17647058823529413,
232 | '12': 0.17647058823529413,
233 | '13': 0.18627450980392157,
234 | '14': 0.11764705882352942,
235 | '15': 0.17072829131652661,
236 | '16': 0.21960784313725493,
237 | '17': 0.16127450980392155,
238 | '18': 0.0,
239 | '19': 0.18627450980392157
240 | }
241 |
242 | np.testing.assert_array_almost_equal(
243 | np.asarray(sorted(local_eff_after_element_perturbation.values())),
244 | np.asarray(sorted(F.G.local_efficiency.values())),
245 | err_msg="FINAL LOCAL EFFICIENCY failure: perturbation of element 1")
246 |
247 | def test_global_efficiency_after_element_perturbation():
248 | """
249 | The following test checks the nodal efficiency after a perturbation.
250 | The perturbation here considered is the perturbation of element '1'.
251 | """
252 | F = FaultDiagnosis("tests/TOY_graph.csv")
253 | F.simulate_element_perturbation(["1"])
254 |
255 | np.testing.assert_almost_equal(F.G.global_efficiency, 0.17771187599618973,
256 | err_msg="FINAL GLOBAL EFFICIENCY failure: perturbation of element 1")
257 |
258 | def test_residual_service_after_element_perturbation():
259 | """
260 | The following test checks the residual service after a perturbation.
261 | The perturbation here considered is the perturbation of element '1'.
262 | """
263 | F = FaultDiagnosis("tests/TOY_graph.csv")
264 | F.simulate_element_perturbation(["1"])
265 |
266 | res_service_after_element_perturbation = {
267 | '2': 0.0,
268 | '3': 0.0,
269 | '4': 0.0,
270 | '5': 0.0,
271 | '6': 0.0,
272 | '7': 0.0,
273 | '8': 0.0,
274 | '9': 0.0,
275 | '10': 0.0,
276 | '11': 0.0,
277 | '12': 0.0,
278 | '13': 0.0,
279 | '14': 0.0,
280 | '15': 0.0,
281 | '16': 0.0,
282 | '17': 0.0,
283 | '18': 2.0,
284 | '19': 0.0
285 | }
286 |
287 | np.testing.assert_array_almost_equal(
288 | np.asarray(sorted(res_service_after_element_perturbation.values())),
289 | np.asarray(sorted(F.G.service.values())),
290 | err_msg="FINAL RESIDUAL SERVICE failure: perturbation of element 1")
291 |
292 | class Test_FD(TestCase):
293 | """
294 | Class Test_FD to check other FaultDiagnosis attributes.
295 | """
296 |
297 | def test_check_input_with_gephi_mark(self):
298 | """
299 | The following test checks mark attribute of edges_df member
300 | of FaultDiagnosis class.
301 | """
302 | F = FaultDiagnosis("tests/TOY_graph.csv")
303 | F.check_input_with_gephi()
304 | edges_dict = F.edges_df.to_dict()
305 |
306 | mark_dict = {
307 | 1: '2',
308 | 2: '3',
309 | 3: '4',
310 | 4: '5',
311 | 5: '6',
312 | 6: '6',
313 | 7: '7',
314 | 8: '8',
315 | 9: '6',
316 | 10: '9',
317 | 11: '9',
318 | 13: '16',
319 | 14: '16',
320 | 15: '17',
321 | 16: '10',
322 | 17: '11',
323 | 18: '11',
324 | 19: '19',
325 | 20: '19',
326 | 21: '19',
327 | 22: '12',
328 | 23: '12',
329 | 24: '13',
330 | 25: '13',
331 | 26: '14',
332 | 27: '14',
333 | 28: '18'
334 | }
335 |
336 | self.assertDictEqual(
337 | mark_dict,
338 | edges_dict['mark'],
339 | msg="MARK failure: check_input_with_gephi function")
340 |
341 | def test_check_input_with_gephi_father_mark(self):
342 | """
343 | The following test checks father_mark attribute of edges_df member
344 | of FaultDiagnosis class.
345 | """
346 | F = FaultDiagnosis("tests/TOY_graph.csv")
347 | F.check_input_with_gephi()
348 | edges_dict = F.edges_df.to_dict()
349 |
350 | father_mark_dict = {
351 | 1: '1',
352 | 2: '1',
353 | 3: '2',
354 | 4: '3',
355 | 5: '4',
356 | 6: '7',
357 | 7: '6',
358 | 8: '6',
359 | 9: '8',
360 | 10: '8',
361 | 11: '15',
362 | 13: '9',
363 | 14: '17',
364 | 15: '16',
365 | 16: '17',
366 | 17: '10',
367 | 18: '5',
368 | 19: '11',
369 | 20: '12',
370 | 21: '14',
371 | 22: '19',
372 | 23: '13',
373 | 24: '14',
374 | 25: '12',
375 | 26: '19',
376 | 27: '13',
377 | 28: '14'
378 | }
379 |
380 | self.assertDictEqual(
381 | father_mark_dict,
382 | edges_dict['father_mark'],
383 | msg="FATHER MARK failure: check_input_with_gephi function")
384 |
385 | def test_mark_status_after_element_perturbation(self):
386 | """
387 | The following test checks mark_status attribute after a perturbation.
388 | The perturbation here considered is the perturbation of element '1'.
389 | """
390 | F = FaultDiagnosis("tests/TOY_graph.csv")
391 | F.simulate_element_perturbation(["1"])
392 |
393 | mark_status_after_element_perturbation = {
394 | '2': 'ACTIVE',
395 | '3': 'ACTIVE',
396 | '4': 'ACTIVE',
397 | '5': 'ACTIVE',
398 | '6': 'ACTIVE',
399 | '7': 'ACTIVE',
400 | '8': 'ACTIVE',
401 | '9': 'ACTIVE',
402 | '10': 'ACTIVE',
403 | '11': 'ACTIVE',
404 | '12': 'ACTIVE',
405 | '13': 'ACTIVE',
406 | '14': 'ACTIVE',
407 | '15': 'ACTIVE',
408 | '16': 'ACTIVE',
409 | '17': 'ACTIVE',
410 | '18': 'ACTIVE',
411 | '19': 'ACTIVE'
412 | }
413 |
414 | self.assertDictEqual(
415 | mark_status_after_element_perturbation,
416 | F.G.mark_status,
417 | msg="FINAL MARK STATUS failure: perturbation of element 1")
418 |
--------------------------------------------------------------------------------
/tests/test_input_graph.py:
--------------------------------------------------------------------------------
1 | """TestInputGraph to check input of GeneralGraph"""
2 |
3 | from unittest import TestCase
4 | from grape.general_graph import GeneralGraph
5 |
6 |
7 | class TestInputGraph(TestCase):
8 | """
9 | Class TestInputGraph to check input of GeneralGraph
10 | """
11 |
12 | def test_Mark(self):
13 | """
14 | Unittest check for mark attribute of GeneralGraph:
15 | correct input reading.
16 | """
17 | g = GeneralGraph()
18 | g.load("tests/TOY_graph.csv")
19 |
20 | mark_dict = {
21 | '1': '1',
22 | '2': '2',
23 | '3': '3',
24 | '4': '4',
25 | '5': '5',
26 | '6': '6',
27 | '7': '7',
28 | '8': '8',
29 | '9': '9',
30 | '10': '10',
31 | '11': '11',
32 | '12': '12',
33 | '13': '13',
34 | '14': '14',
35 | '15': '15',
36 | '16': '16',
37 | '17': '17',
38 | '18': '18',
39 | '19': '19'
40 | }
41 |
42 | self.assertDictEqual(mark_dict, g.mark, msg="Wrong MARK in input")
43 |
44 | def test_init_status(self):
45 | """
46 | Unittest check for init_status attribute of GeneralGraph:
47 | correct input reading.
48 | """
49 | g = GeneralGraph()
50 | g.load("tests/TOY_graph.csv")
51 |
52 | init_status_dict = {'2': True, '3': True}
53 |
54 | self.assertDictEqual(init_status_dict, g.init_status,
55 | msg="Wrong INIT STATUS in input")
56 |
57 | def test_description(self):
58 | """
59 | Unittest check for description attribute of GeneralGraph:
60 | correct input reading.
61 | """
62 | g = GeneralGraph()
63 | g.load("tests/TOY_graph.csv")
64 |
65 | description_dict = {
66 | '1': '',
67 | '2': '',
68 | '3': '',
69 | '4': '',
70 | '5': '',
71 | '6': '',
72 | '7': '',
73 | '8': '',
74 | '9': '',
75 | '10': '',
76 | '11': '',
77 | '12': '',
78 | '13': '',
79 | '14': '',
80 | '15': '',
81 | '16': '',
82 | '17': '',
83 | '18': '',
84 | '19': ''
85 | }
86 |
87 | self.assertDictEqual(description_dict, g.description,
88 | msg=" Wrong DESCRIPTION in input ")
89 |
90 | def test_type(self):
91 | """
92 | Unittest check for type attribute of GeneralGraph:
93 | correct input reading.
94 | """
95 | g = GeneralGraph()
96 | g.load("tests/TOY_graph.csv")
97 |
98 | type_dict = {
99 | '1': 'SOURCE',
100 | '2': 'SWITCH',
101 | '3': 'SWITCH',
102 | '4': 'HUB',
103 | '5': 'HUB',
104 | '6': 'HUB',
105 | '7': 'HUB',
106 | '8': 'HUB',
107 | '9': 'HUB',
108 | '10': 'HUB',
109 | '11': 'HUB',
110 | '12': 'HUB',
111 | '13': 'HUB',
112 | '14': 'HUB',
113 | '15': 'SOURCE',
114 | '16': 'HUB',
115 | '17': 'HUB',
116 | '18': 'USER',
117 | '19': 'HUB'
118 | }
119 |
120 | self.assertDictEqual(type_dict, g.type, msg="Wrong TYPE in input")
121 |
122 | def test_weight(self):
123 | """
124 | Unittest check for Weight attribute of GeneralGraph:
125 | correct input reading.
126 | """
127 | g = GeneralGraph()
128 | g.load("tests/TOY_graph.csv")
129 |
130 | weight_dict = {
131 | ('1', '2'): 1.0,
132 | ('1', '3'): 1.0,
133 | ('2', '4'): 1.0,
134 | ('3', '5'): 1.0,
135 | ('4', '6'): 1.0,
136 | ('5', '11'): 1.0,
137 | ('6', '7'): 1.0,
138 | ('6', '8'): 1.0,
139 | ('7', '6'): 1.0,
140 | ('8', '6'): 1.0,
141 | ('8', '9'): 1.0,
142 | ('9', '16'): 1.0,
143 | ('15', '9'): 1.0,
144 | ('16', '17'): 1.0,
145 | ('17', '16'): 1.0,
146 | ('17', '10'): 1.0,
147 | ('10', '11'): 1.0,
148 | ('11', '19'): 1.0,
149 | ('19', '12'): 1.0,
150 | ('19', '14'): 1.0,
151 | ('12', '19'): 1.0,
152 | ('12', '13'): 1.0,
153 | ('14', '19'): 1.0,
154 | ('14', '13'): 1.0,
155 | ('14', '18'): 1.0,
156 | ('13', '12'): 1.0,
157 | ('13', '14'): 1.0
158 | }
159 |
160 | self.assertDictEqual(weight_dict, g.weight, msg="Wrong WEIGHT in input")
161 |
162 | def test_initial_service(self):
163 | """
164 | Unittest check for initial_service attribute of GeneralGraph:
165 | correct input reading.
166 | """
167 | g = GeneralGraph()
168 | g.load("tests/TOY_graph.csv")
169 |
170 | initial_service_dict = {
171 | '1': 1.0,
172 | '2': 0.0,
173 | '3': 0.0,
174 | '4': 0.0,
175 | '5': 0.0,
176 | '6': 0.0,
177 | '7': 0.0,
178 | '8': 0.0,
179 | '9': 0.0,
180 | '10': 0.0,
181 | '11': 0.0,
182 | '12': 0.0,
183 | '13': 0.0,
184 | '14': 0.0,
185 | '15': 2.0,
186 | '16': 0.0,
187 | '17': 0.0,
188 | '18': 0.0,
189 | '19': 0.0
190 | }
191 |
192 | self.assertDictEqual(initial_service_dict, g.initial_service,
193 | msg=" Wrong INITIAL SERVICE in input ")
194 |
195 | def test_initial_sources(self):
196 | """
197 | Unittest check for sources of GeneralGraph: correct input reading.
198 | """
199 | g = GeneralGraph()
200 | g.load("tests/TOY_graph.csv")
201 |
202 | self.assertEqual(['1', '15'], g.sources, msg=" Wrong SOURCES in input ")
203 |
204 | def test_initial_hubs(self):
205 | """
206 | Unittest check for hubs of GeneralGraph: correct input reading.
207 | """
208 | g = GeneralGraph()
209 | g.load("tests/TOY_graph.csv")
210 |
211 | self.assertEqual(['4', '5', '6', '7', '8', '9', '16', '17', '10', '11',
212 | '19', '12', '14', '13'], g.hubs, msg=" Wrong HUBS in input ")
213 |
214 | def test_initial_users(self):
215 | """
216 | Unittest check for users of GeneralGraph: correct input reading.
217 | """
218 | g = GeneralGraph()
219 | g.load("tests/TOY_graph.csv")
220 |
221 | self.assertEqual(['18'], g.users, msg=" Wrong USERS in input ")
222 |
223 | def test_initial_switches(self):
224 | """
225 | Unittest check for switches of GeneralGraph: correct input reading.
226 | """
227 | g = GeneralGraph()
228 | g.load("tests/TOY_graph.csv")
229 |
230 | self.assertEqual(['2', '3'], g.switches,
231 | msg=" Wrong SWITCHES in input ")
232 |
--------------------------------------------------------------------------------
/tests/test_integer_graph.py:
--------------------------------------------------------------------------------
1 | """TestOutputGraph to check output of GeneralGraph"""
2 |
3 | from unittest import TestCase
4 | from unittest import mock
5 | import math
6 | import numpy as np
7 | import matplotlib.pyplot as plt
8 | from grape.general_graph import GeneralGraph
9 | import grape.general_graph as my_module
10 |
11 |
12 | def test_nodal_efficiency():
13 | """
14 | The following test checks nodal efficiency before any perturbation.
15 | """
16 | g = GeneralGraph()
17 | g.load("tests/TOY_graph.csv")
18 |
19 | nodal_eff_before = {
20 | '1': 0.3213624338624339,
21 | '2': 0.19689554272887605,
22 | '3': 0.15185185185185185,
23 | '4': 0.20222663139329808,
24 | '5': 0.14814814814814814,
25 | '6': 0.22583774250440916,
26 | '7': 0.17444885361552032,
27 | '8': 0.2492063492063492,
28 | '9': 0.16124338624338624,
29 | '10': 0.14814814814814814,
30 | '11': 0.14814814814814814,
31 | '12': 0.15740740740740738,
32 | '13': 0.16666666666666666,
33 | '14': 0.19444444444444445,
34 | '15': 0.16587301587301587,
35 | '16': 0.15648148148148147,
36 | '17': 0.20740740740740743,
37 | '18': 0.0,
38 | '19': 0.16666666666666666
39 | }
40 |
41 | np.testing.assert_array_almost_equal(
42 | np.asarray(sorted(nodal_eff_before.values())),
43 | np.asarray(sorted(g.nodal_efficiency.values())),
44 | err_msg="ORIGINAL NODAL EFFICIENCY failure")
45 |
46 | def test_global_efficiency():
47 | """
48 | The following test checks global efficiency before any perturbation.
49 | """
50 | g = GeneralGraph()
51 | g.load("tests/TOY_graph.csv")
52 |
53 | np.testing.assert_almost_equal(g.global_efficiency, 0.1759191750419821,
54 | err_msg="ORIGINAL GLOBAL EFFICIENCY failure")
55 |
56 | def test_local_efficiency():
57 | """
58 | The following test checks local efficiency before any perturbation.
59 | """
60 | g = GeneralGraph()
61 | g.load("tests/TOY_graph.csv")
62 |
63 | local_eff_before = {
64 | '1': 0.17437369729036395,
65 | '2': 0.20222663139329808,
66 | '3': 0.14814814814814814,
67 | '4': 0.22583774250440916,
68 | '5': 0.14814814814814814,
69 | '6': 0.21182760141093476,
70 | '7': 0.22583774250440916,
71 | '8': 0.19354056437389772,
72 | '9': 0.15648148148148147,
73 | '10': 0.14814814814814814,
74 | '11': 0.16666666666666666,
75 | '12': 0.16666666666666666,
76 | '13': 0.17592592592592593,
77 | '14': 0.1111111111111111,
78 | '15': 0.16124338624338624,
79 | '16': 0.20740740740740743,
80 | '17': 0.1523148148148148,
81 | '18': 0.0,
82 | '19': 0.17592592592592593
83 | }
84 |
85 | np.testing.assert_array_almost_equal(
86 | np.asarray(sorted(local_eff_before.values())),
87 | np.asarray(sorted(g.local_efficiency.values())),
88 | err_msg="ORIGINAL LOCAL EFFICIENCY failure")
89 |
90 | def test_closeness_centrality():
91 | """
92 | The following test checks closeness centrality before any perturbation.
93 | """
94 | g = GeneralGraph()
95 | g.load("tests/TOY_graph.csv")
96 |
97 | closeness_centrality = {
98 | '1': 0.0,
99 | '2': 0.05555555555555555,
100 | '3': 0.05555555555555555,
101 | '4': 0.07407407407407407,
102 | '5': 0.07407407407407407,
103 | '6': 0.1736111111111111,
104 | '7': 0.11574074074074076,
105 | '8': 0.11574074074074076,
106 | '9': 0.14327485380116958,
107 | '10': 0.12077294685990338,
108 | '11': 0.17386831275720163,
109 | '12': 0.1866925064599483,
110 | '13': 0.16055555555555556,
111 | '14': 0.1866925064599483,
112 | '15': 0.0,
113 | '16': 0.16071428571428573,
114 | '17': 0.125,
115 | '18': 0.17307692307692307,
116 | '19': 0.22299382716049382
117 | }
118 |
119 | np.testing.assert_array_almost_equal(
120 | np.asarray(sorted(closeness_centrality.values())),
121 | np.asarray(sorted(g.closeness_centrality.values())),
122 | err_msg="CLOSENESS CENTRALITY failure")
123 |
124 | def test_betweenness_centrality():
125 | """
126 | The following test checks betweenness centrality before any perturbation.
127 | """
128 | g = GeneralGraph()
129 | g.load("tests/TOY_graph.csv")
130 |
131 | betweenness_centrality = {
132 | '1': 0.0,
133 | '2': 0.05161290322580645,
134 | '3': 0.04516129032258064,
135 | '4': 0.12903225806451613,
136 | '5': 0.07741935483870968,
137 | '6': 0.2709677419354839,
138 | '7': 0.0,
139 | '8': 0.2838709677419355,
140 | '9': 0.36774193548387096,
141 | '10': 0.34838709677419355,
142 | '11': 0.41935483870967744,
143 | '12': 0.1032258064516129,
144 | '13': 0.0,
145 | '14': 0.10967741935483871,
146 | '15': 0.0,
147 | '16': 0.3741935483870968,
148 | '17': 0.36774193548387096,
149 | '18': 0.0,
150 | '19': 0.38064516129032255
151 | }
152 |
153 | np.testing.assert_array_almost_equal(
154 | np.asarray(sorted(betweenness_centrality.values())),
155 | np.asarray(sorted(g.betweenness_centrality.values())),
156 | err_msg="BETWENNESS CENTRALITY failure")
157 |
158 | def test_indegree_centrality():
159 | """
160 | The following test checks indegree centrality before any perturbation.
161 | """
162 | g = GeneralGraph()
163 | g.load("tests/TOY_graph.csv")
164 |
165 | indegree_centrality = {
166 | '1': 0.0,
167 | '2': 0.05555555555555555,
168 | '3': 0.05555555555555555,
169 | '4': 0.05555555555555555,
170 | '5': 0.05555555555555555,
171 | '6': 0.16666666666666666,
172 | '7': 0.05555555555555555,
173 | '8': 0.05555555555555555,
174 | '9': 0.1111111111111111,
175 | '10': 0.05555555555555555,
176 | '11': 0.1111111111111111,
177 | '12': 0.1111111111111111,
178 | '13': 0.1111111111111111,
179 | '14': 0.1111111111111111,
180 | '15': 0.0,
181 | '16': 0.1111111111111111,
182 | '17': 0.05555555555555555,
183 | '18': 0.05555555555555555,
184 | '19': 0.16666666666666666
185 | }
186 |
187 | np.testing.assert_array_almost_equal(
188 | np.asarray(sorted(indegree_centrality.values())),
189 | np.asarray(sorted(g.indegree_centrality.values())),
190 | err_msg="INDEGREE CENTRALITY failure")
191 |
192 | def test_outdegree_centrality():
193 | """
194 | The following test checks outdegree centrality before any perturbation.
195 | """
196 | g = GeneralGraph()
197 | g.load("tests/TOY_graph.csv")
198 |
199 | outdegree_centrality = {
200 | '1': 0.1111111111111111,
201 | '2': 0.05555555555555555,
202 | '3': 0.05555555555555555,
203 | '4': 0.05555555555555555,
204 | '5': 0.05555555555555555,
205 | '6': 0.1111111111111111,
206 | '7': 0.05555555555555555,
207 | '8': 0.1111111111111111,
208 | '9': 0.05555555555555555,
209 | '10': 0.05555555555555555,
210 | '11': 0.05555555555555555,
211 | '12': 0.1111111111111111,
212 | '13': 0.1111111111111111,
213 | '14': 0.16666666666666666,
214 | '15': 0.05555555555555555,
215 | '16': 0.05555555555555555,
216 | '17': 0.1111111111111111,
217 | '18': 0.0,
218 | '19': 0.1111111111111111
219 | }
220 |
221 | np.testing.assert_array_almost_equal(
222 | np.asarray(sorted(outdegree_centrality.values())),
223 | np.asarray(sorted(g.outdegree_centrality.values())),
224 | err_msg="OUTDEGREE CENTRALITY failure")
225 |
226 | def test_degree_centrality():
227 | """
228 | The following test checks degree centrality before any perturbation.
229 | """
230 | g = GeneralGraph()
231 | g.load("tests/TOY_graph.csv")
232 |
233 | degree_centrality = {
234 | '1': 0.1111111111111111,
235 | '2': 0.1111111111111111,
236 | '3': 0.1111111111111111,
237 | '4': 0.1111111111111111,
238 | '5': 0.1111111111111111,
239 | '6': 0.2777777777777778,
240 | '7': 0.1111111111111111,
241 | '8': 0.16666666666666666,
242 | '9': 0.16666666666666666,
243 | '10': 0.1111111111111111,
244 | '11': 0.16666666666666666,
245 | '12': 0.2222222222222222,
246 | '13': 0.2222222222222222,
247 | '14': 0.2777777777777778,
248 | '15': 0.05555555555555555,
249 | '16': 0.16666666666666666,
250 | '17': 0.16666666666666666,
251 | '18': 0.05555555555555555,
252 | '19': 0.2777777777777778
253 | }
254 |
255 | np.testing.assert_array_almost_equal(
256 | np.asarray(sorted(degree_centrality.values())),
257 | np.asarray(sorted(g.degree_centrality.values())),
258 | err_msg="DEGREE CENTRALITY failure")
259 |
260 | def test_service():
261 | """
262 | The following test the original service, before the graph
263 | experiences any kind of perturbation.
264 | """
265 | g = GeneralGraph()
266 | g.load("tests/TOY_graph.csv")
267 |
268 | original_service = {
269 | '1': 0.0,
270 | '2': 0.0,
271 | '3': 0.0,
272 | '4': 0.0,
273 | '5': 0.0,
274 | '6': 0.0,
275 | '7': 0.0,
276 | '8': 0.0,
277 | '9': 0.0,
278 | '10': 0.0,
279 | '11': 0.0,
280 | '12': 0.0,
281 | '13': 0.0,
282 | '14': 0.0,
283 | '15': 0.0,
284 | '16': 0.0,
285 | '17': 0.0,
286 | '18': 3.0,
287 | '19': 0.0
288 | }
289 |
290 | np.testing.assert_array_almost_equal(
291 | np.asarray(sorted(original_service.values())),
292 | np.asarray(sorted(g.service.values())),
293 | err_msg="ORIGINAL SERVICE failure")
294 |
295 | @mock.patch("%s.my_module.plt" % __name__)
296 | def test_print_graph(mock_plt):
297 | """
298 | The following test checks that the number of figures has increased.
299 | """
300 | g = my_module.GeneralGraph()
301 | g.load("tests/TOY_graph.csv")
302 | g.print_graph(radius=10./math.sqrt(len(g)), title='TOY graph')
303 |
304 | # Assert plt.show got called once
305 | mock_plt.show.assert_called_once()
306 |
307 | class Unittests(TestCase):
308 |
309 | def test_clear_non_existing_attribute(self):
310 | """
311 | The following test the error for trying to delete an attribute of
312 | GeneralGraph that does not exist.
313 | """
314 | g = GeneralGraph()
315 | g.load("tests/TOY_graph.csv")
316 |
317 | with self.assertRaises(ValueError):
318 | g.clear_data('non_existing_attribute')
319 |
320 | def test_ValueError_global_efficiency(self):
321 | """
322 | The following test the error for trying to compute global efficiency
323 | for a graph of one node.
324 | """
325 | g = GeneralGraph()
326 | g.load("tests/TOY_graph_one_node.csv")
327 |
328 | with self.assertRaises(ValueError):
329 | g.global_efficiency
330 |
331 | def test_ValueError_nodal_efficiency(self):
332 | """
333 | The following test the error for trying to compute nodal efficiency
334 | for a graph of one node.
335 | """
336 | g = GeneralGraph()
337 | g.load("tests/TOY_graph_one_node.csv")
338 |
339 | with self.assertRaises(ValueError):
340 | g.nodal_efficiency
341 |
342 | def test_ValueError_closeness_centrality(self):
343 | """
344 | The following test the error for trying to compute closeness centrality
345 | for a graph of one node.
346 | """
347 | g = GeneralGraph()
348 | g.load("tests/TOY_graph_one_node.csv")
349 |
350 | with self.assertRaises(ValueError):
351 | g.closeness_centrality
352 |
353 | def test_ValueError_degree_centrality(self):
354 | """
355 | The following test the error for trying to compute degree centrality
356 | for a graph of one node.
357 | """
358 | g = GeneralGraph()
359 | g.load("tests/TOY_graph_one_node.csv")
360 |
361 | with self.assertRaises(ValueError):
362 | g.degree_centrality
363 |
364 | def test_ValueError_indegree_centrality(self):
365 | """
366 | The following test the error for trying to compute indegree centrality
367 | for a graph of one node.
368 | """
369 | g = GeneralGraph()
370 | g.load("tests/TOY_graph_one_node.csv")
371 |
372 | with self.assertRaises(ValueError):
373 | g.indegree_centrality
374 |
375 | def test_ValueError_outdegree_centrality(self):
376 | """
377 | The following test the error for trying to compute outdegree centrality
378 | for a graph of one node.
379 | """
380 | g = GeneralGraph()
381 | g.load("tests/TOY_graph_one_node.csv")
382 |
383 | with self.assertRaises(ValueError):
384 | g.outdegree_centrality
385 |
386 | def test_ValueError_print_graph(self):
387 | """
388 | The following test the error for trying to print the graph with fixed
389 | nodes without providing initial positions.
390 | """
391 | g = GeneralGraph()
392 | g.load("tests/TOY_graph.csv")
393 |
394 | with self.assertRaises(ValueError):
395 | g.print_graph(fixed_nodes=list(g))
396 |
--------------------------------------------------------------------------------
/tests/test_parallel_integer_graph.py:
--------------------------------------------------------------------------------
1 | """TestOutputGraph to check output of GeneralGraph"""
2 |
3 | import numpy as np
4 | from grape.parallel_general_graph import ParallelGeneralGraph
5 |
6 |
7 | def test_nodal_efficiency():
8 | """
9 | The following test checks nodal efficiency before any perturbation.
10 | """
11 | g = ParallelGeneralGraph()
12 | g.load("tests/TOY_graph.csv")
13 |
14 | nodal_eff_before = {
15 | '1': 0.3213624338624339,
16 | '2': 0.19689554272887605,
17 | '3': 0.15185185185185185,
18 | '4': 0.20222663139329808,
19 | '5': 0.14814814814814814,
20 | '6': 0.22583774250440916,
21 | '7': 0.17444885361552032,
22 | '8': 0.2492063492063492,
23 | '9': 0.16124338624338624,
24 | '10': 0.14814814814814814,
25 | '11': 0.14814814814814814,
26 | '12': 0.15740740740740738,
27 | '13': 0.16666666666666666,
28 | '14': 0.19444444444444445,
29 | '15': 0.16587301587301587,
30 | '16': 0.15648148148148147,
31 | '17': 0.20740740740740743,
32 | '18': 0.0,
33 | '19': 0.16666666666666666
34 | }
35 |
36 | np.testing.assert_array_almost_equal(
37 | np.asarray(sorted(nodal_eff_before.values())),
38 | np.asarray(sorted(g.nodal_efficiency.values())),
39 | err_msg="ORIGINAL NODAL EFFICIENCY failure (PARALLEL)")
40 |
41 | def test_global_efficiency():
42 | """
43 | The following test checks global efficiency before any perturbation.
44 | """
45 | g = ParallelGeneralGraph()
46 | g.load("tests/TOY_graph.csv")
47 |
48 | np.testing.assert_almost_equal(g.global_efficiency, 0.1759191750419821,
49 | err_msg="ORIGINAL GLOBAL EFFICIENCY failure")
50 |
51 | def test_local_efficiency():
52 | """
53 | The following test checks local efficiency before any perturbation.
54 | """
55 | g = ParallelGeneralGraph()
56 | g.load("tests/TOY_graph.csv")
57 |
58 | local_eff_before = {
59 | '1': 0.17437369729036395,
60 | '2': 0.20222663139329808,
61 | '3': 0.14814814814814814,
62 | '4': 0.22583774250440916,
63 | '5': 0.14814814814814814,
64 | '6': 0.21182760141093476,
65 | '7': 0.22583774250440916,
66 | '8': 0.19354056437389772,
67 | '9': 0.15648148148148147,
68 | '10': 0.14814814814814814,
69 | '11': 0.16666666666666666,
70 | '12': 0.16666666666666666,
71 | '13': 0.17592592592592593,
72 | '14': 0.1111111111111111,
73 | '15': 0.16124338624338624,
74 | '16': 0.20740740740740743,
75 | '17': 0.1523148148148148,
76 | '18': 0.0,
77 | '19': 0.17592592592592593
78 | }
79 |
80 | np.testing.assert_array_almost_equal(
81 | np.asarray(sorted(local_eff_before.values())),
82 | np.asarray(sorted(g.local_efficiency.values())),
83 | err_msg="ORIGINAL LOCAL EFFICIENCY failure (PARALLEL)")
84 |
85 | def test_closeness_centrality():
86 | """
87 | The following test checks closeness centrality before any perturbation.
88 | """
89 | g = ParallelGeneralGraph()
90 | g.load("tests/TOY_graph.csv")
91 |
92 | closeness_centrality = {
93 | '1': 0.0,
94 | '2': 0.05555555555555555,
95 | '3': 0.05555555555555555,
96 | '4': 0.07407407407407407,
97 | '5': 0.07407407407407407,
98 | '6': 0.1736111111111111,
99 | '7': 0.11574074074074076,
100 | '8': 0.11574074074074076,
101 | '9': 0.14327485380116958,
102 | '10': 0.12077294685990338,
103 | '11': 0.17386831275720163,
104 | '12': 0.1866925064599483,
105 | '13': 0.16055555555555556,
106 | '14': 0.1866925064599483,
107 | '15': 0.0,
108 | '16': 0.16071428571428573,
109 | '17': 0.125,
110 | '18': 0.17307692307692307,
111 | '19': 0.22299382716049382
112 | }
113 |
114 | np.testing.assert_array_almost_equal(
115 | np.asarray(sorted(closeness_centrality.values())),
116 | np.asarray(sorted(g.closeness_centrality.values())),
117 | err_msg="CLOSENESS CENTRALITY failure (PARALLEL)")
118 |
119 | def test_betweenness_centrality():
120 | """
121 | The following test checks betweenness centrality before any perturbation.
122 | """
123 | g = ParallelGeneralGraph()
124 | g.load("tests/TOY_graph.csv")
125 |
126 | betweenness_centrality = {
127 | '1': 0.0,
128 | '2': 0.05161290322580645,
129 | '3': 0.04516129032258064,
130 | '4': 0.12903225806451613,
131 | '5': 0.07741935483870968,
132 | '6': 0.2709677419354839,
133 | '7': 0.0,
134 | '8': 0.2838709677419355,
135 | '9': 0.36774193548387096,
136 | '10': 0.34838709677419355,
137 | '11': 0.41935483870967744,
138 | '12': 0.1032258064516129,
139 | '13': 0.0,
140 | '14': 0.10967741935483871,
141 | '15': 0.0,
142 | '16': 0.3741935483870968,
143 | '17': 0.36774193548387096,
144 | '18': 0.0,
145 | '19': 0.38064516129032255
146 | }
147 |
148 | np.testing.assert_array_almost_equal(
149 | np.asarray(sorted(betweenness_centrality.values())),
150 | np.asarray(sorted(g.betweenness_centrality.values())),
151 | err_msg="BETWENNESS CENTRALITY failure (PARALLEL)")
152 |
153 | def test_indegree_centrality():
154 | """
155 | The following test checks indegree centrality before any perturbation.
156 | """
157 | g = ParallelGeneralGraph()
158 | g.load("tests/TOY_graph.csv")
159 |
160 | indegree_centrality = {
161 | '1': 0.0,
162 | '2': 0.05555555555555555,
163 | '3': 0.05555555555555555,
164 | '4': 0.05555555555555555,
165 | '5': 0.05555555555555555,
166 | '6': 0.16666666666666666,
167 | '7': 0.05555555555555555,
168 | '8': 0.05555555555555555,
169 | '9': 0.1111111111111111,
170 | '10': 0.05555555555555555,
171 | '11': 0.1111111111111111,
172 | '12': 0.1111111111111111,
173 | '13': 0.1111111111111111,
174 | '14': 0.1111111111111111,
175 | '15': 0.0,
176 | '16': 0.1111111111111111,
177 | '17': 0.05555555555555555,
178 | '18': 0.05555555555555555,
179 | '19': 0.16666666666666666
180 | }
181 |
182 | np.testing.assert_array_almost_equal(
183 | np.asarray(sorted(indegree_centrality.values())),
184 | np.asarray(sorted(g.indegree_centrality.values())),
185 | err_msg="INDEGREE CENTRALITY failure (PARALLEL)")
186 |
187 | def test_outdegree_centrality():
188 | """
189 | The following test checks outdegree centrality before any perturbation.
190 | """
191 | g = ParallelGeneralGraph()
192 | g.load("tests/TOY_graph.csv")
193 |
194 | outdegree_centrality = {
195 | '1': 0.1111111111111111,
196 | '2': 0.05555555555555555,
197 | '3': 0.05555555555555555,
198 | '4': 0.05555555555555555,
199 | '5': 0.05555555555555555,
200 | '6': 0.1111111111111111,
201 | '7': 0.05555555555555555,
202 | '8': 0.1111111111111111,
203 | '9': 0.05555555555555555,
204 | '10': 0.05555555555555555,
205 | '11': 0.05555555555555555,
206 | '12': 0.1111111111111111,
207 | '13': 0.1111111111111111,
208 | '14': 0.16666666666666666,
209 | '15': 0.05555555555555555,
210 | '16': 0.05555555555555555,
211 | '17': 0.1111111111111111,
212 | '18': 0.0,
213 | '19': 0.1111111111111111
214 | }
215 |
216 | np.testing.assert_array_almost_equal(
217 | np.asarray(sorted(outdegree_centrality.values())),
218 | np.asarray(sorted(g.outdegree_centrality.values())),
219 | err_msg="OUTDEGREE CENTRALITY failure (PARALLEL)")
220 |
221 | def test_degree_centrality():
222 | """
223 | The following test checks degree centrality before any perturbation.
224 | """
225 | g = ParallelGeneralGraph()
226 | g.load("tests/TOY_graph.csv")
227 |
228 | degree_centrality = {
229 | '1': 0.1111111111111111,
230 | '2': 0.1111111111111111,
231 | '3': 0.1111111111111111,
232 | '4': 0.1111111111111111,
233 | '5': 0.1111111111111111,
234 | '6': 0.2777777777777778,
235 | '7': 0.1111111111111111,
236 | '8': 0.16666666666666666,
237 | '9': 0.16666666666666666,
238 | '10': 0.1111111111111111,
239 | '11': 0.16666666666666666,
240 | '12': 0.2222222222222222,
241 | '13': 0.2222222222222222,
242 | '14': 0.2777777777777778,
243 | '15': 0.05555555555555555,
244 | '16': 0.16666666666666666,
245 | '17': 0.16666666666666666,
246 | '18': 0.05555555555555555,
247 | '19': 0.2777777777777778
248 | }
249 |
250 | np.testing.assert_array_almost_equal(
251 | np.asarray(sorted(degree_centrality.values())),
252 | np.asarray(sorted(g.degree_centrality.values())),
253 | err_msg="DEGREE CENTRALITY failure (PARALLEL)")
254 |
--------------------------------------------------------------------------------
/tests/test_shortest_path.py:
--------------------------------------------------------------------------------
1 | """TestShortestPathGraph to check shortest path calculation of GeneralGraph"""
2 |
3 | from unittest import TestCase
4 | import copy
5 | import multiprocessing as mp
6 | from grape.general_graph import GeneralGraph
7 | from grape.parallel_general_graph import ParallelGeneralGraph
8 | from grape.fault_diagnosis import FaultDiagnosis
9 |
10 |
11 | class TestShortestPathGraph(TestCase):
12 | """
13 | Class TestShortestPathGraph to check shortest path calculation
14 | of GeneralGraph
15 | """
16 |
17 | @classmethod
18 | def setUpClass(cls):
19 | """
20 | Shortest paths for the toy graph:
21 | - 'initial': shortest paths before any perturbation
22 | - 'final_element_perturbation': shortest paths after
23 | element perturbation
24 | - 'final_area_perturbation': shortest paths after area perturbation
25 | """
26 | cls.initial = {
27 | '1': {
28 | '1': ['1'],
29 | '2': ['1', '2'],
30 | '3': ['1', '3'],
31 | '4': ['1', '2', '4'],
32 | '5': ['1', '3', '5'],
33 | '6': ['1', '2', '4', '6'],
34 | '11': ['1', '3', '5', '11'],
35 | '7': ['1', '2', '4', '6', '7'],
36 | '8': ['1', '2', '4', '6', '8'],
37 | '19': ['1', '3', '5', '11', '19'],
38 | '9': ['1', '2', '4', '6', '8', '9'],
39 | '12': ['1', '3', '5', '11', '19', '12'],
40 | '14': ['1', '3', '5', '11', '19', '14'],
41 | '16': ['1', '2', '4', '6', '8', '9', '16'],
42 | '13': ['1', '3', '5', '11', '19', '12', '13'],
43 | '18': ['1', '3', '5', '11', '19', '14', '18'],
44 | '17': ['1', '2', '4', '6', '8', '9', '16', '17'],
45 | '10': ['1', '2', '4', '6', '8', '9', '16', '17', '10']
46 | },
47 | '2': {
48 | '2': ['2'],
49 | '4': ['2', '4'],
50 | '6': ['2', '4', '6'],
51 | '7': ['2', '4', '6', '7'],
52 | '8': ['2', '4', '6', '8'],
53 | '9': ['2', '4', '6', '8', '9'],
54 | '16': ['2', '4', '6', '8', '9', '16'],
55 | '17': ['2', '4', '6', '8', '9', '16', '17'],
56 | '10': ['2', '4', '6', '8', '9', '16', '17', '10'],
57 | '11': ['2', '4', '6', '8', '9', '16', '17', '10', '11'],
58 | '19': ['2', '4', '6', '8', '9', '16', '17', '10', '11', '19'],
59 | '12': ['2', '4', '6', '8', '9', '16', '17', '10', '11', '19', '12'],
60 | '14': ['2', '4', '6', '8', '9', '16', '17', '10', '11', '19', '14'],
61 | '13': ['2', '4', '6', '8', '9', '16', '17', '10', '11', '19', '12', '13'],
62 | '18': ['2', '4', '6', '8', '9', '16', '17', '10', '11', '19', '14', '18']
63 | },
64 | '3': {
65 | '3': ['3'],
66 | '5': ['3', '5'],
67 | '11': ['3', '5', '11'],
68 | '19': ['3', '5', '11', '19'],
69 | '12': ['3', '5', '11', '19', '12'],
70 | '14': ['3', '5', '11', '19', '14'],
71 | '13': ['3', '5', '11', '19', '12', '13'],
72 | '18': ['3', '5', '11', '19', '14', '18']
73 | },
74 | '4': {
75 | '4': ['4'],
76 | '6': ['4', '6'],
77 | '7': ['4', '6', '7'],
78 | '8': ['4', '6', '8'],
79 | '9': ['4', '6', '8', '9'],
80 | '16': ['4', '6', '8', '9', '16'],
81 | '17': ['4', '6', '8', '9', '16', '17'],
82 | '10': ['4', '6', '8', '9', '16', '17', '10'],
83 | '11': ['4', '6', '8', '9', '16', '17', '10', '11'],
84 | '19': ['4', '6', '8', '9', '16', '17', '10', '11', '19'],
85 | '12': ['4', '6', '8', '9', '16', '17', '10', '11', '19', '12'],
86 | '14': ['4', '6', '8', '9', '16', '17', '10', '11', '19', '14'],
87 | '13': ['4', '6', '8', '9', '16', '17', '10', '11', '19', '12', '13'],
88 | '18': ['4', '6', '8', '9', '16', '17', '10', '11', '19', '14', '18']
89 | },
90 | '5': {
91 | '5': ['5'],
92 | '11': ['5', '11'],
93 | '19': ['5', '11', '19'],
94 | '12': ['5', '11', '19', '12'],
95 | '14': ['5', '11', '19', '14'],
96 | '13': ['5', '11', '19', '12', '13'],
97 | '18': ['5', '11', '19', '14', '18']
98 | },
99 | '6': {
100 | '6': ['6'],
101 | '7': ['6', '7'],
102 | '8': ['6', '8'],
103 | '9': ['6', '8', '9'],
104 | '16': ['6', '8', '9', '16'],
105 | '17': ['6', '8', '9', '16', '17'],
106 | '10': ['6', '8', '9', '16', '17', '10'],
107 | '11': ['6', '8', '9', '16', '17', '10', '11'],
108 | '19': ['6', '8', '9', '16', '17', '10', '11', '19'],
109 | '12': ['6', '8', '9', '16', '17', '10', '11', '19', '12'],
110 | '14': ['6', '8', '9', '16', '17', '10', '11', '19', '14'],
111 | '13': ['6', '8', '9', '16', '17', '10', '11', '19', '12', '13'],
112 | '18': ['6', '8', '9', '16', '17', '10', '11', '19', '14', '18']
113 | },
114 | '7': {
115 | '7': ['7'],
116 | '6': ['7', '6'],
117 | '8': ['7', '6', '8'],
118 | '9': ['7', '6', '8', '9'],
119 | '16': ['7', '6', '8', '9', '16'],
120 | '17': ['7', '6', '8', '9', '16', '17'],
121 | '10': ['7', '6', '8', '9', '16', '17', '10'],
122 | '11': ['7', '6', '8', '9', '16', '17', '10', '11'],
123 | '19': ['7', '6', '8', '9', '16', '17', '10', '11', '19'],
124 | '12': ['7', '6', '8', '9', '16', '17', '10', '11', '19', '12'],
125 | '14': ['7', '6', '8', '9', '16', '17', '10', '11', '19', '14'],
126 | '13': ['7', '6', '8', '9', '16', '17', '10', '11', '19', '12', '13'],
127 | '18': ['7', '6', '8', '9', '16', '17', '10', '11', '19', '14', '18']
128 | },
129 | '8': {
130 | '8': ['8'],
131 | '6': ['8', '6'],
132 | '9': ['8', '9'],
133 | '7': ['8', '6', '7'],
134 | '16': ['8', '9', '16'],
135 | '17': ['8', '9', '16', '17'],
136 | '10': ['8', '9', '16', '17', '10'],
137 | '11': ['8', '9', '16', '17', '10', '11'],
138 | '19': ['8', '9', '16', '17', '10', '11', '19'],
139 | '12': ['8', '9', '16', '17', '10', '11', '19', '12'],
140 | '14': ['8', '9', '16', '17', '10', '11', '19', '14'],
141 | '13': ['8', '9', '16', '17', '10', '11', '19', '12', '13'],
142 | '18': ['8', '9', '16', '17', '10', '11', '19', '14', '18']
143 | },
144 | '9': {
145 | '9': ['9'],
146 | '16': ['9', '16'],
147 | '17': ['9', '16', '17'],
148 | '10': ['9', '16', '17', '10'],
149 | '11': ['9', '16', '17', '10', '11'],
150 | '19': ['9', '16', '17', '10', '11', '19'],
151 | '12': ['9', '16', '17', '10', '11', '19', '12'],
152 | '14': ['9', '16', '17', '10', '11', '19', '14'],
153 | '13': ['9', '16', '17', '10', '11', '19', '12', '13'],
154 | '18': ['9', '16', '17', '10', '11', '19', '14', '18']
155 | },
156 | '10': {
157 | '10': ['10'],
158 | '11': ['10', '11'],
159 | '19': ['10', '11', '19'],
160 | '12': ['10', '11', '19', '12'],
161 | '14': ['10', '11', '19', '14'],
162 | '13': ['10', '11', '19', '12', '13'],
163 | '18': ['10', '11', '19', '14', '18']
164 | },
165 | '11': {
166 | '11': ['11'],
167 | '19': ['11', '19'],
168 | '12': ['11', '19', '12'],
169 | '14': ['11', '19', '14'],
170 | '13': ['11', '19', '12', '13'],
171 | '18': ['11', '19', '14', '18']
172 | },
173 | '12': {
174 | '12': ['12'],
175 | '19': ['12', '19'],
176 | '13': ['12', '13'],
177 | '14': ['12', '19', '14'],
178 | '18': ['12', '19', '14', '18']
179 | },
180 | '13': {
181 | '13': ['13'],
182 | '12': ['13', '12'],
183 | '14': ['13', '14'],
184 | '19': ['13', '12', '19'],
185 | '18': ['13', '14', '18']
186 | },
187 | '14': {
188 | '14': ['14'],
189 | '19': ['14', '19'],
190 | '13': ['14', '13'],
191 | '18': ['14', '18'],
192 | '12': ['14', '19', '12']
193 | },
194 | '15': {
195 | '15': ['15'],
196 | '9': ['15', '9'],
197 | '16': ['15', '9', '16'],
198 | '17': ['15', '9', '16', '17'],
199 | '10': ['15', '9', '16', '17', '10'],
200 | '11': ['15', '9', '16', '17', '10', '11'],
201 | '19': ['15', '9', '16', '17', '10', '11', '19'],
202 | '12': ['15', '9', '16', '17', '10', '11', '19', '12'],
203 | '14': ['15', '9', '16', '17', '10', '11', '19', '14'],
204 | '13': ['15', '9', '16', '17', '10', '11', '19', '12', '13'],
205 | '18': ['15', '9', '16', '17', '10', '11', '19', '14', '18']
206 | },
207 | '16': {
208 | '16': ['16'],
209 | '17': ['16', '17'],
210 | '10': ['16', '17', '10'],
211 | '11': ['16', '17', '10', '11'],
212 | '19': ['16', '17', '10', '11', '19'],
213 | '12': ['16', '17', '10', '11', '19', '12'],
214 | '14': ['16', '17', '10', '11', '19', '14'],
215 | '13': ['16', '17', '10', '11', '19', '12', '13'],
216 | '18': ['16', '17', '10', '11', '19', '14', '18']
217 | },
218 | '17': {
219 | '17': ['17'],
220 | '16': ['17', '16'],
221 | '10': ['17', '10'],
222 | '11': ['17', '10', '11'],
223 | '19': ['17', '10', '11', '19'],
224 | '12': ['17', '10', '11', '19', '12'],
225 | '14': ['17', '10', '11', '19', '14'],
226 | '13': ['17', '10', '11', '19', '12', '13'],
227 | '18': ['17', '10', '11', '19', '14', '18']
228 | },
229 | '18': {
230 | '18': ['18']
231 | },
232 | '19': {
233 | '19': ['19'],
234 | '12': ['19', '12'],
235 | '14': ['19', '14'],
236 | '13': ['19', '12', '13'],
237 | '18': ['19', '14', '18']
238 | }
239 | }
240 |
241 | cls.final_element_perturbation = copy.deepcopy(cls.initial)
242 | cls.final_element_perturbation.pop('1')
243 |
244 | cls.final_multi_area_perturbation = {
245 | '2': {
246 | '2': ['2'],
247 | '4': ['2', '4'],
248 | '6': ['2', '4', '6'],
249 | '7': ['2', '4', '6', '7'],
250 | '8': ['2', '4', '6', '8']
251 | },
252 | '3': {
253 | '3': ['3'],
254 | '5': ['3', '5']
255 | },
256 | '4': {
257 | '4': ['4'],
258 | '6': ['4', '6'],
259 | '7': ['4', '6', '7'],
260 | '8': ['4', '6', '8']
261 | },
262 | '5': {
263 | '5': ['5']
264 | },
265 | '6': {
266 | '6': ['6'],
267 | '7': ['6', '7'],
268 | '8': ['6', '8']
269 | },
270 | '7': {
271 | '7': ['7'],
272 | '6': ['7', '6'],
273 | '8': ['7', '6', '8']
274 | },
275 | '8': {
276 | '8': ['8'],
277 | '6': ['8', '6'],
278 | '7': ['8', '6', '7'],
279 | }
280 | }
281 |
282 | @classmethod
283 | def check_shortest_paths(cls, test, true_path, shpath, shpath_len):
284 | """
285 | For every path, source and target must match with the true ones.
286 | The length of the shortest path beteween source
287 | and target must also match.
288 | The shortest path is not necessarily unique:
289 | the entire source-target path does not necessarily coincide.
290 | """
291 | for source, all_paths in true_path.items():
292 | for target, path in all_paths.items():
293 | test.assertEqual(
294 | path[0], shpath[source][target][0],
295 | msg="Wrong SOURCE in path from " + str(source) + " to " +
296 | str(target))
297 |
298 | test.assertEqual(
299 | path[-1], shpath[source][target][-1],
300 | msg="Wrong TARGET in path from " + str(source) + " to " +
301 | str(target))
302 |
303 | if source != target:
304 | test.assertEqual(
305 | len(path)-1, shpath_len[source][target],
306 | msg="Wrong LENGTH of path from " + str(source) +
307 | " to " + str(target))
308 | else:
309 | test.assertEqual(
310 | 0.0, shpath_len[source][target],
311 | msg="Wrong LENGTH of path from " + str(source) +
312 | " to " + str(target))
313 |
314 | def test_Dijkstra_parallel(self):
315 | """
316 | The following test checks the parallel SSSP algorithm based
317 | on Dijkstra's method.
318 | """
319 | g = ParallelGeneralGraph()
320 | g.load("tests/TOY_graph.csv")
321 | g.num = mp.cpu_count()
322 | shpath, shpath_len = g.dijkstra_single_source_shortest_path()
323 |
324 | self.check_shortest_paths(self, self.initial, shpath, shpath_len)
325 |
326 | def test_floyd_warshall_parallel(self):
327 | """
328 | The following test checks the parallel Floyd Warshall's APSP algorithm.
329 | """
330 | g = ParallelGeneralGraph()
331 | g.load("tests/TOY_graph.csv")
332 | g.num = mp.cpu_count()
333 | shpath, shpath_len = g.floyd_warshall_predecessor_and_distance()
334 |
335 | self.check_shortest_paths(self, self.initial, shpath, shpath_len)
336 |
337 | def test_Dijkstra_serial(self):
338 | """
339 | The following test checks the serial SSSP algorithm based
340 | on Dijkstra's method.
341 | """
342 | g = GeneralGraph()
343 | g.load("tests/TOY_graph.csv")
344 | shpath, shpath_len = g.dijkstra_single_source_shortest_path()
345 |
346 | self.check_shortest_paths(self, self.initial, shpath, shpath_len)
347 |
348 | def test_floyd_warshall_serial(self):
349 | """
350 | The following test checks the serial Floyd Warshall's APSP algorithm.
351 | """
352 | g = GeneralGraph()
353 | g.load("tests/TOY_graph.csv")
354 | shpath, shpath_len = g.floyd_warshall_predecessor_and_distance()
355 |
356 | self.check_shortest_paths(self, self.initial, shpath, shpath_len)
357 |
358 | def test_element_perturbation(self):
359 | """
360 | The following test checks the topology of the graph after
361 | a perturbation. The perturbation here considered is the
362 | perturbation of element '1'.
363 | """
364 | F = FaultDiagnosis("tests/TOY_graph.csv")
365 | F.simulate_element_perturbation(["1"])
366 |
367 | self.check_shortest_paths(self, self.final_element_perturbation,
368 | F.G.shortest_path, F.G.shortest_path_length)
369 |
--------------------------------------------------------------------------------
/tutorials/README.md:
--------------------------------------------------------------------------------
1 | # Tutorials
2 |
3 | In this folder you can find a collection of useful Notebooks containing tutorials to understand the principles and the potential of **GRAPE**.
4 |
5 | #### Tutorial 1 [[.ipynb](tutorial01/01_element_perturbation.ipynb), [.py](tutorial01/01_element_perturbation.py)]
6 | Here we show the perturbation of one element in a toy graph.
7 |
8 | #### Tutorial 2 [[.ipynb](tutorial02/02_multi_element_perturbation.ipynb), [.py](tutorial02/02_multi_element_perturbation.py)]
9 | Here we show the perturbation of multiple elements in a toy graph.
10 |
11 | #### Tutorial 3 [[.ipynb](tutorial03/03_switch_activation.ipynb), [.py](tutorial03/03_switch_activation.py)]
12 | Here we describe how switch activation works.
13 |
--------------------------------------------------------------------------------
/tutorials/tutorial01/01_element_perturbation.py:
--------------------------------------------------------------------------------
1 | from grape.fault_diagnosis import FaultDiagnosis
2 |
3 | F = FaultDiagnosis("./input_files/TOY_graph.csv")
4 |
5 | initial = { '11': (2., 2.), '19': (6., 2.), '12': (10., 2.),
6 | '14': (6., 10.), '13': (10., 10.), '18': (2., 10.), '5': (-2., 2.),
7 | '3': (-4., 6.), '1': (-6., 10.), '2': (-8., 6.), '4': (-10., 2.),
8 | '6': (-6., -2.), '7': (-10, -10.), '8': (-2, -10.), '10': (2., -2.),
9 | '17': (10., -2.), '16': (10., -10.), '9': (2., -10.), '15': (6., -6.)}
10 |
11 | F.G.print_graph(initial_pos=initial, size=800, edge_width=3., arrow_size=7,
12 | fsize=12, fixed_nodes=list(F.G), title='TOY graph (integer)',
13 | legend_loc='upper center', legend_ncol=4,
14 | legend_anchor=(0.5, 1.2), legend_fsize=12)
15 |
16 | F.check_input_with_gephi()
17 | F.simulate_element_perturbation(["1"])
18 |
19 | F.G.print_graph(initial_pos=initial, size=800, edge_width=3., arrow_size=7,
20 | fsize=12, fixed_nodes=list(F.G), title='TOY graph (perturbed)',
21 | legend_loc='upper center', legend_ncol=4,
22 | legend_anchor=(0.5, 1.2), legend_fsize=12)
23 |
--------------------------------------------------------------------------------
/tutorials/tutorial01/input_files/TOY_graph.csv:
--------------------------------------------------------------------------------
1 | mark,father_mark,init_status,description,type,weight,initial_service
2 | "1","NULL",,,"SOURCE",1.0,1.0
3 | "2","1",1,,"SWITCH",1.0,0.0
4 | "3","1",1,,"SWITCH",1.0,0.0
5 | "4","2",,,"HUB",1.0,0.0
6 | "5","3",,,"HUB",1.0,0.0
7 | "6","4",,,"HUB",1.0,0.0
8 | "6","7",,,"HUB",1.0,0.0
9 | "7","6",,,"HUB",1.0,0.0
10 | "8","6",,,"HUB",1.0,0.0
11 | "6","8",,,"HUB",1.0,0.0
12 | "9","8",,,"HUB",1.0,0.0
13 | "9","15",,,"HUB",1.0,0.0
14 | "15","NULL",,,"SOURCE",1.0,2.0
15 | "16","9",,,"HUB",1.0,0.0
16 | "16","17",,,"HUB",1.0,0.0
17 | "17","16",,,"HUB",1.0,0.0
18 | "10","17",,,"HUB",1.0,0.0
19 | "11","10",,,"HUB",1.0,0.0
20 | "11","5",,,"HUB",1.0,0.0
21 | "19","11",,,"HUB",1.0,0.0
22 | "19","12",,,"HUB",1.0,0.0
23 | "19","14",,,"HUB",1.0,0.0
24 | "12","19",,,"HUB",1.0,0.0
25 | "12","13",,,"HUB",1.0,0.0
26 | "13","14",,,"HUB",1.0,0.0
27 | "13","12",,,"HUB",1.0,0.0
28 | "14","19",,,"HUB",1.0,0.0
29 | "14","13",,,"HUB",1.0,0.0
30 | "18","14",,,"USER",1.0,0.0
31 |
--------------------------------------------------------------------------------
/tutorials/tutorial01/output_files/check_import_edges.csv:
--------------------------------------------------------------------------------
1 | mark,father_mark
2 | 2,1
3 | 3,1
4 | 4,2
5 | 5,3
6 | 6,4
7 | 6,7
8 | 7,6
9 | 8,6
10 | 6,8
11 | 9,8
12 | 9,15
13 | 16,9
14 | 16,17
15 | 17,16
16 | 10,17
17 | 11,10
18 | 11,5
19 | 19,11
20 | 19,12
21 | 19,14
22 | 12,19
23 | 12,13
24 | 13,14
25 | 13,12
26 | 14,19
27 | 14,13
28 | 18,14
29 |
--------------------------------------------------------------------------------
/tutorials/tutorial01/output_files/check_import_nodes.csv:
--------------------------------------------------------------------------------
1 | mark,description,init_status
2 | 1,,
3 | 2,,1
4 | 3,,1
5 | 4,,
6 | 5,,
7 | 6,,
8 | 7,,
9 | 8,,
10 | 9,,
11 | 15,,
12 | 16,,
13 | 17,,
14 | 10,,
15 | 11,,
16 | 19,,
17 | 12,,
18 | 13,,
19 | 14,,
20 | 18,,
21 |
--------------------------------------------------------------------------------
/tutorials/tutorial01/output_files/element_perturbation.csv:
--------------------------------------------------------------------------------
1 | mark,description,init_status,final_status,mark_status,original_closeness_centrality,final_closeness_centrality,original_betweenness_centrality,final_betweenness_centrality,original_indegree_centrality,final_indegree_centrality,original_outdegree_centrality,final_outdegree_centrality,original_local_efficiency,final_local_efficiency,original_nodal_efficiency,final_nodal_efficiency,original_service,final_service
2 | 1,,,,,0.0,,0.0,,0.0,,0.1111111111111111,,0.17437369729036395,,0.3213624338624339,,0.0,
3 | 2,,1,0,ACTIVE,0.05555555555555555,0.0,0.05161290322580645,0.0,0.05555555555555555,0.0,0.05555555555555555,0.058823529411764705,0.20222663139329808,0.21412231559290384,0.19689554272887605,0.20847763347763348,0.0,0.0
4 | 3,,1,0,ACTIVE,0.05555555555555555,0.0,0.04516129032258064,0.0,0.05555555555555555,0.0,0.05555555555555555,0.058823529411764705,0.14814814814814814,0.1568627450980392,0.15185185185185185,0.1607843137254902,0.0,0.0
5 | 4,,,,ACTIVE,0.07407407407407407,0.058823529411764705,0.12903225806451613,0.09420289855072464,0.05555555555555555,0.058823529411764705,0.05555555555555555,0.058823529411764705,0.22583774250440916,0.2391223155929038,0.20222663139329808,0.21412231559290384,0.0,0.0
6 | 5,,,,ACTIVE,0.07407407407407407,0.058823529411764705,0.07741935483870968,0.043478260869565216,0.05555555555555555,0.058823529411764705,0.05555555555555555,0.058823529411764705,0.14814814814814817,0.15686274509803924,0.14814814814814814,0.1568627450980392,0.0,0.0
7 | 6,,,,ACTIVE,0.1736111111111111,0.18823529411764706,0.2709677419354839,0.2608695652173913,0.16666666666666666,0.17647058823529413,0.1111111111111111,0.11764705882352941,0.21182760141093476,0.22428804855275447,0.22583774250440916,0.2391223155929038,0.0,0.0
8 | 7,,,,ACTIVE,0.11574074074074076,0.11764705882352941,0.0,0.0,0.05555555555555555,0.058823529411764705,0.05555555555555555,0.058823529411764705,0.22583774250440916,0.2391223155929038,0.1744488536155203,0.18471055088702149,0.0,0.0
9 | 8,,,,ACTIVE,0.11574074074074076,0.11764705882352941,0.2838709677419355,0.2898550724637681,0.05555555555555555,0.058823529411764705,0.1111111111111111,0.11764705882352941,0.1935405643738977,0.2049253034547152,0.24920634920634926,0.26386554621848746,0.0,0.0
10 | 9,,,,ACTIVE,0.14327485380116958,0.15126050420168066,0.36774193548387096,0.391304347826087,0.1111111111111111,0.11764705882352941,0.05555555555555555,0.058823529411764705,0.15648148148148147,0.16568627450980392,0.16124338624338622,0.1707282913165266,0.0,0.0
11 | 15,,,,ACTIVE,0.0,0.0,0.0,0.0,0.0,0.0,0.05555555555555555,0.058823529411764705,0.16124338624338622,0.1707282913165266,0.16587301587301584,0.17563025210084032,0.0,0.0
12 | 16,,,,ACTIVE,0.16071428571428573,0.1711229946524064,0.3741935483870968,0.4057971014492754,0.1111111111111111,0.11764705882352941,0.05555555555555555,0.058823529411764705,0.20740740740740743,0.21960784313725493,0.15648148148148147,0.16568627450980392,0.0,0.0
13 | 17,,,,ACTIVE,0.125,0.12981744421906694,0.36774193548387096,0.4057971014492754,0.05555555555555555,0.058823529411764705,0.1111111111111111,0.11764705882352941,0.1523148148148148,0.16127450980392155,0.20740740740740743,0.21960784313725493,0.0,0.0
14 | 10,,,,ACTIVE,0.12077294685990338,0.12538699690402477,0.34838709677419355,0.391304347826087,0.05555555555555555,0.058823529411764705,0.05555555555555555,0.058823529411764705,0.14814814814814817,0.15686274509803924,0.14814814814814814,0.1568627450980392,0.0,0.0
15 | 11,,,,ACTIVE,0.17386831275720163,0.1660899653979239,0.41935483870967744,0.43478260869565216,0.1111111111111111,0.11764705882352941,0.05555555555555555,0.058823529411764705,0.16666666666666666,0.17647058823529413,0.14814814814814817,0.15686274509803924,0.0,0.0
16 | 19,,,,ACTIVE,0.22299382716049382,0.22145328719723184,0.38064516129032255,0.39855072463768115,0.16666666666666666,0.17647058823529413,0.1111111111111111,0.11764705882352941,0.17592592592592593,0.18627450980392157,0.16666666666666666,0.17647058823529413,0.0,0.0
17 | 12,,,,ACTIVE,0.1866925064599483,0.1859114015976761,0.1032258064516129,0.10869565217391304,0.1111111111111111,0.11764705882352941,0.1111111111111111,0.11764705882352941,0.16666666666666666,0.17647058823529413,0.1574074074074074,0.16666666666666669,0.0,0.0
18 | 13,,,,ACTIVE,0.16055555555555556,0.16020025031289112,0.0,0.0,0.1111111111111111,0.11764705882352941,0.1111111111111111,0.11764705882352941,0.17592592592592593,0.18627450980392157,0.16666666666666666,0.17647058823529413,0.0,0.0
19 | 14,,,,ACTIVE,0.1866925064599483,0.1859114015976761,0.10967741935483871,0.11594202898550725,0.1111111111111111,0.11764705882352941,0.16666666666666666,0.17647058823529413,0.1111111111111111,0.11764705882352942,0.19444444444444445,0.20588235294117646,0.0,0.0
20 | 18,,,,ACTIVE,0.17307692307692307,0.17346938775510204,0.0,0.0,0.05555555555555555,0.058823529411764705,0.0,0.0,0.0,0.0,0.0,0.0,3.0,2.0
21 |
--------------------------------------------------------------------------------
/tutorials/tutorial01/output_files/results_generations.dat:
--------------------------------------------------------------------------------
1 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
2 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
3 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
4 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
5 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
6 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
7 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
8 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
9 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
10 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
11 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
12 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
13 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
14 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
15 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
16 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
17 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
18 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
19 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
20 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
21 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
22 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
23 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
24 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
25 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
26 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
27 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
28 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
29 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
30 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
31 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
32 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
33 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
34 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
35 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
36 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
37 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
38 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
39 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
40 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
41 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
42 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
43 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
44 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
45 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
46 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
47 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
48 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
49 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
50 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
51 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
52 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
53 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
54 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
55 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
56 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
57 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
58 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
59 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
60 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
61 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
62 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
63 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
64 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
65 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
66 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
67 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
68 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
69 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
70 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
71 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
72 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
73 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
74 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
75 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
76 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
77 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
78 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
79 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
80 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
81 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
82 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
83 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
84 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
85 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
86 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
87 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
88 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
89 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
90 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
91 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
92 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
93 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
94 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
95 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
96 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
97 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
98 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
99 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
100 | dict_items([('2', True), ('3', True)])[False, False] (2, 2.0, 18, 1, 0.0)-19.0
101 |
--------------------------------------------------------------------------------
/tutorials/tutorial01/output_files/service_paths_element_perturbation.csv:
--------------------------------------------------------------------------------
1 | from,to,original_shortest_path_length,original_shortest_path,original_simple_path,original_pair_efficiency,ids,final_shortest_path_length,final_shortest_path,final_simple_path,final_pair_efficiency
2 | 1,18,6.0,"['1', '3', '5', '11', '19', '14', '18']","[['1', '2', '4', '6', '8', '9', '16', '17', '10', '11', '19', '12', '13', '14', '18'], ['1', '2', '4', '6', '8', '9', '16', '17', '10', '11', '19', '14', '18'], ['1', '3', '5', '11', '19', '12', '13', '14', '18'], ['1', '3', '5', '11', '19', '14', '18']]",0.16666666666666666,118,,,,
3 | 15,18,8.0,"['15', '9', '16', '17', '10', '11', '19', '14', '18']","[['15', '9', '16', '17', '10', '11', '19', '12', '13', '14', '18'], ['15', '9', '16', '17', '10', '11', '19', '14', '18']]",0.125,1518,8.0,"['15', '9', '16', '17', '10', '11', '19', '14', '18']","[['15', '9', '16', '17', '10', '11', '19', '12', '13', '14', '18'], ['15', '9', '16', '17', '10', '11', '19', '14', '18']]",0.125
4 |
--------------------------------------------------------------------------------
/tutorials/tutorial02/02_multi_element_perturbation.py:
--------------------------------------------------------------------------------
1 | from grape.fault_diagnosis import FaultDiagnosis
2 |
3 | F = FaultDiagnosis("./input_files/TOY_graph.csv")
4 |
5 | initial = { '11': (2., 2.), '19': (6., 2.), '12': (10., 2.),
6 | '14': (6., 10.), '13': (10., 10.), '18': (2., 10.), '5': (-2., 2.),
7 | '3': (-4., 6.), '1': (-6., 10.), '2': (-8., 6.), '4': (-10., 2.),
8 | '6': (-6., -2.), '7': (-10, -10.), '8': (-2, -10.), '10': (2., -2.),
9 | '17': (10., -2.), '16': (10., -10.), '9': (2., -10.), '15': (6., -6.)}
10 |
11 | F.G.print_graph(initial_pos=initial, size=800, edge_width=3., arrow_size=7,
12 | fsize=12, fixed_nodes=list(F.G), title='TOY graph (integer)',
13 | legend_loc='upper center', legend_ncol=4, legend_anchor=(0.5, 1.2),
14 | legend_fsize=12)
15 |
16 | F.check_input_with_gephi()
17 | F.simulate_element_perturbation(["1", "2"])
18 |
19 | F.G.print_graph(initial_pos=initial, size=800, edge_width=3., arrow_size=7,
20 | fsize=12, fixed_nodes=list(F.G), title='TOY graph (perturbed)',
21 | legend_loc='upper center', legend_ncol=4,
22 | legend_anchor=(0.5, 1.2), legend_fsize=12)
23 |
--------------------------------------------------------------------------------
/tutorials/tutorial02/input_files/TOY_graph.csv:
--------------------------------------------------------------------------------
1 | mark,father_mark,init_status,description,type,weight,initial_service
2 | "1","NULL",,,"SOURCE",1.0,1.0
3 | "2","1",1,,"SWITCH",1.0,0.0
4 | "3","1",1,,"SWITCH",1.0,0.0
5 | "4","2",,,"HUB",1.0,0.0
6 | "5","3",,,"HUB",1.0,0.0
7 | "6","4",,,"HUB",1.0,0.0
8 | "6","7",,,"HUB",1.0,0.0
9 | "7","6",,,"HUB",1.0,0.0
10 | "8","6",,,"HUB",1.0,0.0
11 | "6","8",,,"HUB",1.0,0.0
12 | "9","8",,,"HUB",1.0,0.0
13 | "9","15",,,"HUB",1.0,0.0
14 | "15","NULL",,,"SOURCE",1.0,2.0
15 | "16","9",,,"HUB",1.0,0.0
16 | "16","17",,,"HUB",1.0,0.0
17 | "17","16",,,"HUB",1.0,0.0
18 | "10","17",,,"HUB",1.0,0.0
19 | "11","10",,,"HUB",1.0,0.0
20 | "11","5",,,"HUB",1.0,0.0
21 | "19","11",,,"HUB",1.0,0.0
22 | "19","12",,,"HUB",1.0,0.0
23 | "19","14",,,"HUB",1.0,0.0
24 | "12","19",,,"HUB",1.0,0.0
25 | "12","13",,,"HUB",1.0,0.0
26 | "13","14",,,"HUB",1.0,0.0
27 | "13","12",,,"HUB",1.0,0.0
28 | "14","19",,,"HUB",1.0,0.0
29 | "14","13",,,"HUB",1.0,0.0
30 | "18","14",,,"USER",1.0,0.0
31 |
--------------------------------------------------------------------------------
/tutorials/tutorial02/output_files/check_import_edges.csv:
--------------------------------------------------------------------------------
1 | mark,father_mark
2 | 2,1
3 | 3,1
4 | 4,2
5 | 5,3
6 | 6,4
7 | 6,7
8 | 7,6
9 | 8,6
10 | 6,8
11 | 9,8
12 | 9,15
13 | 16,9
14 | 16,17
15 | 17,16
16 | 10,17
17 | 11,10
18 | 11,5
19 | 19,11
20 | 19,12
21 | 19,14
22 | 12,19
23 | 12,13
24 | 13,14
25 | 13,12
26 | 14,19
27 | 14,13
28 | 18,14
29 |
--------------------------------------------------------------------------------
/tutorials/tutorial02/output_files/check_import_nodes.csv:
--------------------------------------------------------------------------------
1 | mark,description,init_status
2 | 1,,
3 | 2,,1
4 | 3,,1
5 | 4,,
6 | 5,,
7 | 6,,
8 | 7,,
9 | 8,,
10 | 9,,
11 | 15,,
12 | 16,,
13 | 17,,
14 | 10,,
15 | 11,,
16 | 19,,
17 | 12,,
18 | 13,,
19 | 14,,
20 | 18,,
21 |
--------------------------------------------------------------------------------
/tutorials/tutorial02/output_files/element_perturbation.csv:
--------------------------------------------------------------------------------
1 | mark,description,init_status,final_status,mark_status,original_closeness_centrality,final_closeness_centrality,original_betweenness_centrality,final_betweenness_centrality,original_indegree_centrality,final_indegree_centrality,original_outdegree_centrality,final_outdegree_centrality,original_local_efficiency,final_local_efficiency,original_nodal_efficiency,final_nodal_efficiency,original_service,final_service
2 | 1,,,,,0.0,,0.0,,0.0,,0.1111111111111111,,0.17437369729036395,,0.3213624338624339,,0.0,
3 | 2,,1,1,,0.05555555555555555,,0.05161290322580645,,0.05555555555555555,,0.05555555555555555,,0.20222663139329808,,0.19689554272887605,,0.0,
4 | 3,,1,0,ACTIVE,0.05555555555555555,0.0,0.04516129032258064,0.0,0.05555555555555555,0.0,0.05555555555555555,0.5,0.14814814814814814,0.0,0.15185185185185185,0.5,0.0,0.0
5 | 4,,,,,0.07407407407407407,,0.12903225806451613,,0.05555555555555555,,0.05555555555555555,,0.22583774250440916,,0.20222663139329808,,0.0,
6 | 5,,,,ACTIVE,0.07407407407407407,0.5,0.07741935483870968,0.0,0.05555555555555555,0.5,0.05555555555555555,0.0,0.14814814814814817,0.0,0.14814814814814814,0.0,0.0,0.0
7 | 6,,,,,0.1736111111111111,,0.2709677419354839,,0.16666666666666666,,0.1111111111111111,,0.21182760141093476,,0.22583774250440916,,0.0,
8 | 7,,,,,0.11574074074074076,,0.0,,0.05555555555555555,,0.05555555555555555,,0.22583774250440916,,0.1744488536155203,,0.0,
9 | 8,,,,,0.11574074074074076,,0.2838709677419355,,0.05555555555555555,,0.1111111111111111,,0.1935405643738977,,0.24920634920634926,,0.0,
10 | 9,,,,,0.14327485380116958,,0.36774193548387096,,0.1111111111111111,,0.05555555555555555,,0.15648148148148147,,0.16124338624338622,,0.0,
11 | 15,,,,ACTIVE,0.0,0.0,0.0,0.0,0.0,0.0,0.05555555555555555,0.0,0.16124338624338622,0.0,0.16587301587301584,0.0,0.0,0.0
12 | 16,,,,,0.16071428571428573,,0.3741935483870968,,0.1111111111111111,,0.05555555555555555,,0.20740740740740743,,0.15648148148148147,,0.0,
13 | 17,,,,,0.125,,0.36774193548387096,,0.05555555555555555,,0.1111111111111111,,0.1523148148148148,,0.20740740740740743,,0.0,
14 | 10,,,,,0.12077294685990338,,0.34838709677419355,,0.05555555555555555,,0.05555555555555555,,0.14814814814814817,,0.14814814814814814,,0.0,
15 | 11,,,,,0.17386831275720163,,0.41935483870967744,,0.1111111111111111,,0.05555555555555555,,0.16666666666666666,,0.14814814814814817,,0.0,
16 | 19,,,,,0.22299382716049382,,0.38064516129032255,,0.16666666666666666,,0.1111111111111111,,0.17592592592592593,,0.16666666666666666,,0.0,
17 | 12,,,,,0.1866925064599483,,0.1032258064516129,,0.1111111111111111,,0.1111111111111111,,0.16666666666666666,,0.1574074074074074,,0.0,
18 | 13,,,,,0.16055555555555556,,0.0,,0.1111111111111111,,0.1111111111111111,,0.17592592592592593,,0.16666666666666666,,0.0,
19 | 14,,,,,0.1866925064599483,,0.10967741935483871,,0.1111111111111111,,0.16666666666666666,,0.1111111111111111,,0.19444444444444445,,0.0,
20 | 18,,,,,0.17307692307692307,,0.0,,0.05555555555555555,,0.0,,0.0,,0.0,,3.0,
21 |
--------------------------------------------------------------------------------
/tutorials/tutorial02/output_files/results_generations.dat:
--------------------------------------------------------------------------------
1 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
2 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
3 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
4 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
5 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
6 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
7 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
8 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
9 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
10 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
11 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
12 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
13 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
14 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
15 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
16 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
17 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
18 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
19 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
20 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
21 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
22 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
23 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
24 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
25 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
26 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
27 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
28 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
29 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
30 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
31 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
32 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
33 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
34 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
35 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
36 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
37 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
38 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
39 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
40 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
41 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
42 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
43 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
44 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
45 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
46 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
47 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
48 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
49 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
50 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
51 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
52 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
53 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
54 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
55 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
56 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
57 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
58 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
59 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
60 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
61 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
62 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
63 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
64 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
65 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
66 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
67 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
68 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
69 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
70 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
71 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
72 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
73 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
74 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
75 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
76 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
77 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
78 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
79 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
80 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
81 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
82 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
83 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
84 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
85 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
86 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
87 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
88 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
89 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
90 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
91 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
92 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
93 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
94 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
95 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
96 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
97 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
98 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
99 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
100 | dict_items([('2', True), ('3', True)])[True, False] (1, 0.0, 3, 0, 0)-2.0
101 |
--------------------------------------------------------------------------------
/tutorials/tutorial02/output_files/service_paths_element_perturbation.csv:
--------------------------------------------------------------------------------
1 | from,to,original_shortest_path_length,original_shortest_path,original_simple_path,original_pair_efficiency,ids
2 | 1,18,6.0,"['1', '3', '5', '11', '19', '14', '18']","[['1', '2', '4', '6', '8', '9', '16', '17', '10', '11', '19', '12', '13', '14', '18'], ['1', '2', '4', '6', '8', '9', '16', '17', '10', '11', '19', '14', '18'], ['1', '3', '5', '11', '19', '12', '13', '14', '18'], ['1', '3', '5', '11', '19', '14', '18']]",0.16666666666666666,118
3 | 15,18,8.0,"['15', '9', '16', '17', '10', '11', '19', '14', '18']","[['15', '9', '16', '17', '10', '11', '19', '12', '13', '14', '18'], ['15', '9', '16', '17', '10', '11', '19', '14', '18']]",0.125,1518
4 |
--------------------------------------------------------------------------------
/tutorials/tutorial03/03_switch_activation.py:
--------------------------------------------------------------------------------
1 | from grape.fault_diagnosis import FaultDiagnosis
2 |
3 | F = FaultDiagnosis("./input_files/switch_line.csv")
4 | F.check_input_with_gephi()
5 |
6 | initial = {'10': (0., 0.), '1': (0., 2.), 'A': (0., 4.),
7 | 'S1': (2., 2.), '2': (4., 2.), 'S2': (6., 2.), '3': (8., 2.),
8 | '11': (8., 0.), 'S3': (10., 2.), '4': (12., 2.), 'S4': (14., 2.),
9 | '5': (16., 2.), '12': (16., 0.), 'B': (16., 4.), 'S5': (18., 2.),
10 | '6': (20., 2.), 'S6': (22., 2.), '7': (24., 2.), '13': (24., 0.),
11 | 'C': (24., 4.), 'S7': (26., 2.), '8': (28., 2.), 'S8': (30., 2.),
12 | '9': (32., 2.), '14': (32., 0.)}
13 |
14 | F.G.print_graph(initial_pos=initial, size=200, arrow_size=4, fsize=10,
15 | fixed_nodes=list(F.G), title='Switch line (integer)',
16 | legend_loc='upper center', legend_ncol=8, legend_anchor=(0.5, 1.05),
17 | legend_fsize=7)
18 |
19 | F.simulate_element_perturbation(["1"])
20 | print("\nPredecessors of S1: ", list(F.G.predecessors('S1')))
21 | print("\nSuccessors of S1: ", list(F.G.successors('S1')))
22 |
23 | F.G.print_graph(initial_pos=initial, size=200, arrow_size=4, fsize=10,
24 | fixed_nodes=list(F.G), title='Switch line (node 1 perturbed)',
25 | legend_loc='upper center', legend_ncol=8,
26 | legend_anchor=(0.5, 1.05), legend_fsize=7)
27 |
28 | D = FaultDiagnosis("./input_files/switch_line.csv")
29 | D.simulate_element_perturbation(["2"])
30 |
31 | D.G.print_graph(initial_pos=initial, size=200, arrow_size=4, fsize=10,
32 | fixed_nodes=list(D.G), title='Switch line (node 2 perturbed)',
33 | legend_loc='upper center', legend_ncol=8,
34 | legend_anchor=(0.5, 1.05), legend_fsize=7)
35 |
36 | T = FaultDiagnosis("./input_files/switch_line.csv")
37 | T.simulate_element_perturbation(["2", "3"])
38 |
39 | T.G.print_graph(initial_pos=initial, size=200, arrow_size=4, fsize=10,
40 | fixed_nodes=list(T.G), title='Switch line (nodes 2 and 3 perturbed)',
41 | legend_loc='upper center', legend_ncol=8,
42 | legend_anchor=(0.5, 1.05), legend_fsize=7)
43 |
--------------------------------------------------------------------------------
/tutorials/tutorial03/input_files/TOY_graph.csv:
--------------------------------------------------------------------------------
1 | mark,father_mark,init_status,description,type,weight,initial_service
2 | "1","NULL",,,"SOURCE",1.0,1.0
3 | "2","1",1,,"SWITCH",1.0,0.0
4 | "3","1",1,,"SWITCH",1.0,0.0
5 | "4","2",,,"HUB",1.0,0.0
6 | "5","3",,,"HUB",1.0,0.0
7 | "6","4",,,"HUB",1.0,0.0
8 | "6","7",,,"HUB",1.0,0.0
9 | "7","6",,,"HUB",1.0,0.0
10 | "8","6",,,"HUB",1.0,0.0
11 | "6","8",,,"HUB",1.0,0.0
12 | "9","8",,,"HUB",1.0,0.0
13 | "9","15",,,"HUB",1.0,0.0
14 | "15","NULL",,,"SOURCE",1.0,2.0
15 | "16","9",,,"HUB",1.0,0.0
16 | "16","17",,,"HUB",1.0,0.0
17 | "17","16",,,"HUB",1.0,0.0
18 | "10","17",,,"HUB",1.0,0.0
19 | "11","10",,,"HUB",1.0,0.0
20 | "11","5",,,"HUB",1.0,0.0
21 | "19","11",,,"HUB",1.0,0.0
22 | "19","12",,,"HUB",1.0,0.0
23 | "19","14",,,"HUB",1.0,0.0
24 | "12","19",,,"HUB",1.0,0.0
25 | "12","13",,,"HUB",1.0,0.0
26 | "13","14",,,"HUB",1.0,0.0
27 | "13","12",,,"HUB",1.0,0.0
28 | "14","19",,,"HUB",1.0,0.0
29 | "14","13",,,"HUB",1.0,0.0
30 | "18","14",,,"USER",1.0,0.0
31 |
--------------------------------------------------------------------------------
/tutorials/tutorial03/input_files/switch_line.csv:
--------------------------------------------------------------------------------
1 | mark,father_mark,init_status,description,type,weight,initial_service
2 | "10","1",,,USER,1,0
3 | "11","3",,,USER,1,0
4 | "12","5",,,USER,1,0
5 | "13","7",,,USER,1,0
6 | "14","9",,,USER,1,0
7 | "1","A",,,HUB,1,0
8 | "1","S1",,,HUB,1,0
9 | "S1","1",1,,SWITCH,1,0
10 | "S1","2",1,,SWITCH,1,0
11 | "2","S1",,,HUB,1,0
12 | "2","S2",,,HUB,1,0
13 | "S2","2",1,,SWITCH,1,0
14 | "S2","3",1,,SWITCH,1,0
15 | "3","S2",,,HUB,1,0
16 | "3","S3",,,HUB,1,0
17 | "S3","3",1,,SWITCH,1,0
18 | "S3","4",1,,SWITCH,1,0
19 | "4","S3",,,HUB,1,0
20 | "4","S4",,,HUB,1,0
21 | "S4","4",1,,SWITCH,1,0
22 | "S4","5",1,,SWITCH,1,0
23 | "5","B",,,HUB,1,0
24 | "5","S4",,,HUB,1,0
25 | "5","S5",,,HUB,1,0
26 | "S5","5",1,,SWITCH,1,0
27 | "S5","6",1,,SWITCH,1,0
28 | "6","S5",,,HUB,1,0
29 | "6","S6",1,,HUB,1,0
30 | "S6","6",1,,SWITCH,1,0
31 | "S6","7",1,,SWITCH,1,0
32 | "7","C",,,HUB,1,0
33 | "7","S6",,,HUB,1,0
34 | "7","S7",,,HUB,1,0
35 | "S7","7",1,,SWITCH,1,0
36 | "S7","8",1,,SWITCH,1,0
37 | "8","S7",,,HUB,1,0
38 | "8","S8",,,HUB,1,0
39 | "S8","8",1,,SWITCH,1,0
40 | "S8","9",1,,SWITCH,1,0
41 | "9","S8",,,HUB,1,0
42 | "B",NULL,,,SOURCE,1,1
43 | "A",NULL,,,SOURCE,1,1
44 | "C",NULL,,,SOURCE,1,1
45 |
--------------------------------------------------------------------------------
/tutorials/tutorial03/input_files/switch_state.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mathLab/GRAPE/f9ed0f5d5c757817ee38fa06b7de2788ad86470c/tutorials/tutorial03/input_files/switch_state.png
--------------------------------------------------------------------------------
/tutorials/tutorial03/input_files/switch_state_alltrue.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mathLab/GRAPE/f9ed0f5d5c757817ee38fa06b7de2788ad86470c/tutorials/tutorial03/input_files/switch_state_alltrue.png
--------------------------------------------------------------------------------
/tutorials/tutorial03/output_files/check_import_edges.csv:
--------------------------------------------------------------------------------
1 | mark,father_mark
2 | 10,1
3 | 11,3
4 | 12,5
5 | 13,7
6 | 14,9
7 | 1,A
8 | 1,S1
9 | S1,1
10 | S1,2
11 | 2,S1
12 | 2,S2
13 | S2,2
14 | S2,3
15 | 3,S2
16 | 3,S3
17 | S3,3
18 | S3,4
19 | 4,S3
20 | 4,S4
21 | S4,4
22 | S4,5
23 | 5,B
24 | 5,S4
25 | 5,S5
26 | S5,5
27 | S5,6
28 | 6,S5
29 | 6,S6
30 | S6,6
31 | S6,7
32 | 7,C
33 | 7,S6
34 | 7,S7
35 | S7,7
36 | S7,8
37 | 8,S7
38 | 8,S8
39 | S8,8
40 | S8,9
41 | 9,S8
42 |
--------------------------------------------------------------------------------
/tutorials/tutorial03/output_files/check_import_nodes.csv:
--------------------------------------------------------------------------------
1 | mark,description,init_status
2 | 10,,
3 | 11,,
4 | 12,,
5 | 13,,
6 | 14,,
7 | 1,,
8 | S1,,1
9 | 2,,
10 | S2,,1
11 | 3,,
12 | S3,,1
13 | 4,,
14 | S4,,1
15 | 5,,
16 | S5,,1
17 | 6,,
18 | 6,,1
19 | S6,,1
20 | 7,,
21 | S7,,1
22 | 8,,
23 | S8,,1
24 | 9,,
25 | B,,
26 | A,,
27 | C,,
28 |
--------------------------------------------------------------------------------
/tutorials/tutorial03/output_files/element_perturbation.csv:
--------------------------------------------------------------------------------
1 | mark,description,init_status,final_status,mark_status,original_closeness_centrality,final_closeness_centrality,original_betweenness_centrality,final_betweenness_centrality,original_indegree_centrality,final_indegree_centrality,original_outdegree_centrality,final_outdegree_centrality,original_local_efficiency,final_local_efficiency,original_nodal_efficiency,final_nodal_efficiency,original_service,final_service
2 | 10,,,,ACTIVE,0.0931098696461825,0.09,0.0,0.0,0.041666666666666664,0.05,0.0,0.0,0.0,0.0,0.0,0.0,0.6000000000000001,1.0
3 | 11,,,,,0.13123359580052493,,0.0,,0.041666666666666664,,0.0,,0.0,,0.0,,0.6000000000000001,
4 | 12,,,,ACTIVE,0.1557632398753894,0.15806451612903225,0.0,0.0,0.041666666666666664,0.05,0.0,0.0,0.0,0.0,0.0,0.0,0.6000000000000001,0.6666666666666666
5 | 13,,,,ACTIVE,0.13123359580052493,0.16896551724137931,0.0,0.0,0.041666666666666664,0.05,0.0,0.0,0.0,0.0,0.0,0.0,0.6000000000000001,0.6666666666666666
6 | 14,,,,ACTIVE,0.08912655971479501,0.10425531914893615,0.0,0.0,0.041666666666666664,0.05,0.0,0.0,0.0,0.0,0.0,0.0,0.6000000000000001,0.6666666666666666
7 | 1,,,,ACTIVE,0.09460167714884696,0.1,0.09219858156028368,0.010526315789473684,0.08333333333333333,0.1,0.08333333333333333,0.05,0.11123046513671513,0.0,0.2011494462781227,0.05,0.0,0.0
8 | S1,,1,0,ACTIVE,0.10518648018648018,0.0,0.1702127659574468,0.0,0.08333333333333333,0.0,0.08333333333333333,0.05,0.21971351259035077,0.05,0.22246093027343025,0.075,0.0,0.0
9 | 2,,,,,0.11660206718346254,,0.24113475177304963,,0.08333333333333333,,0.08333333333333333,,0.23834634694009693,,0.23827757890257886,,0.0,
10 | S2,,1,1,,0.12856125356125356,,0.30260047281323876,,0.08333333333333333,,0.08333333333333333,,0.26027583527583525,,0.2542317636067636,,0.0,
11 | 3,,,,,0.14057632398753891,,0.3877068557919622,,0.08333333333333333,,0.125,,0.1740246250662917,,0.2822740916490917,,0.0,
12 | S3,,1,0,ACTIVE,0.15193602693602692,0.0,0.41371158392434987,0.0,0.08333333333333333,0.0,0.08333333333333333,0.05,0.2749340936840937,0.17480339105339107,0.26784211159211163,0.1739105339105339,0.0,0.0
13 | 4,,,,ACTIVE,0.1617383512544803,0.12803030303030302,0.44208037825059104,0.06842105263157895,0.08333333333333333,0.1,0.08333333333333333,0.05,0.2706604737854738,0.2297817460317461,0.2675940957190957,0.17480339105339107,0.0,0.0
14 | S4,,1,1,ACTIVE,0.16900749063670412,0.15089285714285716,0.46099290780141844,0.18421052631578946,0.08333333333333333,0.1,0.08333333333333333,0.1,0.28083739177489175,0.22562590187590187,0.273478835978836,0.2297817460317461,0.0,0.0
15 | 5,,,,ACTIVE,0.1728927203065134,0.17604166666666665,0.5177304964539007,0.38421052631578945,0.125,0.15,0.125,0.15,0.18231922398589065,0.16494708994708998,0.29408068783068786,0.2764484126984127,0.0,0.0
16 | S5,,1,1,ACTIVE,0.16900749063670412,0.19204545454545457,0.46099290780141844,0.4052631578947368,0.08333333333333333,0.1,0.08333333333333333,0.1,0.28083739177489175,0.27179563492063497,0.273478835978836,0.26505952380952386,0.0,0.0
17 | 6,,,,ACTIVE,0.1617383512544803,0.2011904761904762,0.44208037825059104,0.4368421052631579,0.08333333333333333,0.1,0.08333333333333333,0.1,0.27066047378547375,0.2696130952380953,0.2675940957190957,0.2671428571428572,0.0,0.0
18 | 6,,1,,ACTIVE,0.1617383512544803,0.2011904761904762,0.44208037825059104,0.4368421052631579,0.08333333333333333,0.1,0.08333333333333333,0.1,0.27066047378547375,0.2696130952380953,0.2675940957190957,0.2671428571428572,0.0,0.0
19 | S6,,1,1,ACTIVE,0.15193602693602692,0.2011904761904762,0.41371158392434987,0.4473684210526316,0.08333333333333333,0.1,0.08333333333333333,0.1,0.2749340936840937,0.2819047619047619,0.2678421115921116,0.27416666666666667,0.0,0.0
20 | 7,,,,ACTIVE,0.14057632398753891,0.19204545454545457,0.39952718676122934,0.48947368421052634,0.125,0.15,0.125,0.15,0.1740246250662917,0.18043650793650792,0.2822740916490917,0.29666666666666663,0.0,0.0
21 | S7,,1,1,ACTIVE,0.12640056022408963,0.169,0.2718676122931442,0.3526315789473684,0.08333333333333333,0.1,0.08333333333333333,0.1,0.2602758352758353,0.27401785714285715,0.25423176360676364,0.2671428571428572,0.0,0.0
22 | 8,,,,ACTIVE,0.11309523809523808,0.1456896551724138,0.20567375886524822,0.2789473684210526,0.08333333333333333,0.1,0.08333333333333333,0.1,0.238346346940097,0.25117063492063496,0.23827757890257892,0.25136904761904766,0.0,0.0
23 | S8,,1,1,ACTIVE,0.10095078299776286,0.12426470588235294,0.13002364066193853,0.18421052631578946,0.08333333333333333,0.1,0.08333333333333333,0.1,0.21971351259035085,0.23168650793650797,0.2224609302734303,0.2351984126984127,0.0,0.0
24 | 9,,,,ACTIVE,0.09006986027944111,0.10562500000000001,0.04491725768321513,0.06842105263157895,0.041666666666666664,0.05,0.08333333333333333,0.1,0.11123046513671515,0.11759920634920636,0.20114944627812278,0.21200396825396828,0.0,0.0
25 | B,,,,ACTIVE,0.0,0.0,0.0,0.0,0.0,0.0,0.041666666666666664,0.05,0.29408068783068786,0.2764484126984127,0.2371362433862434,0.22144841269841273,0.0,0.0
26 | A,,,,ACTIVE,0.0,0.0,0.0,0.0,0.0,0.0,0.041666666666666664,0.05,0.2011494462781227,0.05,0.18055013817881463,0.075,0.0,0.0
27 | C,,,,ACTIVE,0.0,0.0,0.0,0.0,0.0,0.0,0.041666666666666664,0.05,0.2822740916490917,0.29666666666666663,0.2278428747178747,0.23547619047619048,0.0,0.0
28 |
--------------------------------------------------------------------------------
/tutorials/tutorial03/output_files/service_paths_element_perturbation.csv:
--------------------------------------------------------------------------------
1 | from,to,original_shortest_path_length,original_shortest_path,original_simple_path,original_pair_efficiency,ids,final_shortest_path_length,final_shortest_path,final_simple_path,final_pair_efficiency
2 | A,10,2.0,"['A', '1', '10']","[['A', '1', '10']]",0.5,A10,2.0,"['A', '1', '10']","[['A', '1', '10']]",0.5
3 | A,11,6.0,"['A', '1', 'S1', '2', 'S2', '3', '11']","[['A', '1', 'S1', '2', 'S2', '3', '11']]",0.16666666666666666,A11,,,,
4 | A,12,10.0,"['A', '1', 'S1', '2', 'S2', '3', 'S3', '4', 'S4', '5', '12']","[['A', '1', 'S1', '2', 'S2', '3', 'S3', '4', 'S4', '5', '12']]",0.1,A12,NO_PATH,NO_PATH,NO_PATH,NO_PATH
5 | A,13,14.0,"['A', '1', 'S1', '2', 'S2', '3', 'S3', '4', 'S4', '5', 'S5', '6', 'S6', '7', '13']","[['A', '1', 'S1', '2', 'S2', '3', 'S3', '4', 'S4', '5', 'S5', '6', 'S6', '7', '13']]",0.07142857142857142,A13,NO_PATH,NO_PATH,NO_PATH,NO_PATH
6 | A,14,18.0,"['A', '1', 'S1', '2', 'S2', '3', 'S3', '4', 'S4', '5', 'S5', '6', 'S6', '7', 'S7', '8', 'S8', '9', '14']","[['A', '1', 'S1', '2', 'S2', '3', 'S3', '4', 'S4', '5', 'S5', '6', 'S6', '7', 'S7', '8', 'S8', '9', '14']]",0.05555555555555555,A14,NO_PATH,NO_PATH,NO_PATH,NO_PATH
7 | B,10,10.0,"['B', '5', 'S4', '4', 'S3', '3', 'S2', '2', 'S1', '1', '10']","[['B', '5', 'S4', '4', 'S3', '3', 'S2', '2', 'S1', '1', '10']]",0.1,B10,NO_PATH,NO_PATH,NO_PATH,NO_PATH
8 | B,11,6.0,"['B', '5', 'S4', '4', 'S3', '3', '11']","[['B', '5', 'S4', '4', 'S3', '3', '11']]",0.16666666666666666,B11,,,,
9 | B,12,2.0,"['B', '5', '12']","[['B', '5', '12']]",0.5,B12,2.0,"['B', '5', '12']","[['B', '5', '12']]",0.5
10 | B,13,6.0,"['B', '5', 'S5', '6', 'S6', '7', '13']","[['B', '5', 'S5', '6', 'S6', '7', '13']]",0.16666666666666666,B13,6.0,"['B', '5', 'S5', '6', 'S6', '7', '13']","[['B', '5', 'S5', '6', 'S6', '7', '13']]",0.16666666666666666
11 | B,14,10.0,"['B', '5', 'S5', '6', 'S6', '7', 'S7', '8', 'S8', '9', '14']","[['B', '5', 'S5', '6', 'S6', '7', 'S7', '8', 'S8', '9', '14']]",0.1,B14,10.0,"['B', '5', 'S5', '6', 'S6', '7', 'S7', '8', 'S8', '9', '14']","[['B', '5', 'S5', '6', 'S6', '7', 'S7', '8', 'S8', '9', '14']]",0.1
12 | C,10,14.0,"['C', '7', 'S6', '6', 'S5', '5', 'S4', '4', 'S3', '3', 'S2', '2', 'S1', '1', '10']","[['C', '7', 'S6', '6', 'S5', '5', 'S4', '4', 'S3', '3', 'S2', '2', 'S1', '1', '10']]",0.07142857142857142,C10,NO_PATH,NO_PATH,NO_PATH,NO_PATH
13 | C,11,10.0,"['C', '7', 'S6', '6', 'S5', '5', 'S4', '4', 'S3', '3', '11']","[['C', '7', 'S6', '6', 'S5', '5', 'S4', '4', 'S3', '3', '11']]",0.1,C11,,,,
14 | C,12,6.0,"['C', '7', 'S6', '6', 'S5', '5', '12']","[['C', '7', 'S6', '6', 'S5', '5', '12']]",0.16666666666666666,C12,6.0,"['C', '7', 'S6', '6', 'S5', '5', '12']","[['C', '7', 'S6', '6', 'S5', '5', '12']]",0.16666666666666666
15 | C,13,2.0,"['C', '7', '13']","[['C', '7', '13']]",0.5,C13,2.0,"['C', '7', '13']","[['C', '7', '13']]",0.5
16 | C,14,6.0,"['C', '7', 'S7', '8', 'S8', '9', '14']","[['C', '7', 'S7', '8', 'S8', '9', '14']]",0.16666666666666666,C14,6.0,"['C', '7', 'S7', '8', 'S8', '9', '14']","[['C', '7', 'S7', '8', 'S8', '9', '14']]",0.16666666666666666
17 |
--------------------------------------------------------------------------------