12-Mar-2023 08:53:56 graph_adj_test(): MATLAB/Octave version 9.13.0.2126072 (R2022b) Update 3 Test graph_adj(). graph_adj_degree_test(): graph_adj_degree() computes the degree of the nodes; The graph adjacency matrix: 0 0 1 0 0 0 1 0 0 1 0 0 0 0 1 0 0 0 0 1 1 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 1 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 1 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 1 0 0 1 0 0 0 0 1 1 0 0 0 0 0 1 0 0 The node degrees: 3 2 3 2 1 2 2 2 2 3 graph_adj_distance_from_node_test(): graph_adj_distance_from_node() computes the distance from one node to all other nodes in a graph; The graph adjacency matrix: 0 0 1 0 0 0 1 0 0 1 0 0 0 0 1 0 0 0 0 1 1 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 1 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 1 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 1 0 0 1 0 0 0 0 1 1 0 0 0 0 0 1 0 0 Distance from node 7: 1 3 2 1 4 3 0 2 3 2 graph_adj_edge_count_test(): graph_adj_edge_count() counts edges in a graph. Adjacency matrix for bush example 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 1 0 0 0 1 1 1 0 1 1 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 Number of edges is 6 graph_adj_edge_select_test(): graph_adj_edge_select() selects an edge from a graph defined by an adjacency matrix. Adjacency matrix for bush example 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 1 0 0 0 1 1 1 0 1 1 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 An edge of this graph extends from node 1 to node 4 graph_adj_is_eulerian_test( ): graph_adj_is_eulerian() determines whether a graph is eulerian. Matrix A: 0 0 1 0 0 0 1 0 0 1 0 0 0 0 1 0 0 0 0 1 1 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 1 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 1 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 1 0 0 1 0 0 0 0 1 1 0 0 0 0 0 1 0 0 circuit_eulerian = false path_eulerian = false Matrix B: 0 0 1 0 1 0 1 0 0 1 0 0 0 0 1 0 0 0 0 1 1 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 1 1 0 0 1 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 1 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 1 0 0 1 0 0 0 0 1 1 0 0 0 0 0 1 0 0 circuit_eulerian = false path_eulerian = true Matrix C: 0 0 1 0 1 0 1 0 0 1 0 0 0 0 1 0 0 0 0 1 1 0 0 0 0 1 0 0 1 1 0 0 0 0 0 0 1 1 0 0 1 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 1 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 1 0 0 1 0 0 0 0 1 1 1 0 0 0 0 1 0 0 circuit_eulerian = true path_eulerian = true graph_adj_is_nodewise_connected_test( ): A graph is to be checked for nodewise connectedness. graph_adj_is_nodewise_connected_breadth() uses breadth-first search. graph_adj_is_nodewise_connected_depth() uses depth-first search. graph_adj_is_nodewise_connected_walks() counts the walks from node to node. Results for graph A (not connected!) breadth: false depth: false walks: false Results for graph B (connected!) breadth: true depth: true walks: true graph_adj_random_test(): graph_adj_random() returns a random graph, for which the probability of an edge between nodes I and J is PROB. Random graph #1 node_num = 100 edge_num = 1.236500e+03 edge_max = 4950 ratio = 0.249798 prob = 0.25 Random graph #2 node_num = 100 edge_num = 2509 edge_max = 4950 ratio = 0.506869 prob = 0.5 Random graph #3 node_num = 100 edge_num = 3.769500e+03 edge_max = 4950 ratio = 0.761515 prob = 0.75 graph_adj_transitive_closure_test(): graph_adj_transitive_closure() finds the transitive closure of a graph; Adjacency for G: 1 0 0 1 1 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 1 1 1 0 0 1 1 0 0 0 1 0 0 1 1 1 0 0 0 0 0 0 1 1 0 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 0 1 Adjacency for transitive closure: 1 0 0 1 1 1 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 1 1 1 0 0 1 1 1 0 0 1 0 0 1 1 1 0 0 1 0 0 1 1 1 0 0 0 0 1 0 0 0 1 1 0 0 1 0 0 0 1 1 graph_adj_walks_test( ): Count the walks from node I to node J of any length. Walks for graph A: 141 33 0 107 181 0 181 74 0 33 34 0 107 37 0 37 74 0 0 0 171 0 0 170 0 0 170 107 107 0 396 144 0 144 288 0 181 37 0 144 252 0 251 107 0 0 0 170 0 0 171 0 0 170 181 37 0 144 251 0 252 107 0 74 74 0 288 107 0 107 215 0 0 0 170 0 0 170 0 0 171 Walks for graph B: 156 34 10 121 266 58 208 87 68 34 35 10 121 48 58 39 87 10 10 10 24 58 31 54 17 48 23 121 121 58 509 218 276 169 387 58 266 48 31 218 518 129 388 170 160 58 58 54 276 129 184 89 218 54 208 39 17 169 388 89 300 130 106 87 87 48 387 170 218 130 301 48 68 10 23 58 160 54 106 48 78 matrix_is_adjacency_test( ): matrix_is_adjacency() requires that a matrix A be: * square * symmetric * zero on the diagonal * only have 0 or 1 as values. Matrix A: 0 0 1 0 0 1 1 1 0 0 0 1 matrix_is_adjacency(A) = false Matrix B: 0 0 1 1 0 1 1 1 0 matrix_is_adjacency(B) = false Matrix C: 1 0 1 0 1 1 1 1 1 matrix_is_adjacency(C) = false Matrix D: 0 1 2 1 0 1 2 1 0 matrix_is_adjacency(D) = false Matrix E: 0 1 1 1 0 1 1 1 0 matrix_is_adjacency(E) = true graph_adj_test(): Normal end of execution. 12-Mar-2023 08:53:56