ReceiptsRecorded runs, model-free verdicts
VERIFIED

networkx__networkx-3101

VERIFIED on first verdict

1 attempt, 0 appeals. 1 file, 2 added and 2 removed lines. Tokens: 145,641 tokens. Model cost: $0.05. Sandbox time: 1 min 12 s.

The plan

Repository
networkx/networkx
Base commit
6ee8574 (image tag)
Issue
Use AdjListOuterDict instead of NodeDict for DiGraph's succ and pred? Hi networkx folks, I found the init function of DiGraph [here](https://github.com/networkx/networkx/blob/master/networkx/classes/digraph.py#L303) is interesting. Instead of using `adjlist_outer_dict_factory`, the `node_dict_factory` is used. Is this a bug? My use case is try to hook network's DiGraph to notify my other components of when a node and edge is being added to the graph. My current solution is to subclass the DiGraph and replace the four dict structures with my own dict. However, because of this logic, it is harder to distinguish between node and edge addition/removal. Would you please have a look? Thank you. -Minjie
Files to edit
  • networkx/classes/digraph.py
Approach
In networkx/classes/digraph.py, modify the initialization of _pred and _succ to use adjlist_outer_dict_factory instead of node_dict_factory.

Attempt 1

VERIFIED

Agent branch

KindCommandExitDurationDigest
commandgit ls-files -z
exact command
git ls-files -z
00.003s19268c8f
writewrite networkx/classes/digraph.py
exact command
/opt/receipts-5e86bb76966a4145bd57fc23b6ff0a18/bin/busybox sh -c 'mkdir -p /networkx/networkx/classes && cp /opt/receipts-5e86bb76966a4145bd57fc23b6ff0a18/incoming/31283c43abf82ae027625d63bcbc085d8c1885e389bbaffb74c8b466cf9e7180 /networkx/networkx/classes/digraph.py'
00.005s5e7240e5
commandpytest networkx/classes/tests/test_special.py::test_factories -v
exact command
/opt/receipts-f1f35ac114374f318f4d98959607c8de/bin/busybox mkdir -p /opt/receipts/reports && python -I /opt/receipts-f1f35ac114374f318f4d98959607c8de/receipts_pytest.py networkx/classes/tests/test_special.py::test_factories -v -o junit_family=xunit1 -p no:cacheprovider -rA --continue-on-collection-errors --junitxml=/opt/receipts/reports/agent1-3.xml
00.472s3ceae08433a8
commandpytest networkx/algorithms/shortest_paths/tests/test_weighted.py networkx/algorithms/shortest_paths/weighted.py networkx/classes/tests/test_special.py
exact command
/opt/receipts-1f56f276fcc74cdf9291a2b9fb429176/bin/busybox mkdir -p /opt/receipts/reports && python -I /opt/receipts-1f56f276fcc74cdf9291a2b9fb429176/receipts_pytest.py --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning networkx/algorithms/shortest_paths/tests/test_weighted.py networkx/algorithms/shortest_paths/weighted.py networkx/classes/tests/test_special.py -o junit_family=xunit1 -p no:cacheprovider -rA --continue-on-collection-errors --junitxml=/opt/receipts/reports/agent1-4.xml
10.850s3ceae08433a8
writewrite networkx/classes/digraph.py
exact command
/opt/receipts-af8b4e00b14a45beba6280fe0cef6a00/bin/busybox sh -c 'mkdir -p /networkx/networkx/classes && cp /opt/receipts-af8b4e00b14a45beba6280fe0cef6a00/incoming/af145d5e432f36460575294d5e7da3b123f24871ce0734f30edc73c5ed438c91 /networkx/networkx/classes/digraph.py'
00.004s38a2b333
commandpytest networkx/classes/tests/test_special.py::test_factories -v
exact command
/opt/receipts-0427361e681244c99cfee1579f50e987/bin/busybox mkdir -p /opt/receipts/reports && python -I /opt/receipts-0427361e681244c99cfee1579f50e987/receipts_pytest.py networkx/classes/tests/test_special.py::test_factories -v -o junit_family=xunit1 -p no:cacheprovider -rA --continue-on-collection-errors --junitxml=/opt/receipts/reports/agent1-6.xml
10.522sc83280df1f9c
writewrite networkx/classes/digraph.py
exact command
/opt/receipts-a9e65deb35cb4303ad997105b543f604/bin/busybox sh -c 'mkdir -p /networkx/networkx/classes && cp /opt/receipts-a9e65deb35cb4303ad997105b543f604/incoming/a4e59f6db5ba0bfcf8f649822b0944d6d4895da98ae15b45947ac3cd675f2168 /networkx/networkx/classes/digraph.py'
00.005s7d530854
commandpytest networkx/classes/tests/test_special.py::test_factories -v
exact command
/opt/receipts-cad57ab6bd864259ae9f3092f43464ff/bin/busybox mkdir -p /opt/receipts/reports && python -I /opt/receipts-cad57ab6bd864259ae9f3092f43464ff/receipts_pytest.py networkx/classes/tests/test_special.py::test_factories -v -o junit_family=xunit1 -p no:cacheprovider -rA --continue-on-collection-errors --junitxml=/opt/receipts/reports/agent1-8.xml
10.497s3e0c04c19138
writewrite networkx/classes/digraph.py
exact command
/opt/receipts-81b8b9d898d142fc880868e8d56a7e15/bin/busybox sh -c 'mkdir -p /networkx/networkx/classes && cp /opt/receipts-81b8b9d898d142fc880868e8d56a7e15/incoming/31283c43abf82ae027625d63bcbc085d8c1885e389bbaffb74c8b466cf9e7180 /networkx/networkx/classes/digraph.py'
00.004s07322499
commandpytest networkx/classes/tests/test_special.py::test_factories -v
exact command
/opt/receipts-c581857e064a41eb8e567ed544f7e55c/bin/busybox mkdir -p /opt/receipts/reports && python -I /opt/receipts-c581857e064a41eb8e567ed544f7e55c/receipts_pytest.py networkx/classes/tests/test_special.py::test_factories -v -o junit_family=xunit1 -p no:cacheprovider -rA --continue-on-collection-errors --junitxml=/opt/receipts/reports/agent1-10.xml
00.470s3ceae08433a8
commandpytest networkx/classes/tests/test_special.py -x
exact command
/opt/receipts-fdbe05395ad34fd39fa1b55964b73f9e/bin/busybox mkdir -p /opt/receipts/reports && python -I /opt/receipts-fdbe05395ad34fd39fa1b55964b73f9e/receipts_pytest.py networkx/classes/tests/test_special.py -x -o junit_family=xunit1 -p no:cacheprovider -rA --continue-on-collection-errors --junitxml=/opt/receipts/reports/agent1-11.xml
10.513s3ceae08433a8
diffcapture patch
exact command
compute patch in executor staging agent1-ec6d0b12376241d4a7a5ed78d17f6c06: /opt/homebrew/Cellar/git/2.53.0/bin/git -c core.hooksPath=/dev/null -c core.attributesFile=/dev/null -c diff.external= -c core.quotePath=false add -A && /opt/homebrew/Cellar/git/2.53.0/bin/git -c core.hooksPath=/dev/null -c core.attributesFile=/dev/null -c diff.external= -c core.quotePath=false diff --cached --binary --no-ext-diff --no-textconv --no-renames 45362677276a49d3e6a4173e505ada8b76fb6d52
00.064s3ceae08433a8
Finish summary
Changed DiGraph initialization to use adjlist_outer_dict_factory for both _adj (successors) and _pred (predecessors) dicts, aligning with Graph's usage and ensuring factory tests pass.
Worker outcome
finished
  • Target tests pass: yes
  • Full suite passes: no
  • Files changed: networkx/classes/digraph.py
  • Ran tests: yes

