Skip to main content

create_commodities_graph_for_year

Function create_commodities_graph_for_year 

Source
fn create_commodities_graph_for_year(
    processes: &ProcessMap,
    region_ids: &IndexSet<RegionID>,
    year: u32,
) -> CommoditiesGraph
Expand description

Creates a directed graph of commodity flows for a given year, covering all regions.

The graph contains nodes for all (commodity, region) pairs that may be consumed/produced by processes in the specified year across all regions. There will be an edge from node (A, R) to (B, R) if there exists a process in region R that consumes commodity A and produces commodity B. Processes currently only consume and produce commodities in their own region, so there are no edges between nodes in different regions.

There are also special Source and Sink nodes, which are used for processes that have no inputs or outputs.

The graph does not take into account process availabilities or commodity demands, both of which can vary by time slice. See prepare_commodities_graph_for_validation.