Assortativity#
Note
The methods in this section rely on calculating the Pearson correlation
coefficient between pairs of value sequences. If the network is regular (i.e.
all vertices have equal degree or label) or if the network has fewer than two
pairs of interacting vertices, the result of calculating assortativity will
be NaN
.
Degree assortativity#
Undirected networks#
- degree_assortativity(undirected_network) float #
-
template<undirected_static_network_edge EdgeT>
double degree_assortativity(const network<EdgeT> &net)#
Calculates degree assortativity for undirected dyadic and hypergraph static networks. Assortativity is calculated through Pearson correlation coefficient over degrees of all pairs of interacting vertices.
Directed networks#
- in_in_degree_assortativity(directed_network) float #
- in_out_degree_assortativity(directed_network) float #
- out_in_degree_assortativity(directed_network) float #
- out_out_degree_assortativity(directed_network) float #
-
template<directed_static_network_edge EdgeT>
double in_in_degree_assortativity(const network<EdgeT> &net)#
-
template<directed_static_network_edge EdgeT>
double in_out_degree_assortativity(const network<EdgeT> &net)#
-
template<directed_static_network_edge EdgeT>
double out_in_degree_assortativity(const network<EdgeT> &net)#
-
template<directed_static_network_edge EdgeT>
double out_out_degree_assortativity(const network<EdgeT> &net)#
Calculates in-/out-degree assortativity for directed dyadic and hypergraph static networks. Assortativity is calculated through Pearson correlation coefficient over degrees of all pairs of interacting vertices.
Numerical attribute assortativity#
Undirected networks#
- attribute_assortativity(undirected_network, attribute_fun: Callable[[network.edge_type()], float]) float #
Calculates assortativity of the given numerical function for undirected dyadic and hypergraph static networks. Assortativity is calculated through Pearson correlation coefficient over the value of the given function over all pairs of interacting vertices.
- attribute_assortativity(undirected_network, attribute_map: dict[network.edge_type(), float], default_value: float) float
Calculates assortativity of the given mapping of vertices to floating-point
(dictionary) for undirected dyadic and hypergraph static networks. Assortativity
is calculated through Pearson correlation coefficient over the value of the
given mapping over all pairs of interacting vertices. If a vertex is not present
in the mapping, the value of the argument default_value
is used.
Directed networks#
- attribute_assortativity(directed_network, mutator_attribute_fun: Callable[[network.edge_type()], float], mutated_attribute_fun: Callable[[network.edge_type()], float]) float #
-
template<undirected_static_network_edge EdgeT, std::invocable<const typename EdgeT::VertexType&> AttrFun1, std::invocable<const typename EdgeT::VertexType&> AttrFun2>
requires std::convertible_to<std::invoke_result_t<AttrFun1, const typename EdgeT::VertexType&>, double> && std::convertible_to<std::invoke_result_t<AttrFun2, const typename EdgeT::VertexType&>, double>
double attribute_assortativity(const network<EdgeT> &net, AttrFun1 &&mutator_attribute_fun, AttrFun2 &&mutated_attribute_fun)#
Calculates assortativity of the given numerical functions for directed dyadic
and hypergraph static networks. Assortativity is calculated through Pearson
correlation coefficient over the value of the given function over all pairs of
interacting vertices. The associated value of the mutator (tail of the arrow
representation of a directed link) is calculated from the function
mutator_attribute_fun
, and the mutated vertex (head of the arrow) from
mutated_attribute_fun
.
- attribute_assortativity(directed_network, mutator_attribute_map: dict[network.edge_type(), float], mutated_attribute_map: dict[network.edge_type(), float], mutator_default_value: float, mutated_default_value: float) float
Calculates assortativity of the given pair of mappings of vertices to
floating-point (dictionaries) for directed dyadic and hypergraph static
networks. Assortativity is calculated through Pearson correlation coefficient
over the value of the given pair of mappings over all pairs of interacting
vertices. If a vertex is not present in one of the mappings, the value of the
argument mutator_default_value
or mutated_attribute_fun
is used.
The associated value of the mutator (tail of the arrow representation of a
directed link) is calculated from the function mutator_attribute_fun
, and
the mutated vertex (head of the arrow) from mutated_attribute_fun
.