Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
129 commits
Select commit Hold shift + click to select a range
9cc8b42
Add Kirchhoff index / Effective graph resistance (#6926)
Dec 9, 2023
d85f3a4
DOC: fix URL econded links and doc references (#7152)
MridulS Dec 12, 2023
dd6d68e
Changed return types of shortest path methods to improve consistency …
navyagarwal Dec 13, 2023
7abde00
adding test coverage for isomorphism when using digraphs (#6417)
ImHereForTheCookies Dec 13, 2023
1dade0d
Remove usage of `__networkx_plugin__` (use `__networkx_backend__` ins…
eriknw Dec 13, 2023
1c2fa4b
DOC: consistent spelling of neighbor and rename vars (#7162)
MridulS Dec 15, 2023
c0f5918
DOC: add reference to fast_label_propagation_communities (#7167)
MridulS Dec 15, 2023
6ad7842
MAINT: use ruff format instead of black (#7160)
MridulS Dec 16, 2023
75c0345
updated See also sec of argmap class (#7163)
Schefflera-Arboricola Dec 16, 2023
f34dda2
Modify GML test to fix invalid octal character warning. (#7159)
rossbar Dec 17, 2023
483ea9a
DOC : updated examples in mincost.py (#7169)
Schefflera-Arboricola Dec 17, 2023
d68caf6
Ensure warnings related to changes in shortest_path returns are visib…
rossbar Dec 17, 2023
92afda9
Sync up behavior of is_{type} for empty graphs (#5849)
MridulS Dec 18, 2023
59e6b7f
Added `NodeNotFound` exceptions to `_apply_prediction` and `simrank`,…
Schefflera-Arboricola Dec 18, 2023
267e33e
Document the walk_type argument default in directed_laplacian and sim…
aylithe Dec 18, 2023
d042db5
DOC: Add plots to classic graph generators docs (#7114)
MridulS Dec 20, 2023
b7d0b0c
Fix not_implemented_for decorator for is_regular and related function…
rossbar Dec 21, 2023
a97c162
New PR for Fixes minimal d-separator function failing to handle cases…
dschult Dec 22, 2023
1168afc
Fix all_node_cuts output for complete graphs (#6558)
navyagarwal Dec 22, 2023
0762b7f
Fix a tiny typo in `structuralholes.py::local_constraint` docstring (…
sadra-barikbin Dec 30, 2023
6109e10
Added `subgraph_is_monomorphic` and `subgraph_monomorphisms_iter` in …
Schefflera-Arboricola Dec 30, 2023
e755ea7
Fix online docs for `_dispatch` (#7194)
eriknw Jan 2, 2024
3a98973
Remove `"networkx.plugins"` and `"networkx.plugin_info"` entry-points…
eriknw Jan 2, 2024
ad92646
DOC : Updated docs for panther_similarity (#7175)
Schefflera-Arboricola Jan 2, 2024
6228824
Fix warnings when building docs (#7195)
eriknw Jan 2, 2024
3394571
Bump actions/setup-python from 4 to 5 (#7201)
dependabot[bot] Jan 3, 2024
73c6552
Update test suite for Pytest v8 (#7203)
rossbar Jan 4, 2024
5d2f19b
Undeprecate ``nx_pydot`` now that pydot is actively maintained again …
rossbar Jan 4, 2024
f573004
Future-proofing and improve tests (#7209)
rossbar Jan 6, 2024
f52696e
Drop old dependencies per SPEC 0 (#7217)
jarrodmillman Jan 9, 2024
5c9e8c3
Update pygraphviz (#7216)
jarrodmillman Jan 9, 2024
e36da1d
ENH : Provide non-normalized and normalized directed laplacian matrix…
smokestacklightnin Jan 9, 2024
205cd05
Refactor geometric_soft_configuration_model tests for performance (#7…
rossbar Jan 10, 2024
0204a24
Add `add_half_edge` method to PlanarEmbedding (#7202)
mdealencar Jan 10, 2024
7e01590
Improve docs for optimal_edit_paths (#7130)
akshayamadhuri Jan 11, 2024
54eca15
Fix random_spanning_tree() for single node and empty graphs (#7211)
nihalgeorge01 Jan 11, 2024
5a7800e
Update methods for modifying edges in PlanarEmbedding (#6798)
mdealencar Jan 11, 2024
83030a6
Rename `_dispatch` to `_dispatchable` (#7193)
eriknw Jan 12, 2024
e35e98b
DOC: build with nx-parallel extra documentation information (#7220)
MridulS Jan 12, 2024
fd3cadc
Add functions to compute Schultz and Gutman Index (#3709)
jangwon-yie Jan 13, 2024
b2f98a4
Replace tempfile with tmp_path fixture in test suite. (#7221)
rossbar Jan 14, 2024
8682e1b
Fixed typo in tensor product documentation (Fixes #7228) (#7229)
max-seeli Jan 16, 2024
4a0a675
updated test_directed_edge_swap to fix #5814 (#6426)
Dishie2498 Jan 17, 2024
40e84a4
Add example for cycle detection (#6560)
PurviChaurasia Jan 17, 2024
7fc4fa5
Bump copyright year for 2024. (#7232)
rossbar Jan 18, 2024
3eecad3
Divisive community algorithms (#5830)
MridulS Jan 19, 2024
55ed947
add seed to graph creation (#7241)
dschult Jan 19, 2024
838fc93
add seed to tests of fast_label_propatation_communities (#7242)
dschult Jan 20, 2024
d06bbe0
Added feature modular graph product (#7227)
max-seeli Jan 23, 2024
d6569ad
ENH : added `sort_neighbors` to all functions in `depth_first_search.…
Schefflera-Arboricola Jan 24, 2024
2da3686
Add Kneser graph creation function (#7146)
Transurgeon Jan 29, 2024
30ac795
Update general_k_edge_subgraphs docstring. (#7254)
rossbar Jan 30, 2024
f488d08
Improving test coverage for Small.py (#7260)
vanshika230 Jan 31, 2024
215470a
Fix rich_club_coefficient() for small graphs (#7212)
nihalgeorge01 Jan 31, 2024
3bdf3bb
Test for symmetric edge flow betweenness partition (#7251)
Schefflera-Arboricola Jan 31, 2024
7c0d881
MAINT : added `seed` to `gnm_random_graph` in `community/tests/test_l…
Schefflera-Arboricola Feb 1, 2024
42666fa
Bump scientific-python/upload-nightly-action from 0.2.0 to 0.3.0 (#7266)
dependabot[bot] Feb 2, 2024
72d1f68
ENH: Speed up common/non_neighbors by using _adj dict operations (#7244)
MridulS Feb 2, 2024
d769e3b
Update docstring of nonisomorphic_trees. (#7255)
rossbar Feb 2, 2024
ea6942f
adding self loops related docs and tests for functions in `cluster.py…
Schefflera-Arboricola Feb 3, 2024
1fa2414
Add feature for drawing multi edges and labels (#7010)
Feb 6, 2024
923e029
Add minimum_cycle_basis to cycle_basis See Also. (#7274)
rossbar Feb 6, 2024
31ef963
Improving test coverage for Mycielsky.py (#7271)
vanshika230 Feb 6, 2024
313508e
Use github actions to run a comparison benchmark (#7268)
MridulS Feb 7, 2024
64489da
DOC: Replace mention of black with pre-commit in contributing guide (…
cnpryer Feb 9, 2024
3c0f096
Update docstring formatter (#7276)
cnpryer Feb 9, 2024
1e6bcf6
Add docstring formatting change to blame-ignore-revs. (#7281)
rossbar Feb 10, 2024
74ce63f
Fix all sphinx warnings during doc build. (#7289)
rossbar Feb 12, 2024
c855557
Improve test coverage for random_clustered and update function names …
vanshika230 Feb 14, 2024
5872457
Fix minimum_spanning_arborescence regression (#7280)
Erotemic Feb 14, 2024
eba1a4e
Doc infrastructure: replace `nb2plot` with `myst-nb` (#7237)
rossbar Feb 14, 2024
8bc625b
Move arrowstyle input munging after intput validation. (#7293)
rossbar Feb 15, 2024
fce5d7d
Temporarily rm geospatial examples to fix CI. (#7299)
rossbar Feb 15, 2024
242a02a
BFS layout implementation (#5179)
matthieugouel Feb 15, 2024
d709049
Add `max_level=` argument to `louvain_communities` to limit macro-ite…
eriknw Feb 15, 2024
0ed564b
Review and update `@nx._dispatchable` usage since 3.2.1 (#7302)
eriknw Feb 18, 2024
88193c0
Improve test coverage for bipartite extendability (#7306)
vanshika230 Feb 21, 2024
b7782fa
CI: Update scientific-python/upload-nightly-action from 0.3.0 to 0.4.…
matthewfeickert Feb 22, 2024
8cffd1e
CI: Group dependabot updates (#7308)
matthewfeickert Feb 22, 2024
eec4012
Transmogrify `_dispatchable` objects into functions (#7298)
eriknw Feb 23, 2024
26ccbd7
CI: update upload-nightly-action to 0.5.0 (#7311)
MridulS Feb 24, 2024
de85e3f
renaming backend `func_info` dictionary's keys (#7219)
Schefflera-Arboricola Feb 25, 2024
5b9aec5
Add `mutates_input=` and `returns_graph=` to `_dispatchable` (#7191)
eriknw Feb 28, 2024
611cc9a
Deprecate the `create` argument of `nonisomorphic_trees` (#7316)
rossbar Feb 28, 2024
f5ada3f
fix: make `PlanarEmbedding.copy()` use `add_edges_from()` from parent…
mdealencar Feb 28, 2024
26cbde3
Add explicit targets of missing modules for intersphinx (#7313)
eriknw Feb 28, 2024
051ffc1
Allow seed of np.random instance to exactly produce arbitrarily large…
dschult Feb 28, 2024
5934f7e
DOC: add doc suggestions for arbitrarily large random integers tools …
dschult Mar 1, 2024
c339da9
Fix empty GraphML attribute is not parsed (#7319)
salym Mar 1, 2024
28f3e9f
Avoid creating results with numpy scalars (re: NEP 51) (#7282)
eriknw Mar 1, 2024
046eed4
Bump changelist from 0.4 to 0.5 (#7325)
dependabot[bot] Mar 2, 2024
00e3c4c
Add number_of_spanning_trees (#7100)
Mar 3, 2024
df96f47
Improve test coverage for bipartite matrix.py (#7312)
vanshika230 Mar 4, 2024
8fe7f49
Try/except intermittently failing basemaps in geospatial examples (#7…
rossbar Mar 4, 2024
7e97d4c
Update __init__.py (#7320)
BucketHeadP65 Mar 4, 2024
41fd8df
add seed to `nx.generate_random_paths` (#7332)
aaronzo Mar 5, 2024
1f8d279
Allow backends to implement `should_run` (#7257)
eriknw Mar 5, 2024
15df915
Un-dispatch coloring strategies. (#7329)
rossbar Mar 5, 2024
e005b69
Undo change in return type of `single_target_shortest_path_length` (#…
rossbar Mar 5, 2024
19e6bc7
Update docstring example with future-proof pandas assignment. (#7323)
rossbar Mar 5, 2024
91337d5
Remove animation from spectral clustering example to improve performa…
rossbar Mar 6, 2024
9e72994
Add new test result to `test_asadpour_tsp` and change `linprog` metho…
mjschwenne Mar 7, 2024
e31af67
adding tree broadcast algorithm
Sep 8, 2023
1fcb41e
adding steps and more tests
Sep 14, 2023
8a3c5c3
adding citation and assertion
Sep 14, 2023
e6fb0ff
applying first set of suggestions
Sep 26, 2023
adf2ea9
updating docstrings for tree broadcast
Sep 27, 2023
583370e
Apply suggestions from code review
Transurgeon Oct 5, 2023
3d3a7d5
removing self-loop check
Oct 5, 2023
8d44582
cleaning update to avoid dict instance
Oct 5, 2023
a8a3756
adding test case for star graph
Oct 5, 2023
74ea7af
updating docstrings for constraints
Oct 5, 2023
1f7df95
applying some theoretical changes
Oct 12, 2023
27e4fce
adding broadcast center implementation and tests
Oct 30, 2023
e130a46
completing tree broadcast algorithm and tests
Oct 31, 2023
48d1d24
adding first set of changes round 2
Dec 1, 2023
531649d
adding optimization for broadcast time of the tree
Dec 10, 2023
603888a
copying code to new location
Jan 17, 2024
f4cdc9e
Update networkx/algorithms/approximation/broadcasting.py
Transurgeon Jan 16, 2024
7f05b51
Update networkx/algorithms/approximation/broadcasting.py
Transurgeon Jan 16, 2024
0d75863
changing all instances of vertices to nodes
Jan 17, 2024
dcf9969
fixing up some formatting issues
Jan 17, 2024
b401d09
removing two previous files from implementation
Jan 17, 2024
0d866b1
adding broadcsting to index reference file
Jan 17, 2024
d0e53d1
Update networkx/algorithms/broadcasting.py
Transurgeon Jan 17, 2024
594aa9a
Update networkx/algorithms/broadcasting.py
Transurgeon Jan 17, 2024
861476f
Update networkx/algorithms/broadcasting.py
Transurgeon Jan 17, 2024
c349423
Update networkx/algorithms/broadcasting.py
dschult Jan 18, 2024
3b59ba5
Minor touchups.
rossbar Mar 7, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ jobs:
pip install git+https://github.com/rapidsai/cugraph.git#subdirectory=python/nx-cugraph --no-deps
# Development version of GraphBLAS backend
pip install git+https://github.com/python-graphblas/graphblas-algorithms.git@main --no-deps
# Development version of nx-parallel backend
pip install git+https://github.com/networkx/nx-parallel.git@main --no-deps
pip list

- save_cache:
Expand Down
1 change: 1 addition & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ be23fa0e422b51f4526828cb19b8105c89e5dcbb
5c0b11afb4c0882a070d522ef3fa41482ba935d3
5fcf01b9a43a097c4f579486023d1279b2b88619
7297ae8a37dd3356b64d383cb0c55735a6364bcc
3c0f096f66ab352cfaf8dbe2d5fc5731cbbc4338
4 changes: 4 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ updates:
directory: "/"
schedule:
interval: "monthly"
groups:
actions:
patterns:
- "*"
labels:
- "type: Maintenance"
- package-ecosystem: "pip"
Expand Down
117 changes: 117 additions & 0 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
### Inspired from https://github.com/scikit-image/scikit-image/blob/main/.github/workflows/benchmarks.yml

name: Benchmark PR
on:
pull_request:
types: [labeled, synchronize]

jobs:
## This code below is to make sure a new commit on a PR with the label
## retriggers the benchmark, otherwise the label needs to be removed and
## applied again to run the benchmark.
check:
runs-on: ubuntu-latest
outputs:
result: ${{ steps.check.outputs.result }}
steps:
- uses: actions/checkout@v4

- uses: actions/github-script@v7
name: Check for benchmark label and new commit
id: check
with:
script: |
const { owner, repo, number: pull_number } = context.issue;

// Check for label
const { data: pullRequest } = await github.rest.pulls.get({ owner, repo, pull_number });
if (!pullRequest.labels.some(({ name }) => name === 'run:benchmark')) {
return false;
}

// Check for repo name and organization name
const { data: repository } = await github.rest.repos.get({ owner, repo });
return repository.name === 'networkx' && repository.owner.login === 'networkx';
benchmark:
needs: check
if: ${{ needs.check.outputs.result == 'true' }}
# if: contains(github.event.pull_request.labels.*.name, 'run:benchmark') || ${{ github.event.label.name == 'run:benchmark' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"

- name: Setup some dependencies
shell: bash -l {0}
run: |
sudo apt-get update -y && sudo apt-get install -y ccache
# Make gcc/gxx symlinks first in path
sudo /usr/sbin/update-ccache-symlinks
echo "/usr/lib/ccache" >> $GITHUB_PATH

- name: "Prepare ccache"
id: prepare-ccache
shell: bash -l {0}
run: |
echo "key=benchmark-$RUNNER_OS" >> $GITHUB_OUTPUT
echo "timestamp=$(date +%Y%m%d-%H%M%S)" >> $GITHUB_OUTPUT
ccache -p
ccache -z

- name: "Restore ccache"
uses: actions/cache@v3
with:
path: .ccache
key: ccache-${{ secrets.CACHE_VERSION }}-${{ steps.prepare-ccache.outputs.key }}-${{ steps.prepare-ccache.outputs.timestamp }}
restore-keys: |
ccache-${{ secrets.CACHE_VERSION }}-${{ steps.prepare-ccache.outputs.key }}-

- name: Install packages
run: |
pip install --upgrade pip
pip install -r requirements/default.txt
pip install .
pip list

- name: Run benchmarks
shell: bash -l {0}
id: benchmark
env:
ASV_FACTOR: 1.5
ASV_SKIP_SLOW: 1
run: |
set -x
python -m pip install asv virtualenv packaging
cd benchmarks/

# ID this runner
python -m asv machine --yes --conf asv.conf.json

echo "Baseline: ${{ github.event.pull_request.base.sha }} (${{ github.event.pull_request.base.label }})"

echo "Contender: ${GITHUB_SHA} (${{ github.event.pull_request.head.label }})"

# Run benchmarks for current commit against base
ASV_OPTIONS="--split --show-stderr --factor $ASV_FACTOR --conf asv.conf.json"
python -m asv continuous $ASV_OPTIONS ${{ github.event.pull_request.base.sha }} ${GITHUB_SHA} \
| sed "/Traceback \|failed$\|PERFORMANCE DECREASED/ s/^/::error::/" \
| tee benchmarks.log

# Report and export results for subsequent steps
if grep "Traceback \|failed\|PERFORMANCE DECREASED" benchmarks.log > /dev/null ; then
exit 1
fi

- name: "Check ccache performance"
shell: bash -l {0}
run: ccache -s
if: always()

- uses: actions/upload-artifact@v4
if: always()
with:
name: asv-benchmark-results-${{ runner.os }}
path: benchmarks.log
2 changes: 1 addition & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.11"

Expand All @@ -38,6 +38,8 @@ jobs:
pip install git+https://github.com/rapidsai/cugraph.git#subdirectory=python/nx-cugraph --no-deps
# Development version of GraphBLAS backend
pip install git+https://github.com/python-graphblas/graphblas-algorithms.git@main --no-deps
# Development version of nx-parallel backend
pip install git+https://github.com/networkx/nx-parallel.git@main --no-deps
pip list

# To set up a cross-repository deploy key:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/mypy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/nightly-release-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install Python requirements
Expand All @@ -27,7 +27,7 @@ jobs:
- name: List contents of wheel
run: python -m zipfile --list dist/networkx-*.whl
- name: Upload nighlty wheel
uses: scientific-python/upload-nightly-action@5fb764c5bce1ac2297084c0f7161b1919f17c74f # 0.2.0
uses: scientific-python/upload-nightly-action@b67d7fcc0396e1128a474d1ab2b48aa94680f9fc # 0.5.0
with:
anaconda_nightly_upload_token: ${{ secrets.ANACONDA_NIGHTLY }}
artifacts_path: dist/
2 changes: 1 addition & 1 deletion .github/workflows/pytest-randomly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.10"

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
with:
fetch-depth: 0

- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: "3.11"
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

Expand All @@ -40,7 +40,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

Expand All @@ -66,7 +66,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

Expand All @@ -90,7 +90,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

Expand Down Expand Up @@ -150,7 +150,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

Expand Down
13 changes: 3 additions & 10 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,19 @@
# pre-commit install

repos:
- repo: https://github.com/psf/black
rev: 23.9.1
hooks:
- id: black
- repo: https://github.com/adamchainz/blacken-docs
rev: 1.16.0
hooks:
- id: blacken-docs
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.0.3
rev: v3.1.0
hooks:
- id: prettier
files: \.(html|md|toml|yml|yaml)
args: [--prose-wrap=preserve]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.0.291
rev: v0.1.8
hooks:
- id: ruff
args:
- --fix
- id: ruff-format
- repo: local
hooks:
- id: generate_requirements.py
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ Development Workflow
# Test your installation
pytest --pyargs networkx

* Finally, we recommend you use a pre-commit hook, which runs black when
you type ``git commit``::
* Finally, we recommend you install pre-commit which checks
that your code matches formatting guidelines::

pre-commit install

Expand Down
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ NetworkX is distributed with the 3-clause BSD license.

::

Copyright (C) 2004-2023, NetworkX Developers
Copyright (C) 2004-2024, NetworkX Developers
Aric Hagberg <hagberg@lanl.gov>
Dan Schult <dschult@colgate.edu>
Pieter Swart <swart@lanl.gov>
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ License

Released under the 3-Clause BSD license (see `LICENSE.txt`)::

Copyright (C) 2004-2023 NetworkX Developers
Copyright (C) 2004-2024 NetworkX Developers
Aric Hagberg <hagberg@lanl.gov>
Dan Schult <dschult@colgate.edu>
Pieter Swart <swart@lanl.gov>
51 changes: 51 additions & 0 deletions benchmarks/benchmarks/benchmark_neighbors.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import networkx as nx


# NOTE: explicit set construction in benchmarks is required for meaningful
# comparisons due to change in return type from generator -> set. See gh-7244.
class NonNeighbors:
param_names = ["num_nodes"]
params = [10, 100, 1000]

def setup(self, num_nodes):
self.star_graph = nx.star_graph(num_nodes)
self.complete_graph = nx.complete_graph(num_nodes)
self.path_graph = nx.path_graph(num_nodes)

def time_star_center(self, num_nodes):
set(nx.non_neighbors(self.star_graph, 0))

def time_star_rim(self, num_nodes):
set(nx.non_neighbors(self.star_graph, 5))

def time_complete(self, num_nodes):
set(nx.non_neighbors(self.complete_graph, 0))

def time_path_first(self, num_nodes):
set(nx.non_neighbors(self.path_graph, 0))

def time_path_last(self, num_nodes):
set(nx.non_neighbors(self.path_graph, num_nodes - 1))

def time_path_center(self, num_nodes):
set(nx.non_neighbors(self.path_graph, num_nodes // 2))


# NOTE: explicit set construction in benchmarks is required for meaningful
# comparisons due to change in return type from generator -> set. See gh-7244.
class CommonNeighbors:
param_names = ["num_nodes"]
params = [10, 100, 1000]

def setup(self, num_nodes):
self.star_graph = nx.star_graph(num_nodes)
self.complete_graph = nx.complete_graph(num_nodes)

def time_star_center_rim(self, num_nodes):
set(nx.common_neighbors(self.star_graph, 0, num_nodes // 2))

def time_star_rim_rim(self, num_nodes):
set(nx.common_neighbors(self.star_graph, 4, 5))

def time_complete(self, num_nodes):
set(nx.common_neighbors(self.complete_graph, 0, num_nodes // 2))
Loading