Skip to content

[networkx] Use concrete types for the random tree generators - #16617

Merged
srittau merged 1 commit into
python:mainfrom
dannyshafer:networkx-random-tree-returns
Oct 28, 2026
Merged

srittau merged 1 commit into
python:mainfrom
dannyshafer:networkx-random-tree-returns

Conversation

@dannyshafer

Copy link
Copy Markdown
Contributor

The random_unlabeled_* generators return a single graph when number_of_trees/number_of_forests is None and a list otherwise (upstream, upstream, upstream), so they now have overloads instead of returning Incomplete | list[Incomplete]. All the random tree generators build graphs on the nodes range(n) (upstream), so they return Graph[int], and seed uses the existing _RandomState alias.

Written with Claude Code (an AI coding agent).

@github-actions

Copy link
Copy Markdown
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@srittau
srittau merged commit 3aaba0c into python:main Oct 28, 2026
74 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants