|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Network Utilities: Generation, Visualization, Serialization. More...
#include <iostream>#include <string>#include <vector>#include <iomanip>#include <fstream>#include <sstream>#include <chrono>#include <limits>#include <tpl_net.H>#include <tpl_maxflow.H>#include <net_utils.H>Go to the source code of this file.
Typedefs | |
| using | FlowType = double |
| using | Net = Net_Graph< Net_Node< string >, Net_Arc< Empty_Class, FlowType > > |
| using | Node = Net::Node |
Functions | |
| static size_t | density_to_num_arcs (size_t n, double density) |
| static void | add_super_source_and_sink (Net &net) |
| void | print_network_stats (Net &net, const string &title) |
| Print network statistics. | |
| void | demo_random_networks () |
| Demo 1: Random Network Generation. | |
| void | demo_grid_networks () |
| Demo 2: Grid Network Generation. | |
| void | demo_layered_networks () |
| Demo 3: Layered Network Generation. | |
| void | demo_dot_export () |
| Demo 4: DOT Export for Visualization. | |
| void | demo_json_export () |
| Demo 5: JSON Serialization. | |
| void | demo_benchmarking () |
| Demo 6: Benchmarking. | |
| int | main () |
Network Utilities: Generation, Visualization, Serialization.
This example demonstrates utility functions for working with flow networks in Aleph-w. These utilities help with network generation, visualization, serialization, and benchmarking, making it easier to work with flow networks in practice.
Working with flow networks often requires:
Definition in file net_utils_example.cc.
| using FlowType = double |
Definition at line 118 of file net_utils_example.cc.
Definition at line 119 of file net_utils_example.cc.
Definition at line 120 of file net_utils_example.cc.
|
static |
Definition at line 134 of file net_utils_example.cc.
References GraphCommon< GT, Node, Arc >::get_arc_it(), GraphCommon< GT, Node, Arc >::get_node_it(), Aleph::Net_Graph< NodeT, ArcT >::insert_arc(), Aleph::Net_Graph< NodeT, ArcT >::insert_node(), Aleph::maps(), and nodes.
Referenced by demo_benchmarking(), demo_json_export(), and demo_random_networks().
| void demo_benchmarking | ( | ) |
Demo 6: Benchmarking.
Definition at line 372 of file net_utils_example.cc.
References add_super_source_and_sink(), density_to_num_arcs(), Aleph::dinic_maximum_flow(), Aleph::ford_fulkerson_maximum_flow(), GraphCommon< GT, Node, Arc >::get_num_arcs(), GraphCommon< GT, Node, Arc >::get_num_nodes(), and Aleph::maps().
Referenced by main().
| void demo_dot_export | ( | ) |
Demo 4: DOT Export for Visualization.
Definition at line 290 of file net_utils_example.cc.
References Aleph::dinic_maximum_flow(), Aleph::Net_Graph< NodeT, ArcT >::insert_arc(), Aleph::Net_Graph< NodeT, ArcT >::insert_node(), Aleph::maps(), and Aleph::network_to_dot_string().
Referenced by main().
| void demo_grid_networks | ( | ) |
Demo 2: Grid Network Generation.
Definition at line 227 of file net_utils_example.cc.
References Aleph::dinic_maximum_flow(), Aleph::maps(), print_network_stats(), and Aleph::size().
Referenced by main().
| void demo_json_export | ( | ) |
Demo 5: JSON Serialization.
Definition at line 343 of file net_utils_example.cc.
References add_super_source_and_sink(), density_to_num_arcs(), Aleph::dinic_maximum_flow(), Aleph::maps(), and Aleph::network_to_json_string().
Referenced by main().
| void demo_layered_networks | ( | ) |
Demo 3: Layered Network Generation.
Definition at line 258 of file net_utils_example.cc.
References Aleph::dinic_maximum_flow(), l, Aleph::maps(), and print_network_stats().
Referenced by main().
| void demo_random_networks | ( | ) |
Demo 1: Random Network Generation.
Definition at line 185 of file net_utils_example.cc.
References add_super_source_and_sink(), density_to_num_arcs(), Aleph::dinic_maximum_flow(), Aleph::maps(), and print_network_stats().
Referenced by main().
|
static |
Definition at line 122 of file net_utils_example.cc.
References Aleph::maps().
Referenced by demo_benchmarking(), demo_json_export(), and demo_random_networks().
| int main | ( | ) |
Definition at line 445 of file net_utils_example.cc.
References demo_benchmarking(), demo_dot_export(), demo_grid_networks(), demo_json_export(), demo_layered_networks(), demo_random_networks(), and Aleph::maps().
| void print_network_stats | ( | Net & | net, |
| const string & | title | ||
| ) |
Print network statistics.
Definition at line 160 of file net_utils_example.cc.
References GraphCommon< GT, Node, Arc >::get_arc_it(), GraphCommon< GT, Node, Arc >::get_num_arcs(), GraphCommon< GT, Node, Arc >::get_num_nodes(), and Aleph::maps().
Referenced by demo_grid_networks(), demo_layered_networks(), and demo_random_networks().