Graphviz 13.0.0~dev.20241220.2304
|
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <assert.h>
#include <common/arith.h>
#include <limits.h>
#include <sparse/SparseMatrix.h>
#include <stddef.h>
#include <stdbool.h>
#include <util/alloc.h>
Go to the source code of this file.
|
static |
Definition at line 22 of file SparseMatrix.c.
References MATRIX_TYPE_COMPLEX, MATRIX_TYPE_INTEGER, MATRIX_TYPE_PATTERN, MATRIX_TYPE_REAL, MATRIX_TYPE_UNKNOWN, and type.
Referenced by SparseMatrix_new().
SparseMatrix SparseMatrix_add | ( | SparseMatrix | A, |
SparseMatrix | B | ||
) |
Definition at line 700 of file SparseMatrix.c.
References A, B, C, FORMAT_CSR, free(), gv_calloc(), MATRIX_TYPE_COMPLEX, MATRIX_TYPE_INTEGER, MATRIX_TYPE_PATTERN, MATRIX_TYPE_REAL, MATRIX_TYPE_UNKNOWN, NULL, RETURN, and SparseMatrix_new().
Referenced by SparseMatrix_symmetrize(), StressMajorizationSmoother_smooth(), and TriangleSmoother_new().
|
static |
Definition at line 296 of file SparseMatrix.c.
References A, format, SparseMatrix_struct::format, FORMAT_COORD, FORMAT_CSR, gv_calloc(), and NULL.
Referenced by SparseMatrix_general_new(), and SparseMatrix_new().
SparseMatrix SparseMatrix_apply_fun | ( | SparseMatrix | A, |
double(*)(double x) | fun | ||
) |
Definition at line 1543 of file SparseMatrix.c.
References A, FORMAT_CSR, and MATRIX_TYPE_REAL.
Referenced by modularity_ink_bundling().
SparseMatrix SparseMatrix_coordinate_form_add_entry | ( | SparseMatrix | A, |
int | irn, | ||
int | jcn, | ||
const void * | val | ||
) |
Definition at line 1273 of file SparseMatrix.c.
References A, FORMAT_COORD, and SparseMatrix_realloc().
Referenced by Agglomerative_Ink_Bundling_establish(), call_tri(), call_tri2(), check_compatibility(), conn_comp(), country_graph_coloring(), edge_distinct_coloring(), get_country_graph(), get_poly_lines(), get_polygon_solids(), matrix_add_entry(), modularity_ink_bundling(), Multilevel_Modularity_Clustering_establish(), and Multilevel_MQ_Clustering_establish().
SparseMatrix SparseMatrix_copy | ( | SparseMatrix | A | ) |
Definition at line 1566 of file SparseMatrix.c.
References A, B, and SparseMatrix_general_new().
Referenced by ideal_distance_matrix(), modularity_clustering(), modularity_ink_bundling(), mq_clustering(), SparseMatrix_symmetrize(), StressMajorizationSmoother_smooth(), and TriangleSmoother_new().
void SparseMatrix_decompose_to_supervariables | ( | SparseMatrix | A, |
int * | ncluster, | ||
int ** | cluster, | ||
int ** | clusterp | ||
) |
Definition at line 1674 of file SparseMatrix.c.
References A, free(), gv_calloc(), and NULL.
Referenced by maximal_independent_edge_set_heavest_edge_pernode_supernodes_first().
void SparseMatrix_delete | ( | SparseMatrix | A | ) |
Definition at line 378 of file SparseMatrix.c.
Referenced by Agglomerative_Ink_Bundling_delete(), Agglomerative_Ink_Bundling_establish(), agglomerative_ink_bundling_internal(), attached_clustering(), bundle(), call_tri(), call_tri2(), check_compatibility(), conn_comp(), country_graph_coloring(), edge_bundling(), edge_distinct_coloring(), get_country_graph(), get_poly_lines(), get_polygon_solids(), get_tri(), improve_contiguity(), main(), make_map_internal(), makeMap(), map_palette_optimal_coloring(), modularity_clustering(), modularity_ink_bundling(), mq_clustering(), Multilevel_coarsen(), Multilevel_delete(), Multilevel_Modularity_Clustering_delete(), Multilevel_Modularity_Clustering_establish(), Multilevel_MQ_Clustering_delete(), Multilevel_MQ_Clustering_establish(), multilevel_spring_electrical_embedding(), node_distinct_coloring(), sfdpLayout(), SparseMatrix_distance_matrix(), SparseMatrix_get_real_adjacency_matrix_symmetrized(), SparseMatrix_import_dot(), SparseMatrix_is_symmetric(), SparseMatrix_multiply(), SparseMatrix_sort(), SparseMatrix_symmetrize(), SparseMatrix_to_square_matrix(), SparseMatrix_transpose(), SparseMatrix_weakly_connected_components(), spring_electrical_embedding(), spring_electrical_embedding_fast(), spring_electrical_embedding_slow(), spring_electrical_spring_embedding(), SpringSmoother_delete(), SpringSmoother_new(), stress_model(), StressMajorizationSmoother2_new(), StressMajorizationSmoother_delete(), StressMajorizationSmoother_smooth(), and TriangleSmoother_new().
void SparseMatrix_distance_matrix | ( | SparseMatrix | D0, |
double ** | dist0 | ||
) |
Definition at line 2029 of file SparseMatrix.c.
References D, free(), gv_calloc(), SparseMatrix_struct::m, NULL, SparseMatrix_delete(), SparseMatrix_is_symmetric(), SparseMatrix_level_sets(), and SparseMatrix_symmetrize().
Referenced by map_palette_optimal_coloring().
SparseMatrix SparseMatrix_divide_row_by_degree | ( | SparseMatrix | A | ) |
Definition at line 1461 of file SparseMatrix.c.
References A, SparseMatrix_struct::ia, MATRIX_TYPE_COMPLEX, MATRIX_TYPE_INTEGER, MATRIX_TYPE_PATTERN, MATRIX_TYPE_REAL, MATRIX_TYPE_UNKNOWN, and NULL.
Referenced by Multilevel_coarsen_internal().
void SparseMatrix_export | ( | FILE * | f, |
SparseMatrix | A | ||
) |
Definition at line 517 of file SparseMatrix.c.
References A, FORMAT_COORD, FORMAT_CSR, SparseMatrix_export_coord(), and SparseMatrix_export_csr().
Referenced by map_palette_optimal_coloring().
|
static |
Definition at line 455 of file SparseMatrix.c.
References A, MATRIX_TYPE_COMPLEX, MATRIX_TYPE_INTEGER, MATRIX_TYPE_PATTERN, MATRIX_TYPE_REAL, and MATRIX_TYPE_UNKNOWN.
Referenced by SparseMatrix_export().
|
static |
Definition at line 386 of file SparseMatrix.c.
References A, MATRIX_TYPE_COMPLEX, MATRIX_TYPE_INTEGER, MATRIX_TYPE_PATTERN, MATRIX_TYPE_REAL, and MATRIX_TYPE_UNKNOWN.
Referenced by SparseMatrix_export().
SparseMatrix SparseMatrix_from_coordinate_arrays | ( | int | nz, |
int | m, | ||
int | n, | ||
int * | irn, | ||
int * | jcn, | ||
void * | val0, | ||
int | type, | ||
size_t | sz | ||
) |
Definition at line 691 of file SparseMatrix.c.
References SparseMatrix_from_coordinate_arrays_internal(), SUM_REPEATED_ALL, and type.
Referenced by attached_clustering(), get_edge_label_matrix(), Import_coord_clusters_from_dot(), makeMatrix(), Multilevel_coarsen_internal(), nearest_neighbor_graph(), shorting_edge_label_nodes(), SparseMatrix_from_coordinate_format(), SparseMatrix_get_augmented(), SparseMatrix_get_submatrix(), SparseMatrix_import_dot(), and SparseMatrix_import_matrix_market().
|
static |
Definition at line 562 of file SparseMatrix.c.
References A, FORMAT_CSR, MATRIX_TYPE_COMPLEX, MATRIX_TYPE_INTEGER, MATRIX_TYPE_PATTERN, MATRIX_TYPE_REAL, MATRIX_TYPE_UNKNOWN, NULL, SparseMatrix_general_new(), SparseMatrix_sum_repeat_entries(), and type.
Referenced by SparseMatrix_from_coordinate_arrays(), and SparseMatrix_from_coordinate_arrays_not_compacted().
SparseMatrix SparseMatrix_from_coordinate_arrays_not_compacted | ( | int | nz, |
int | m, | ||
int | n, | ||
int * | irn, | ||
int * | jcn, | ||
void * | val0, | ||
int | type, | ||
size_t | sz | ||
) |
Definition at line 696 of file SparseMatrix.c.
References SparseMatrix_from_coordinate_arrays_internal(), SUM_REPEATED_NONE, and type.
Referenced by SparseMatrix_from_coordinate_format_not_compacted().
SparseMatrix SparseMatrix_from_coordinate_format | ( | SparseMatrix | A | ) |
Definition at line 532 of file SparseMatrix.c.
References A, SparseMatrix_struct::a, FORMAT_COORD, NULL, and SparseMatrix_from_coordinate_arrays().
Referenced by Agglomerative_Ink_Bundling_establish(), call_tri(), call_tri2(), check_compatibility(), conn_comp(), country_graph_coloring(), edge_distinct_coloring(), get_country_graph(), modularity_ink_bundling(), Multilevel_Modularity_Clustering_establish(), and Multilevel_MQ_Clustering_establish().
SparseMatrix SparseMatrix_from_coordinate_format_not_compacted | ( | SparseMatrix | A | ) |
Definition at line 547 of file SparseMatrix.c.
References A, SparseMatrix_struct::a, FORMAT_COORD, NULL, and SparseMatrix_from_coordinate_arrays_not_compacted().
Referenced by get_poly_lines(), get_polygon_solids(), and get_tri().
SparseMatrix SparseMatrix_from_dense | ( | int | m, |
int | n, | ||
double * | x | ||
) |
Definition at line 2006 of file SparseMatrix.c.
References A, FORMAT_CSR, MATRIX_TYPE_REAL, and SparseMatrix_new().
Referenced by map_palette_optimal_coloring().
SparseMatrix SparseMatrix_general_new | ( | int | m, |
int | n, | ||
int | nz, | ||
int | type, | ||
size_t | sz, | ||
int | format | ||
) |
Definition at line 364 of file SparseMatrix.c.
References A, format, SparseMatrix_alloc(), SparseMatrix_init(), and type.
Referenced by SparseMatrix_copy(), and SparseMatrix_from_coordinate_arrays_internal().
SparseMatrix SparseMatrix_get_augmented | ( | SparseMatrix | A | ) |
Definition at line 1772 of file SparseMatrix.c.
References A, B, free(), gv_calloc(), NULL, SparseMatrix_from_coordinate_arrays(), and type.
Referenced by SparseMatrix_to_square_matrix().
SparseMatrix SparseMatrix_get_real_adjacency_matrix_symmetrized | ( | SparseMatrix | A | ) |
Definition at line 1510 of file SparseMatrix.c.
References A, B, FORMAT_CSR, gv_calloc(), MATRIX_TYPE_PATTERN, MATRIX_TYPE_REAL, NULL, SparseMatrix_struct::nz, SparseMatrix_delete(), SparseMatrix_new(), SparseMatrix_remove_diagonal(), and SparseMatrix_symmetrize().
Referenced by Agglomerative_Ink_Bundling_new(), improve_contiguity(), makeMap(), Multilevel_Modularity_Clustering_new(), Multilevel_MQ_Clustering_new(), Multilevel_new(), multilevel_spring_electrical_embedding(), and stress_model().
SparseMatrix SparseMatrix_get_submatrix | ( | SparseMatrix | A, |
int | nrow, | ||
int | ncol, | ||
int * | rindices, | ||
int * | cindices | ||
) |
Definition at line 1837 of file SparseMatrix.c.
References A, B, free(), gv_calloc(), SparseMatrix_struct::ia, MATRIX_TYPE_COMPLEX, MATRIX_TYPE_INTEGER, MATRIX_TYPE_PATTERN, MATRIX_TYPE_REAL, MATRIX_TYPE_UNKNOWN, NULL, and SparseMatrix_from_coordinate_arrays().
Referenced by node_distinct_coloring().
bool SparseMatrix_has_diagonal | ( | SparseMatrix | A | ) |
Definition at line 1582 of file SparseMatrix.c.
References A.
Referenced by beautify_leaves().
|
static |
Definition at line 274 of file SparseMatrix.c.
References A, format, FORMAT_COORD, FORMAT_CSR, gv_alloc(), gv_calloc(), NULL, and type.
Referenced by SparseMatrix_general_new(), and SparseMatrix_new().
bool SparseMatrix_is_symmetric | ( | SparseMatrix | A, |
bool | test_pattern_symmetry_only | ||
) |
Definition at line 158 of file SparseMatrix.c.
References A, B, FORMAT_CSR, free(), gv_calloc(), MATRIX_TYPE_COMPLEX, MATRIX_TYPE_INTEGER, MATRIX_TYPE_PATTERN, MATRIX_TYPE_REAL, MATRIX_TYPE_UNKNOWN, RETURN, SparseMatrix_delete(), SparseMatrix_transpose(), SYMMETRY_EPSILON, and type.
Referenced by Agglomerative_Ink_Bundling_init(), Agglomerative_Ink_Bundling_new(), average_edge_length(), get_mq(), ideal_distance_matrix(), improve_antibandwidth_by_swapping(), maximal_independent_edge_set_heavest_edge_pernode_supernodes_first(), Multilevel_Modularity_Clustering_init(), Multilevel_Modularity_Clustering_new(), Multilevel_MQ_Clustering_init(), Multilevel_MQ_Clustering_new(), Multilevel_new(), multilevel_spring_electrical_embedding(), SparseMatrix_distance_matrix(), SparseMatrix_symmetrize(), SparseMatrix_to_square_matrix(), SparseMatrix_weakly_connected_components(), SparseStressMajorizationSmoother_new(), SpringSmoother_new(), stress_model(), StressMajorizationSmoother2_new(), and TriangleSmoother_new().
|
static |
Definition at line 1594 of file SparseMatrix.c.
References A, gv_calloc(), and UNMASKED.
Referenced by SparseMatrix_distance_matrix(), and SparseMatrix_weakly_connected_components().
SparseMatrix SparseMatrix_make_undirected | ( | SparseMatrix | A | ) |
Definition at line 56 of file SparseMatrix.c.
References A, B, SparseMatrix_remove_upper(), and SparseMatrix_symmetrize().
Referenced by main().
SparseMatrix SparseMatrix_multiply | ( | SparseMatrix | A, |
SparseMatrix | B | ||
) |
Definition at line 919 of file SparseMatrix.c.
References A, B, C, FORMAT_CSR, free(), MATRIX_TYPE_COMPLEX, MATRIX_TYPE_INTEGER, MATRIX_TYPE_PATTERN, MATRIX_TYPE_REAL, MATRIX_TYPE_UNKNOWN, NULL, RETURN, SparseMatrix_delete(), SparseMatrix_new(), and type.
Referenced by Agglomerative_Ink_Bundling_establish(), Multilevel_coarsen(), Multilevel_Modularity_Clustering_establish(), and Multilevel_MQ_Clustering_establish().
SparseMatrix SparseMatrix_multiply3 | ( | SparseMatrix | A, |
SparseMatrix | B, | ||
SparseMatrix | C | ||
) |
Definition at line 1082 of file SparseMatrix.c.
References A, B, C, D, FORMAT_CSR, free(), id, MATRIX_TYPE_REAL, NULL, RETURN, SparseMatrix_new(), and type.
Referenced by Multilevel_coarsen_internal().
void SparseMatrix_multiply_dense | ( | SparseMatrix | A, |
const double * | v, | ||
double * | res, | ||
int | dim | ||
) |
Definition at line 832 of file SparseMatrix.c.
References A, dim, FORMAT_CSR, and MATRIX_TYPE_REAL.
Referenced by prolongate(), and StressMajorizationSmoother_smooth().
void SparseMatrix_multiply_vector | ( | SparseMatrix | A, |
double * | v, | ||
double ** | res | ||
) |
Definition at line 855 of file SparseMatrix.c.
References A, FORMAT_CSR, gv_calloc(), MATRIX_TYPE_INTEGER, MATRIX_TYPE_REAL, and NULL.
Referenced by conjugate_gradient(), hierachical_modularity_clustering(), hierachical_mq_clustering(), and power_method().
SparseMatrix SparseMatrix_new | ( | int | m, |
int | n, | ||
int | nz, | ||
int | type, | ||
int | format | ||
) |
Definition at line 351 of file SparseMatrix.c.
References A, format, size_of_matrix_type(), SparseMatrix_alloc(), SparseMatrix_init(), and type.
Referenced by Agglomerative_Ink_Bundling_establish(), call_tri(), call_tri2(), check_compatibility(), conn_comp(), country_graph_coloring(), edge_distinct_coloring(), get_country_graph(), get_poly_lines(), get_polygon_solids(), get_tri(), modularity_ink_bundling(), Multilevel_Modularity_Clustering_establish(), Multilevel_MQ_Clustering_establish(), SparseMatrix_add(), SparseMatrix_from_dense(), SparseMatrix_get_real_adjacency_matrix_symmetrized(), SparseMatrix_import_dot(), SparseMatrix_multiply(), SparseMatrix_multiply3(), SparseMatrix_transpose(), SparseStressMajorizationSmoother_new(), SpringSmoother_new(), and StressMajorizationSmoother2_new().
|
static |
Definition at line 319 of file SparseMatrix.c.
References A, format, SparseMatrix_struct::format, FORMAT_COORD, FORMAT_CSR, gv_calloc(), and gv_recalloc().
Referenced by SparseMatrix_coordinate_form_add_entry().
SparseMatrix SparseMatrix_remove_diagonal | ( | SparseMatrix | A | ) |
Definition at line 1297 of file SparseMatrix.c.
References A, SparseMatrix_struct::ia, MATRIX_TYPE_COMPLEX, MATRIX_TYPE_INTEGER, MATRIX_TYPE_PATTERN, MATRIX_TYPE_REAL, MATRIX_TYPE_UNKNOWN, and NULL.
Referenced by map_palette_optimal_coloring(), modularity_clustering(), mq_clustering(), Multilevel_coarsen_internal(), multilevel_spring_electrical_embedding(), SparseMatrix_get_real_adjacency_matrix_symmetrized(), and stress_model().
SparseMatrix SparseMatrix_remove_upper | ( | SparseMatrix | A | ) |
Definition at line 1377 of file SparseMatrix.c.
References A, SparseMatrix_struct::ia, MATRIX_TYPE_COMPLEX, MATRIX_TYPE_INTEGER, MATRIX_TYPE_PATTERN, MATRIX_TYPE_REAL, MATRIX_TYPE_UNKNOWN, and NULL.
Referenced by SparseMatrix_make_undirected().
SparseMatrix SparseMatrix_set_entries_to_real_one | ( | SparseMatrix | A | ) |
Definition at line 1992 of file SparseMatrix.c.
References A, free(), gv_calloc(), and MATRIX_TYPE_REAL.
Referenced by modularity_clustering(), and mq_clustering().
SparseMatrix SparseMatrix_sort | ( | SparseMatrix | A | ) |
Definition at line 48 of file SparseMatrix.c.
References A, B, SparseMatrix_delete(), and SparseMatrix_transpose().
Referenced by get_tri().
SparseMatrix SparseMatrix_sum_repeat_entries | ( | SparseMatrix | A | ) |
Definition at line 1172 of file SparseMatrix.c.
References A, free(), gv_calloc(), SparseMatrix_struct::ia, MATRIX_TYPE_COMPLEX, MATRIX_TYPE_INTEGER, MATRIX_TYPE_PATTERN, MATRIX_TYPE_REAL, NULL, and type.
Referenced by SparseMatrix_from_coordinate_arrays_internal().
SparseMatrix SparseMatrix_symmetrize | ( | SparseMatrix | A, |
bool | pattern_symmetric_only | ||
) |
Definition at line 145 of file SparseMatrix.c.
References A, B, NULL, SparseMatrix_add(), SparseMatrix_copy(), SparseMatrix_delete(), SparseMatrix_is_symmetric(), and SparseMatrix_transpose().
Referenced by bundle(), call_tri(), call_tri2(), country_graph_coloring(), edge_bundling(), map_palette_optimal_coloring(), modularity_clustering(), mq_clustering(), node_distinct_coloring(), SparseMatrix_distance_matrix(), SparseMatrix_get_real_adjacency_matrix_symmetrized(), SparseMatrix_make_undirected(), SparseMatrix_weakly_connected_components(), spring_electrical_embedding(), spring_electrical_embedding_fast(), spring_electrical_embedding_slow(), spring_electrical_spring_embedding(), and stress_model().
SparseMatrix SparseMatrix_to_square_matrix | ( | SparseMatrix | A, |
int | bipartite_options | ||
) |
Definition at line 1815 of file SparseMatrix.c.
References A, B, BIPARTITE_ALWAYS, BIPARTITE_PATTERN_UNSYM, BIPARTITE_RECT, BIPARTITE_UNSYM, SparseMatrix_delete(), SparseMatrix_get_augmented(), and SparseMatrix_is_symmetric().
Referenced by main().
SparseMatrix SparseMatrix_transpose | ( | SparseMatrix | A | ) |
Definition at line 63 of file SparseMatrix.c.
References A, B, format, FORMAT_CSR, MATRIX_TYPE_COMPLEX, MATRIX_TYPE_INTEGER, MATRIX_TYPE_PATTERN, MATRIX_TYPE_REAL, MATRIX_TYPE_UNKNOWN, NULL, SparseMatrix_delete(), SparseMatrix_new(), and type.
Referenced by Agglomerative_Ink_Bundling_establish(), improve_contiguity(), Multilevel_coarsen_internal(), Multilevel_Modularity_Clustering_establish(), Multilevel_MQ_Clustering_establish(), SparseMatrix_is_symmetric(), SparseMatrix_sort(), and SparseMatrix_symmetrize().
int * SparseMatrix_weakly_connected_components | ( | SparseMatrix | A0, |
int * | ncomp, | ||
int ** | comps | ||
) |
Definition at line 1643 of file SparseMatrix.c.
References A, free(), gv_calloc(), NULL, SparseMatrix_delete(), SparseMatrix_is_symmetric(), SparseMatrix_level_sets(), and SparseMatrix_symmetrize().
Referenced by conn_comp(), and node_distinct_coloring().