OpenSWMM Engine  6.0.0-alpha.1
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.1)
Loading...
Searching...
No Matches
TopoSort.hpp File Reference

Topological sort of network links for KW/steady-state routing. More...

#include <vector>
Include dependency graph for TopoSort.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  openswmm
 
namespace  openswmm::toposort
 

Functions

int openswmm::toposort::sortLinks (const int *node1, const int *node2, int n_links, int n_nodes, std::vector< int > &sorted_links)
 Sort links in topological (upstream→downstream) order.
 

Detailed Description

Topological sort of network links for KW/steady-state routing.

Kahn's algorithm: process nodes with zero in-degree first, then their downstream neighbours. Produces a sorted link index array for upstream-to-downstream processing.

SoA data: InDegree[], AdjList[] (CSR format).

Note
Legacy reference: src/legacy/engine/toposort.c
Author
Caleb Buahin caleb.nosp@m..bua.nosp@m.hin@g.nosp@m.mail.nosp@m..com
License\n MIT License