Skip to content

Commit

Permalink
Merge pull request #38 from Schefflera-Arboricola/styling_fixes
Browse files Browse the repository at this point in the history
MAINT : styling fixes
  • Loading branch information
MridulS authored Jan 28, 2024
2 parents ff625b8 + 60b319a commit 0c8e9c1
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 19 deletions.
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 [email protected]:<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.

0 comments on commit 0c8e9c1

Please sign in to comment.