Understanding dynamic network formation and evolution
ANNEM features dynamic networks that evolve based on agent decision similarity and performance. This creates realistic market structures that adapt over time.
# Analyze network evolution
market <- create_annem_market(n_agents = 500)
results <- market$run_simulation(n_steps = 100)
network_metrics <- market$analyze_network_evolution()
# Plot network evolution
network_plots <- plot_network_evolution(network_metrics)
print(network_plots$evolution)
Key metrics for understanding network structure:
# Calculate comprehensive network metrics
metrics <- calculate_network_metrics(market$network)
# Key metrics
print(paste("Density:", round(metrics$density, 4)))
print(paste("Clustering:", round(metrics$global_clustering, 4)))
print(paste("Avg Path Length:", round(metrics$avg_path_length, 4)))
print(paste("Small-world Sigma:", round(metrics$small_world_sigma, 4)))
Create interactive network visualizations:
# Create interactive network visualization
agent_types <- results$agent_types
interactive_net <- create_interactive_network(
network = market$network,
agent_types = agent_types,
width = 800,
height = 600
)
# Save as HTML file
networkD3::saveNetwork(interactive_net, "my_network.html")
Control network evolution parameters:
# Custom network evolution
evolved_network <- evolve_network(
network = market$network,
agent_decisions = sample_decisions,
similarity_threshold = 0.9, # Higher threshold = more selective connections
evolution_rate = 0.05 # Higher rate = faster evolution
)