Skip to content

Conversation

@tsmbland
Copy link
Collaborator

@tsmbland tsmbland commented Oct 20, 2025

Description

Since non-primary outputs are not considered in the investment algorithm (i.e. agents only consider processes for which the demanded commodity is the primary output), we don't need to include non-primary flows in the topological sort. This may help a little bit with the circularities problem because some flow cycles may disappear (or shrink) if you only consider primary flows. See the discussion in #914

Another benefit of this PR is that we can annotate the outputted DOT graphs to highlight primary vs non-primary flows. Here I've made it so non-primary flows appear as dashed lines.

@codecov
Copy link

codecov bot commented Oct 20, 2025

Codecov Report

❌ Patch coverage is 92.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.96%. Comparing base (a942fd0) to head (0a12365).
⚠️ Report is 16 commits behind head on main.

Files with missing lines Patch % Lines
src/graph.rs 92.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #949      +/-   ##
==========================================
+ Coverage   84.88%   84.96%   +0.07%     
==========================================
  Files          50       50              
  Lines        5364     5419      +55     
  Branches     5364     5419      +55     
==========================================
+ Hits         4553     4604      +51     
- Misses        579      581       +2     
- Partials      232      234       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@tsmbland tsmbland marked this pull request as ready for review October 20, 2025 12:02
Copy link
Collaborator

@dalonsoa dalonsoa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks really good, and I think it makes sense thinking on circularities.

Copy link
Collaborator

@alexdewar alexdewar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me!

@tsmbland tsmbland enabled auto-merge October 20, 2025 15:14
@tsmbland tsmbland merged commit 6c18774 into main Oct 20, 2025
8 checks passed
@tsmbland tsmbland deleted the topo_sort_primary_commodities branch October 20, 2025 15:19
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.

4 participants