Actual source code: network.h
slepc-3.19.2 2023-09-05
1: /*
2: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3: SLEPc - Scalable Library for Eigenvalue Problem Computations
4: Copyright (c) 2002-, Universitat Politecnica de Valencia, Spain
6: This file is part of SLEPc.
7: SLEPc is distributed under a 2-clause BSD license (see LICENSE).
8: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
9: */
10: /*
11: Utilities for loading a complex network file and represent it as a graph
12: */
14: #if !defined(NETWORK_H)
15: #define NETWORK_H
17: #include <slepcsys.h>
19: typedef enum { GRAPH_UNDIRECTED,
20: GRAPH_DIRECTED,
21: GRAPH_BIPARTITE } GraphType;
22: SLEPC_EXTERN const char *GraphTypes[];
24: typedef enum { GRAPH_WEIGHT_UNWEIGHTED,
25: GRAPH_WEIGHT_POSITIVE,
26: GRAPH_WEIGHT_POSWEIGHTED,
27: GRAPH_WEIGHT_SIGNED,
28: GRAPH_WEIGHT_MULTISIGNED,
29: GRAPH_WEIGHT_WEIGHTED,
30: GRAPH_WEIGHT_MULTIWEIGHTED,
31: GRAPH_WEIGHT_DYNAMIC,
32: GRAPH_WEIGHT_MULTIPOSWEIGHTED } GraphWeight;
33: SLEPC_EXTERN const char *GraphWeights[];
35: struct _n_Graph {
36: MPI_Comm comm;
37: GraphType type;
38: GraphWeight weight;
39: PetscInt nvertices;
40: PetscInt nedges;
41: Mat adjacency;
42: };
43: typedef struct _n_Graph* Graph;
45: SLEPC_EXTERN PetscErrorCode GraphCreate(MPI_Comm,Graph*);
46: SLEPC_EXTERN PetscErrorCode GraphDestroy(Graph*);
47: SLEPC_EXTERN PetscErrorCode GraphPreload(Graph,char*);
48: SLEPC_EXTERN PetscErrorCode GraphPreallocate(Graph,char*);
49: SLEPC_EXTERN PetscErrorCode GraphLoadUnweighted(Graph,char*);
51: #endif