Witness branch w1

KindCommandExitDurationDigest
applyapply patch 5a94b0a5a363
exact command
git update-index -q --refresh; git apply -v --3way --recount --ignore-space-change --whitespace=nowarn /opt/receipts-ba0a22155d0e450bba2d6043e94d7c47/incoming/5a94b0a5a363ef83c1d77e0d8d91438b8ceab5f78ab08d1f6aa06b37b86f785c.diff
00.015s3ceae08433a8
verificationpytest (witness) networkx/algorithms/shortest_paths/tests/test_weighted.py networkx/algorithms/shortest_paths/weighted.py networkx/classes/tests/test_special.py
exact command
/opt/receipts-9e8510e0a91c4cb4adcc36043a70e9b7/bin/busybox mkdir -p /opt/receipts/reports && python -I /opt/receipts-9e8510e0a91c4cb4adcc36043a70e9b7/receipts_pytest.py --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning networkx/algorithms/shortest_paths/tests/test_weighted.py networkx/algorithms/shortest_paths/weighted.py networkx/classes/tests/test_special.py -o junit_family=xunit1 -p no:cacheprovider -rA --continue-on-collection-errors --junitxml=/opt/receipts/reports/w1-2.xml
10.823s3ceae08433a8

Gate predicate checklist

PredicateNameStatusEvidence
R1_fail_to_passFailing specification tests now passPASStarget tests passed: networkx/classes/tests/test_special.py::test_factories
R2_pass_to_passPreviously passing tests keptPASS43 baseline-passing tests still pass
R3_no_shrinkNo removed tests or new skipsPASSall 268 baseline tests collected; skips unchanged (0)
R4_patch_scopePatch scopePASSpatch touches 1 file(s), all in scope
R5_provenanceWitness chain and patch digestPASSagent chain 7f5734c9 -> fd3d7c6a unbroken over 12 receipt(s); witness chain 7f5734c9 -> cd33efde unbroken over 2 receipt(s); applied digest matches
R6_claim_auditAgent claim audit (advisory)FAILclaimed green; own last run had 1 failed, 0 errors: networkx/classes/tests/test_graph.py::networkx::classes::tests::test_special::TestGraph::test_contains

