libena 0.4.18-dev.9021
QE C++ library
Loading...
Searching...
No Matches
positions.hpp File Reference

ENA node-position solvers for undirected and directed networks, the points-to-centroids correlation (ena_correlation), and the post-fit unit-circle node move with its centroid recomputation. More...

#include <armadillo>
#include <algorithm>
#include <cmath>
#include <stdexcept>
#include <string>
#include <vector>
#include <libqe/adjacency.hpp>
#include <libqe/linalg_fallback.hpp>
#include <libqe/stats.hpp>

Go to the source code of this file.

Classes

struct  qe::NodePositions
 Aggregated result returned by every node-position solver. More...
 
struct  qe::MovedNodes
 Result of move_nodes_to_unit_circle. More...
 
struct  qe::ConnectionKey
 Which two codes each connection column connects: the column map the layout-agnostic (_by_key) node weighting works from. More...
 

Namespaces

namespace  qe
 

Functions

Correlation
arma::mat qe::ena_correlation (arma::mat points, arma::mat centroids, double conf_level=0.95)
 Pearson correlation with Fisher-z confidence interval between ENA unit points and their centroids.
 
Node-position solvers
NodePositions qe::node_positions (arma::mat adj_mats, arma::mat t, int num_dims)
 Multiobjective least-squares node positions for undirected ENA.
 
NodePositions qe::directed_node_positions (arma::mat line_weights, arma::mat points, int num_dims, bool combine_pairs=false, double self_weight=DIRECTED_SELF_WEIGHT)
 Least-squares node positions for directed (ordered) ENA.
 
NodePositions qe::node_positions_by_key (const arma::mat &line_weights, const arma::mat &points, int num_dims, const ConnectionKey &key, int n_codes, double self_weight=DIRECTED_SELF_WEIGHT)
 Layout-agnostic least-squares node positions: the solve of node_positions / directed_node_positions with node_weights_by_key.
 

Post-fit node moves

enum class  qe::UnitCircleMode { qe::Equal , qe::Radial }
 How unit_circle_nodes places the nodes on the circle. More...
 
UnitCircleMode qe::unit_circle_mode (const std::string &name)
 Parse a mode name for the bindings: "equal" or "radial".
 
arma::mat qe::unit_circle_nodes (const arma::mat &nodes, arma::uword dim_x, arma::uword dim_y, UnitCircleMode mode=UnitCircleMode::Equal)
 Move nodes onto a circle in the plane of two dimensions.
 
arma::mat qe::node_centroids (const arma::mat &line_weights, const arma::mat &nodes, bool directed=false, double self_weight=DIRECTED_SELF_WEIGHT)
 Unit centroids for a set of node positions.
 
MovedNodes qe::move_nodes_to_unit_circle (const arma::mat &line_weights, const arma::mat &nodes, arma::uword dim_x, arma::uword dim_y, UnitCircleMode mode=UnitCircleMode::Equal, bool directed=false, double self_weight=DIRECTED_SELF_WEIGHT)
 The post-fit unit-circle move of a model: moved nodes and their centroids.
 
arma::mat qe::node_centroids_by_key (const arma::mat &line_weights, const arma::mat &nodes, const ConnectionKey &key, double self_weight=DIRECTED_SELF_WEIGHT)
 Layout-agnostic unit centroids: node_weights_by_key times nodes (as node_centroids).
 
MovedNodes qe::move_nodes_to_unit_circle_by_key (const arma::mat &line_weights, const arma::mat &nodes, arma::uword dim_x, arma::uword dim_y, UnitCircleMode mode, const ConnectionKey &key, double self_weight=DIRECTED_SELF_WEIGHT)
 Layout-agnostic post-fit unit-circle move (as move_nodes_to_unit_circle), centroids from node_centroids_by_key.
 

Node weights

constexpr double qe::DIRECTED_SELF_WEIGHT = 2.0
 
arma::mat qe::node_weights (const arma::mat &line_weights)
 Per-unit node weights for undirected ENA.
 
arma::mat qe::directed_node_weights (const arma::mat &line_weights, double self_weight=DIRECTED_SELF_WEIGHT)
 Per-unit node weights for directed (ordered) ENA.
 
ConnectionKey qe::undirected_connection_key (int n_codes, bool diagonal=false)
 Key of the undirected layout: the column-major upper triangle (libqe connection_indices), with the diagonal (A & A, A & B, B & B, ...) when diagonal.
 
ConnectionKey qe::directed_connection_key (int n_codes)
 Key of the ordered (directed) layout: column j*n+i is ground i -> response j, so from = i and to = j.
 
arma::mat qe::node_weights_by_key (const arma::mat &line_weights, const ConnectionKey &key, int n_codes, double self_weight=DIRECTED_SELF_WEIGHT)
 Layout-agnostic node weights: every column counts toward each code it connects; a self-connection (from == to) toward its code self_weight times. Each row is then L1-normalised (as node_weights).
 

Detailed Description

ENA node-position solvers for undirected and directed networks, the points-to-centroids correlation (ena_correlation), and the post-fit unit-circle node move with its centroid recomputation.

Split out of the former libqe/modeling.hpp.