Metrics Description
This reference page provides an overview of the metrics available in the dyn-benchmark package for analyzing evolving communities and temporal networks.
1. Metrics Organization
Metrics in the package are organized into several categories (handlers):
Category |
Description |
|---|---|
|
Metrics for network structure at each snapshot |
|
Metrics for community partition quality at each snapshot |
|
Metrics for individual communities at specific snapshots |
|
Metrics for community structure within the network |
|
Metrics for communities across their lifetime |
|
Metrics for temporal snapshots |
|
Metrics for individual member behavior |
|
Metrics for members at specific snapshots |
|
Metrics for transitions between communities |
These handlers are useful for customizing the metrics you want to compute. For example, if you only want to compute community metrics, you can use the graph_partition_handler and static_community_handler handlers. Refer to the Tutorial 3 Metrics Computation and Analysis for more details on how to use these handlers.
Heavy vs. Light Metrics
Some metrics are computationally intensive for large networks:
Heavy metrics (use with caution for large networks):
diameteraverage_shortest_path_length
Light metrics (efficient for any network size):
number_of_nodesnumber_of_edgesmodularityMost community and member metrics
The package provides a predefined list of heavy metrics you can exclude from your analysis:
from dyn.benchmark.metrics import graph_heavy_metrics
# Create metrics computer excluding heavy metrics
light_metrics = GroundtruthMetricsComputer(
graph=[m for m in graph_handler.funcs if m not in graph_heavy_metrics]
)
2. Static Network and Community Metrics
This section focuses on metrics that evaluate the structure of networks and communities at each snapshot.
Graph Structure Metrics
Graph metrics analyze the structural properties of the network at each snapshot and can be accessed through metrics["graph"]. These metrics help understand the overall connectivity patterns and topological features of the network.
Metric |
Description |
|---|---|
|
Count of nodes in the network. |
|
Count of edges in the network. |
|
Maximum shortest path length in the graph. Returns nan if the graph has no edges or is not connected. |
|
Average of all shortest paths. |
|
Average clustering coefficient. |
|
Number of connected components. |
Community Partition Quality
Partition metrics evaluate the quality of community division at each snapshot and can be accessed through metrics["graph_partition"]. These metrics quantify how well-defined the community structure is within the network.
Metric |
Description |
|---|---|
|
Measure of the quality of community division. |
|
Fraction of intra-community edges. |
|
Ratio of intra-community edges plus inter-community non-edges to the total number of potential edges. Measures both the presence of edges within communities and the absence of edges between communities. |
|
Probability of edge between nodes in same community. |
|
Probability of edge between nodes in different communities. |
Static Community Metrics
Static community metrics analyze individual communities at specific snapshots and can be accessed through metrics["static_community"]. These metrics help understand the characteristics and dynamics of each community at a particular point in time.
Metric |
Description |
|---|---|
|
Number of members in the community. |
|
Ratio calculated as the sum of incoming members (immigrants) and outgoing members (emigrants) divided by twice the size of the predecessor community. Measures how much the community’s membership changed compared to its previous snapshot. |
|
Fraction of members that left the community. |
|
Relative change in size from previous snapshot. |
Community Embedding in Network
Static community graph metrics analyze how communities are embedded within the network and can be accessed through metrics["static_community_graph"]. These metrics help understand the relationship between communities and the overall network structure.
Metric |
Description |
|---|---|
|
Fraction of existing external edges out of all possible. |
|
Fraction of total edge volume that points outside the community0 |
|
Ratio of internal edges to maximum possible internal edges. |
3. Evolving Community and Temporal Metrics
This section focuses on metrics that evaluate the evolution of communities over time.
Evolving Community Metrics
Evolving community metrics track communities across their entire lifespan and can be accessed through metrics["evolving_community"]. These metrics provide insights into the long-term behavior and stability of communities.
Metric |
Description |
|---|---|
|
Number of snapshots a community exists. |
|
First snapshot where the community appears. |
|
Initial size of the community. |
Snapshot Evolution Metrics
Snapshot metrics analyze the properties of each temporal snapshot and can be accessed through metrics["snapshot"]. These metrics provide insights into how the community structure evolves from one snapshot to the next.
Metric |
Description |
|---|---|
|
Number of communities at this snapshot. |
|
Ratio calculated as the sum of incoming and outgoing members divided by twice the size of the previous community. Measures the rate of change in community composition between two snapshots. |
Member Behavior Analysis
Member metrics analyze the behavior of individual members across snapshots and can be accessed through metrics["member"]. These metrics help understand how nodes participate in communities over time.
Metric |
Description |
|---|---|
|
Number of snapshots the member is active. |
|
Number of different communities the member belongs to. |
Community Transition Analysis
Flow metrics analyze the transitions between communities and can be accessed through metrics["flow"]. These metrics help understand how members move between communities over time.
Metric |
Description |
|---|---|
|
Ratio of members flowing from one community to another, excluding flows to the direct successor community. Measures only the relative migration between different evolving communities. |
4. Community Comparison Metrics
Metrics for comparing different community structures:
Metric |
Description |
|---|---|
|
Adjusted Rand Index (chance-corrected similarity) |
|
Normalized measure of similarity between partitions |
|
Variation of Information (distance metric) |
|
Jaccard similarity between partitions |
These metrics are available through the assess_partition_metrics and assess_transition_metrics functions:
from dyn.benchmark.assess import assess_partition_metrics
# Compare partitions
partition_metrics = assess_partition_metrics(groundtruth.tcommlist, detected_tcommlist)
# Compare transitions
transition_metrics = assess_transition_metrics(
groundtruth.tcommlist, detected_tcommlist, dt_min=1, dt_max=3
)