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 small distance means that two assets are near, and a large similarity means that they are near. The mathematics of an algorithm decides which quantity it needs, and the graph does not. On the same triangulated maximally filtered graph, closeness needs the distances and eigenvector centrality needs the similarities. Each algorithm declares its polarity through centrality_polarity, and centrality_graph gives it the quantity that it needs.
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 with no error. The warning of centrality_vector lists every such case. The source decides whether a graph has weights, and the request does not. No flag asks for weights, so a caller names a configured algorithm and never asks for weights. The one request is TopologyOnly in the ov field of the algorithm. It asks for no weights, and every source can give that.
Related