PaStiX Handbook  6.2.1
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-2021 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria,
8  * Univ. Bordeaux. All rights reserved.
9  *
10  * @version 6.2.0
11  * @author Xavier Lacoste
12  * @author Pierre Ramet
13  * @author Mathieu Faverge
14  * @author Tony Delarue
15  * @date 2021-01-25
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 graphApplyPerm ( const pastix_graph_t *graphA,
81  const pastix_int_t *perm,
82  pastix_graph_t *graphPA );
83 
84 int graphIsolateRange( const pastix_graph_t *graphIn,
85  const pastix_order_t *order,
86  pastix_graph_t *graphOut,
87  pastix_int_t fnode,
88  pastix_int_t lnode,
89  pastix_int_t distance );
90 void graphComputeProjection( const pastix_graph_t *graph,
91  const int *vertlvl,
92  pastix_order_t *order,
93  const pastix_graph_t *subgraph,
94  pastix_order_t *suborder,
95  pastix_int_t fnode,
96  pastix_int_t lnode,
97  pastix_int_t sn_level,
98  pastix_int_t distance,
99  pastix_int_t maxdepth,
100  pastix_int_t maxwidth,
101  pastix_int_t *depthsze );
102 
103 pastix_int_t graphIsolateConnectedComponents( const pastix_graph_t *graph,
104  pastix_int_t *comp_vtx,
105  pastix_int_t *comp_sze );
106 
107 int graphComputeKway( const pastix_graph_t *graph,
108  pastix_order_t *order,
109  pastix_int_t *peritab,
110  pastix_int_t *comp_nbr,
111  pastix_int_t *comp_sze,
112  pastix_int_t *comp_vtx,
113  pastix_int_t comp_id,
114  pastix_int_t nbpart );
115 
116 pastix_int_t *graphGetWeights( const pastix_graph_t *graph );
117 /**
118  * @}
119  */
120 
121 #endif /* _graph_h_ */
122 
123 /**
124  * @}
125  */
graphBase
void graphBase(pastix_graph_t *graph, pastix_int_t baseval)
Rebase the graph to the given value.
Definition: graph.c:100
graphSort
void graphSort(pastix_graph_t *graph)
This routine sortes the subarray of edges of each vertex.
Definition: graph.c:283
graphCopy
int graphCopy(pastix_graph_t *graphdst, const pastix_graph_t *graphsrc)
This routine copy a given ordering in a new one.
Definition: graph.c:149
graphSpm2Graph
int graphSpm2Graph(pastix_graph_t *graph, const spmatrix_t *spm)
This routine build a graph thanks to an spm;.
Definition: graph.c:380
pastix_order_s
Order structure.
Definition: order.h:45
graphUpdateComputedFields
int graphUpdateComputedFields(pastix_graph_t *graph)
Update dofs, nnz, nnzexp, gnnz, n, nexp, gN of a given graph.
Definition: graph.c:339
graphPrepare
int graphPrepare(pastix_data_t *pastix_data, const spmatrix_t *spm, pastix_graph_t **graph)
This routine initializes the graph.
Definition: graph_prepare.c:115
graphGatherInPlace
int graphGatherInPlace(pastix_graph_t *graph)
This routine gather a distributed graph on each note in place.
Definition: graph.c:240
graphSave
void graphSave(pastix_data_t *pastix_data, const pastix_graph_t *graph)
Save a graph to file.
Definition: graph_io.c:102
graphSymmetrize
int graphSymmetrize(pastix_graph_t *graph)
Symmetrize a given graph.
Definition: graph.c:308
graphIsolate
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.
Definition: graph_isolate.c:287
graphLoad
void graphLoad(const pastix_data_t *pastix_data, pastix_graph_t *graph)
Load a graph from a file.
Definition: graph_io.c:45
graphIsolateRange
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.
Definition: graph_isolate.c:462
graphInitEmpty
void graphInitEmpty(pastix_graph_t *graph, PASTIX_Comm comm)
Initialize an empty graph.
Definition: graph.c:46
graphComputeKway
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.
Definition: graph_compute_kway.c:80
graphNoDiag
void graphNoDiag(pastix_graph_t *graph)
This routine removes the diagonal edges from a centralized graph.
Definition: graph_prepare.c:37
graphScatterInPlace
int graphScatterInPlace(pastix_graph_t *graph, PASTIX_Comm comm)
This routine scatter a graph from node root to the other nodes.
Definition: graph.c:192
graphExit
void graphExit(pastix_graph_t *graph)
Free the content of the graph structure.
Definition: graph.c:71
graphGetWeights
pastix_int_t * graphGetWeights(const pastix_graph_t *graph)
Build the vertex weight array out of the dof array.
Definition: graph.c:432