What it said

Finish summary
Changed DiGraph initialization to use adjlist_outer_dict_factory for both _adj (successors) and _pred (predecessors) dicts, aligning with Graph's usage and ensuring factory tests pass.
Worker outcome
finished
  • Target tests pass: yes
  • Full suite passes: no
  • Files changed: networkx/classes/digraph.py
  • Ran tests: yes

What the record shows

contradicted: claimed green; own last run had 1 failed, 0 errors: networkx/classes/tests/test_graph.py::networkx::classes::tests::test_special::TestGraph::test_contains

SWE-rebench's official grader: resolved

Agrees with the gate

Shipped patch

diff --git a/networkx/classes/digraph.py b/networkx/classes/digraph.pyindex 60a202ff..1290bb8b 100644--- a/networkx/classes/digraph.py+++ b/networkx/classes/digraph.py@@ -300,8 +300,8 @@ class DiGraph(Graph):         # We store two adjacency lists:         # the  predecessors of node n are stored in the dict self._pred         # the successors of node n are stored in the dict self._succ=self._adj-        self._adj = ndf()  # empty adjacency dictionary-        self._pred = ndf()  # predecessor+        self._adj = self.adjlist_outer_dict_factory()  # empty adjacency dictionary+        self._pred = self.adjlist_outer_dict_factory()  # predecessor         self._succ = self._adj  # successor          # attempt to load graph with data

Model and costs

Model
NVIDIA Nemotron 3 Super thinking off · temperature 1.0 · top_p 0.95
Tokens
145,641 tokens
Model cost
$0.05
Sandbox time
1 min 12 s
Sandbox cost
Token Factory reported cost: 0.078 (unit not published)
Full environment disclosure
{
  "executor_kind": "tokenfactory",
  "lock_sha256": "69c90b4be65bc7cc897a456b01dba5eedaf19a66ba41faa357b5c0cc66148c76",
  "model": {
    "base_url": "https://api.tokenfactory.nebius.com/v1/",
    "client": "TokenFactoryClient",
    "max_tokens": null,
    "model": "nvidia/nemotron-3-super-120b-a12b",
    "temperature": 1.0,
    "thinking": false,
    "top_p": 0.95
  },
  "pytest_config_digests": {
    "setup.cfg": "a0d23f1c616ae4b6aa8decb1113de55bd2727f579c7110e10180280ed932855e"
  },
  "receipts_version": "0.0.1",
  "test_digests": {
    "networkx/classes/tests/historical_tests.py": "22068e7d62d3f68419f7d95a4b4389c95e1a73e0616f05484fe6ba6dfc3d1784",
    "networkx/classes/tests/test_coreviews.py": "013b73f349eafe57ebf571b47c911dd7ef85a62930dcf4a1efbfd721aaa0c3e4",
    "networkx/classes/tests/test_digraph.py": "4fc2aeac8b889f3913d4189886f439968abb8b1e56fb4a864c83de85ae9de23a",
    "networkx/classes/tests/test_digraph_historical.py": "3e08f5230cc2df8c514dd4d26580870611f3c01064167e92d3dfd4acb1293411",
    "networkx/classes/tests/test_filters.py": "bff7398d50e7d235a59c78f8283762efa7cd3704799ea38939cca5b6c302eccd",
    "networkx/classes/tests/test_function.py": "903c9a306e080678b49ec06f7f31d94a2ee8121540706ce82144e7a5baab8355",
    "networkx/classes/tests/test_graph.py": "d7aac46c6f46665e703902f087b2c5a5a929a640f5be793f4dfd332b10b360c8",
    "networkx/classes/tests/test_graph_historical.py": "e713d19e4624794b929086895df910d664ccc13fc047b2f51d67aa7c7346b625",
    "networkx/classes/tests/test_graphviews.py": "1d075de0a643fc4399f21e0f48768a985950a45e8926f471b96028597d9ec941",
    "networkx/classes/tests/test_multidigraph.py": "4d68abc0344fb340306957092595c641dfd05d0c94f6a89e465ccd95c371f78f",
    "networkx/classes/tests/test_multigraph.py": "516fc85077da63a838d0d010214836f2e456d1e825122b306fed462b4afd89d1",
    "networkx/classes/tests/test_ordered.py": "b638f826018de46f71a4a28503b02296b8e1b29a0bfff8ea58a78b077ff19575",
    "networkx/classes/tests/test_reportviews.py": "ccb8775577266d8bcf351f3d695841b9927f368b75b8d30cf57929d04b4f41f9",
    "networkx/classes/tests/test_special.py": "c74e259af7c5cc35ef99fd1a52545f3e59847faf9d94848e59466dbc9231f04e",
    "networkx/classes/tests/test_subgraphviews.py": "8fa3289ed9d842fc934c14f371691fccbc9b7cd8e59380c89f509e3baeea1f0a"
  }
}

The bundle

Recorded JSON and patches. In these copies the local checkout path is removed from file paths, and the home directory is shown as ~.