Centrality Polarity: private API
PortfolioOptimisers.AbstractCentralityPolarity — Type
abstract type AbstractCentralityPolarity <: AbstractAlgorithmAbstract supertype for the polarity of the edge weights a centrality algorithm reads.
A weighted network carries one of two opposite quantities on its edges. A distance runs small-is-close; a similarity runs large-is-close. Which one an algorithm needs is a fact about its own mathematics and not about the graph it is handed: on one and the same triangulated maximally filtered graph, closeness wants the distances and eigenvector centrality wants the similarities. So the polarity is declared per algorithm, by centrality_polarity, and the builder supplies the matching quantity.
Polarity never decides whether the call succeeds
It selects which weights an algorithm receives, and nothing else. An algorithm that declares no polarity, and a source that carries no weights, both run on the plain unweighted graph rather than raising — see the warning on centrality_vector for the full list. Weightedness is a property of the source, not of the request: there is no flag, so a caller names a configured algorithm and never asks for weights. The one request there is, TopologyOnly in the algorithm's ov field, asks away from them, and every source can serve it.
Related