PaStiX Handbook  6.3.2
graph.h
Go to the documentation of this file.
1 /**
2  *
3  * @file graph.h
4  *
5  * PaStiX graph structure routines
6  *
7  * @copyright 2004-2023 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria,
8  * Univ. Bordeaux. All rights reserved.
9  *
10  * @version 6.3.2
11  * @author Xavier Lacoste
12  * @author Pierre Ramet
13  * @author Mathieu Faverge
14  * @author Tony Delarue
15  * @date 2023-07-21
16  *
17  *
18  * @addtogroup pastix_graph
19  * @{
20  * @brief Functions to generate and manipulate the graph structure.
21  *
22  * This module provides the set of function to prepare the graph structure
23  * associated to a given sparse matrix.
24  * It is possible to symmetrize a graph, to extract a subgraph and to apply a
25  * new permutation.
26  *
27  **/
28 #ifndef _graph_h_
29 #define _graph_h_
30 
31 /**
32  * @name Graph basic subroutines
33  * @{
34  */
35 int graphPrepare( pastix_data_t *pastix_data,
36  const spmatrix_t *spm,
37  pastix_graph_t **graph );
38 void graphBase ( pastix_graph_t *graph,
39  pastix_int_t baseval );
40 void graphExit ( pastix_graph_t *graph );
41 
42 void graphInitEmpty( pastix_graph_t *graph,
43  PASTIX_Comm comm );
44 /**
45  * @}
46  * @name Graph IO subroutines
47  * @{
48  */
49 void graphLoad( const pastix_data_t *pastix_data,
50  pastix_graph_t *graph );
51 void graphSave( pastix_data_t *pastix_data,
52  const pastix_graph_t *graph );
53 
54 /**
55  * @}
56  * @name Graph manipulation subroutines
57  * @{
58  */
59 int graphCopy ( pastix_graph_t *graphdst,
60  const pastix_graph_t *graphsrc );
61 int graphSpm2Graph ( pastix_graph_t *graph,
62  const spmatrix_t *spm );
63 void graphSort ( pastix_graph_t *graph );
64 void graphNoDiag ( pastix_graph_t *graph );
65 int graphSymmetrize( pastix_graph_t *graph );
66 
67 int graphUpdateComputedFields( pastix_graph_t *graph );
68 
69 int graphScatterInPlace( pastix_graph_t *graph,
70  PASTIX_Comm comm );
71 int graphGatherInPlace ( pastix_graph_t *graph );
72 
73 int graphIsolate ( const pastix_graph_t *ingraph,
74  pastix_graph_t *outgraph,
75  pastix_int_t isolate_n,
76  pastix_int_t *isolate_list,
77  pastix_int_t **new_perm,
78  pastix_int_t **new_invp );
79 
80 int graphIsolateRange( const pastix_graph_t *graphIn,
81  const pastix_order_t *order,
82  pastix_graph_t *graphOut,
83  pastix_int_t fnode,
84  pastix_int_t lnode,
85  pastix_int_t distance );
86 void graphComputeProjection( const pastix_graph_t *graph,
87  const int *vertlvl,
88  pastix_order_t *order,
89  const pastix_graph_t *subgraph,
90  pastix_order_t *suborder,
91  pastix_int_t fnode,
92  pastix_int_t lnode,
93  pastix_int_t sn_level,
94  pastix_int_t distance,
95  pastix_int_t maxdepth,
96  pastix_int_t maxwidth,
97  pastix_int_t *depthsze );
98 
99 pastix_int_t graphIsolateConnectedComponents( const pastix_graph_t *graph,
100  pastix_int_t *comp_vtx,
101  pastix_int_t *comp_sze );
102 
103 int graphComputeKway( const pastix_graph_t *graph,
104  pastix_order_t *order,
105  pastix_int_t *peritab,
106  pastix_int_t *comp_nbr,
107  pastix_int_t *comp_sze,
108  pastix_int_t *comp_vtx,
109  pastix_int_t comp_id,
110  pastix_int_t nbpart );
111 
112 pastix_int_t *graphGetWeights( const pastix_graph_t *graph );
113 /**
114  * @}
115  */
116 
117 #endif /* _graph_h_ */
118 
119 /**
120  * @}
121  */
BEGIN_C_DECLS typedef int pastix_int_t
Definition: datatypes.h:51
int graphUpdateComputedFields(pastix_graph_t *graph)
Update dofs, nnz, nnzexp, gnnz, n, nexp, gN of a given graph.
Definition: graph.c:338
int graphIsolate(const pastix_graph_t *ingraph, pastix_graph_t *outgraph, pastix_int_t isolate_n, pastix_int_t *isolate_list, pastix_int_t **new_perm, pastix_int_t **new_invp)
Isolate a subset of vertices from a given graph.
void graphExit(pastix_graph_t *graph)
Free the content of the graph structure.
Definition: graph.c:73
int graphScatterInPlace(pastix_graph_t *graph, PASTIX_Comm comm)
This routine scatter a graph from node root to the other nodes.
Definition: graph.c:194
pastix_int_t graphIsolateConnectedComponents(const pastix_graph_t *graph, pastix_int_t *comp_vtx, pastix_int_t *comp_sze)
Isolate the connected components from the original graph.
int graphCopy(pastix_graph_t *graphdst, const pastix_graph_t *graphsrc)
This routine copy a given ordering in a new one.
Definition: graph.c:151
void graphLoad(const pastix_data_t *pastix_data, pastix_graph_t *graph)
Load a graph from a file.
Definition: graph_io.c:45
int graphSpm2Graph(pastix_graph_t *graph, const spmatrix_t *spm)
This routine build a graph thanks to an spm;.
Definition: graph.c:379
void graphComputeProjection(const pastix_graph_t *graph, const int *vertlvl, pastix_order_t *order, const pastix_graph_t *subgraph, pastix_order_t *suborder, pastix_int_t fnode, pastix_int_t lnode, pastix_int_t sn_level, pastix_int_t distance, pastix_int_t maxdepth, pastix_int_t maxwidth, pastix_int_t *depthsze)
TODO.
int graphSymmetrize(pastix_graph_t *graph)
Symmetrize a given graph.
Definition: graph.c:307
int graphIsolateRange(const pastix_graph_t *graphIn, const pastix_order_t *order, pastix_graph_t *graphOut, pastix_int_t fnode, pastix_int_t lnode, pastix_int_t distance)
Isolate the subgraph associated to a range of unknowns in the permuted graph.
void graphNoDiag(pastix_graph_t *graph)
This routine removes the diagonal edges from a centralized graph.
Definition: graph_prepare.c:37
int graphPrepare(pastix_data_t *pastix_data, const spmatrix_t *spm, pastix_graph_t **graph)
This routine initializes the graph.
void graphInitEmpty(pastix_graph_t *graph, PASTIX_Comm comm)
Initialize an empty graph.
Definition: graph.c:48
int graphComputeKway(const pastix_graph_t *graph, pastix_order_t *order, pastix_int_t *peritab, pastix_int_t *comp_nbr, pastix_int_t *comp_sze, pastix_int_t *comp_vtx, pastix_int_t comp_id, pastix_int_t nbpart)
Compute the K-way partition of a given set of unknowns.
int graphGatherInPlace(pastix_graph_t *graph)
This routine gather a distributed graph on each node in place.
Definition: graph.c:239
void graphSave(pastix_data_t *pastix_data, const pastix_graph_t *graph)
Save a graph to file.
Definition: graph_io.c:102
void graphBase(pastix_graph_t *graph, pastix_int_t baseval)
Rebase the graph to the given value.
Definition: graph.c:102
pastix_int_t * graphGetWeights(const pastix_graph_t *graph)
Build the vertex weight array out of the dof array.
Definition: graph.c:433
void graphSort(pastix_graph_t *graph)
This routine sortes the subarray of edges of each vertex.
Definition: graph.c:282
Order structure.
Definition: order.h:47
Main PaStiX data structure.
Definition: pastixdata.h:67