Date: 2024-12-02T08:57:55+00:00

Actual source code: network.h
slepc-3.22.2 2024-12-02
Report Typos and Errors

      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: #pragma once

     16: #include <slepcsys.h>

     18: typedef enum { GRAPH_UNDIRECTED,
     19:                GRAPH_DIRECTED,
     20:                GRAPH_BIPARTITE } GraphType;
     21: SLEPC_EXTERN const char *GraphTypes[];

     23: typedef enum { GRAPH_WEIGHT_UNWEIGHTED,
     24:                GRAPH_WEIGHT_POSITIVE,
     25:                GRAPH_WEIGHT_POSWEIGHTED,
     26:                GRAPH_WEIGHT_SIGNED,
     27:                GRAPH_WEIGHT_MULTISIGNED,
     28:                GRAPH_WEIGHT_WEIGHTED,
     29:                GRAPH_WEIGHT_MULTIWEIGHTED,
     30:                GRAPH_WEIGHT_DYNAMIC,
     31:                GRAPH_WEIGHT_MULTIPOSWEIGHTED } GraphWeight;
     32: SLEPC_EXTERN const char *GraphWeights[];

     34: struct _n_Graph {
     35:   MPI_Comm      comm;
     36:   GraphType     type;
     37:   GraphWeight   weight;
     38:   PetscInt      nvertices;
     39:   PetscInt      nedges;
     40:   Mat           adjacency;
     41: };
     42: typedef struct _n_Graph* Graph;

     44: SLEPC_EXTERN PetscErrorCode GraphCreate(MPI_Comm,Graph*);
     45: SLEPC_EXTERN PetscErrorCode GraphDestroy(Graph*);
     46: SLEPC_EXTERN PetscErrorCode GraphPreload(Graph,char*);
     47: SLEPC_EXTERN PetscErrorCode GraphPreallocate(Graph,char*);
     48: SLEPC_EXTERN PetscErrorCode GraphLoadUnweighted(Graph,char*);