Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MAINT : styling fixes #38

Merged
merged 4 commits into from
Jan 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,39 +18,41 @@ nx-parallel provides parallelized implementations for the following NetworkX fun

See the `/timing` folder for more heatmaps and code for heatmap generation!


### Development install

To setup a local development:

- Fork this repository.
- Clone the forked repository locally.

```
git clone git@github.com:<your_username>/networkx.git
```

- Create a fresh conda/mamba virtualenv and install the dependencies

```
pip install -e ".[developer]"
```

- Install pre-commit actions that will run the linters before making a commit

```
pre-commit install
```


## Usage

Here's an example of how to use nx-parallel:

```python
In [1]: import networkx as nx; import nx_parallel

In [2]: G = nx.path_graph(4)

In [3]: H = nx_parallel.ParallelGraph(G)
import networkx as nx
import nx_parallel

In [4]: nx.betweenness_centrality(H)
Out[4]: {0: 0.0, 1: 0.6666666666666666, 2: 0.6666666666666666, 3: 0.0}
G = nx.path_graph(4)
H = nx_parallel.ParallelGraph(G)
nx.betweenness_centrality(H)
# output : {0: 0.0, 1: 0.6666666666666666, 2: 0.6666666666666666, 3: 0.0}
```

## Testing
Expand Down
20 changes: 10 additions & 10 deletions benchmarks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@
1. clone this repo
2. `cd benchmarks`
3. If you are working on a different branch then update the `branches` in the `asv.conf.json` file.
4. `asv run` will run the benchmarks on the last commit
- or use `asv continuous base_commit_hash test_commit_hash` to run the benchmark to compare two commits
- or `asv run -b <benchmark_file_name> -k <benchmark_name>` to run a particular benchmark.
- if you are running benchmarks for the first time, you will be asked to enter your machine information after this command.
4. `asv run` will run the benchmarks on the last commit
- or use `asv continuous base_commit_hash test_commit_hash` to run the benchmark to compare two commits
- or `asv run -b <benchmark_file_name> -k <benchmark_name>` to run a particular benchmark.
- if you are running benchmarks for the first time, you will be asked to enter your machine information after this command.
5. `asv publish` will create a `html` folder with the results
6. `asv preview` will host the results locally at http://127.0.0.1:8080/

<hr>

## Structure of benchmarks

* Each `bench_` file corresponds to a folder/file in the [networkx/algorithms](https://github.com/networkx/networkx/tree/main/networkx/algorithms) directory in NetworkX
* Each class inside a `bench_` file corresponds to every file in a folder(one class if it’s a file) in networkx/algorithms
* The class name corresponds to the file name and the `x` in `bench_x` corresponds to the folder name(class name and `x` are the same if it’s a file in networkx/algorithms)
* Each `time_` function corresponds to each function in the file.
* For other folders in [networkx/networkx](https://github.com/networkx/networkx/tree/main/networkx) like `generators`, `classes`, `linalg`, `utils` etc. we can have different `bench_` files for each of them having different classes corresponding to different files in each of these folders.
* For example: `bench_centrality.py` corresponds to `networkx/algorithms/centrality` folder in NetworkX and the `Betweenness` class inside it corresponds to the `betweenness.py` file in `networkx/algorithms/centrality` folder in NetworkX. And the `time_betweenness_centrality` function corresponds to the `betweenness_centrality` function.
- Each `bench_` file corresponds to a folder/file in the [networkx/algorithms](https://github.com/networkx/networkx/tree/main/networkx/algorithms) directory in NetworkX
- Each class inside a `bench_` file corresponds to every file in a folder(one class if it’s a file) in networkx/algorithms
- The class name corresponds to the file name and the `x` in `bench_x` corresponds to the folder name(class name and `x` are the same if it’s a file in networkx/algorithms)
- Each `time_` function corresponds to each function in the file.
- For other folders in [networkx/networkx](https://github.com/networkx/networkx/tree/main/networkx) like `generators`, `classes`, `linalg`, `utils` etc. we can have different `bench_` files for each of them having different classes corresponding to different files in each of these folders.
- For example: `bench_centrality.py` corresponds to `networkx/algorithms/centrality` folder in NetworkX and the `Betweenness` class inside it corresponds to the `betweenness.py` file in `networkx/algorithms/centrality` folder in NetworkX. And the `time_betweenness_centrality` function corresponds to the `betweenness_centrality` function.
Loading