C++ Graph Layer

This section documents the C++ graph implementations.

class Graph

Lightweight wrapper over concrete graph implementations (CNP_Graph / DCNP_Graph).

class CNP_Graph

Graph implementation for the Critical Node Problem (CNP).

Represents a graph where the objective is to minimize connectivity after node removal.

add_node(self: CNP_Graph, arg0: SupportsInt | SupportsIndex) None
clone(self: CNP_Graph) CNP_Graph

Creates a deep copy of the graph.

Returns:

A new graph instance with the same structure.

Return type:

CNP_Graph

get_num_nodes(self: CNP_Graph) int
get_objective_value(self: CNP_Graph) int
get_reduced_graph_by_removed_nodes(self: CNP_Graph, arg0: Set[SupportsInt | SupportsIndex]) None
get_removed_nodes(self: CNP_Graph) set[int]
is_node_removed(self: CNP_Graph, arg0: SupportsInt | SupportsIndex) bool
remove_node(self: CNP_Graph, arg0: SupportsInt | SupportsIndex) None
property removed_nodes
set_node_age(self: CNP_Graph, arg0: SupportsInt | SupportsIndex, arg1: SupportsInt | SupportsIndex) None
update_graph_by_removed_nodes(self: CNP_Graph, arg0: Set[SupportsInt | SupportsIndex]) None
class DCNP_Graph

Graph implementation for the Distance-Based Critical Node Problem (DCNP).

Represents a graph where the objective is to maximize pairwise distance after node removal.

add_node(self: DCNP_Graph, arg0: SupportsInt | SupportsIndex) None
build_tree(self: DCNP_Graph) None
calculate_betweenness_centrality(self: DCNP_Graph) list[float]
calculate_k_hop_tree_size(self: DCNP_Graph) int
clone(self: DCNP_Graph) DCNP_Graph
find_best_node_to_add(self: DCNP_Graph) int
find_best_node_to_remove(self: DCNP_Graph) int
get_num_nodes(self: DCNP_Graph) int
get_objective_value(self: DCNP_Graph) int
get_random_feasible_graph(self: DCNP_Graph) DCNP_Graph
get_reduced_graph_by_removed_nodes(self: DCNP_Graph, arg0: Set[SupportsInt | SupportsIndex]) None
get_removed_nodes(self: DCNP_Graph) set[int]
is_node_removed(self: DCNP_Graph, arg0: SupportsInt | SupportsIndex) bool
remove_node(self: DCNP_Graph, arg0: SupportsInt | SupportsIndex) None
set_node_age(self: DCNP_Graph, arg0: SupportsInt | SupportsIndex, arg1: SupportsInt | SupportsIndex) None
update_graph_by_removed_nodes(self: DCNP_Graph, arg0: Set[SupportsInt | SupportsIndex]) None