MPI_GRAPH_CREATE, MPI_Graph_create Purpose Creates a new communicator containing graph topology information. C synopsis #include MPI_Graph_create(MPI_Comm comm_old,int nnodes, int *index, int *edges,int reorder,MPI_Comm *comm_graph); C++ synopsis #include mpi.h MPI::Graphcomm MPI::Intracomm::Create_graph(int nnodes, const int index[], const int edges[], bool reorder) const; FORTRAN synopsis include 'mpif.h' or use mpi MPI_GRAPH_CREATE(INTEGER COMM_OLD,INTEGER NNODES,INTEGER INDEX(*), INTEGER EDGES(*),INTEGER REORDER,INTEGER COMM_GRAPH, INTEGER IERROR) Parameters comm_old is the input communicator (handle) (IN) nnodes is an integer specifying the number of nodes in the graph (IN) index is an array of integers describing node degrees (IN) edges is an array of integers describing graph edges (IN) reorder if true, ranking may be reordered (logical) (IN) comm_graph is the communicator with the graph topology added (handle) (OUT) IERROR is the FORTRAN return code. It is always the last argument. Description This subroutine creates a new communicator containing graph topology information provided by nnodes, index, edges, and reorder. MPI_GRAPH_CREATE returns the handle for this new communicator in comm_graph. If there are more tasks in comm_old than there are in nnodes, some tasks are returned with a value of MPI_COMM_NULL for comm_graph. Notes The following example shows how to define the arguments nnodes, index, and edges. Suppose there are four tasks (0, 1, 2, 3) with the following adjacency matrix: Task Neighbors 0 1, 3 1 0 2 3 3 0, 2 Then the input arguments are: Argument Input nnodes 4 index 2, 3, 4, 6 edges 1, 3, 0, 3, 0, 2 Thus, in C, index[0] is the degree of node 0, and index[i]-index[i-1] is the degree of node i, i=1, ..., nnodes-1. The list of neighbors of node 0 is stored in edges[j], for 0 >= j >= index[0]-1 and the list of neighbors of node i, i > 0, is stored in edges[j], index[i-1] >= j >= index[i]-1. In FORTRAN, index(1) is the degree of node 0, and index(i+1)- index(i) is the degree of node i, i=1, ..., nnodes-1. The list of neighbors of node 0 is stored in edges(j), for 1 >= j >= index(1) and the list of neighbors of node i, i > 0, is stored in edges(j), index(i)+1 >= j >= index(i+1). Because node 0 indicates that node 1 is a neighbor, node 1 must indicate that node 0 is its neighbor. For any edge A>B, the edge B>A must also be specified. Errors MPI not initialized MPI already finalized Invalid communicator Invalid communicator type must be intracommunicator Invalid nnodes nnodes < 0 or nnodes > groupsize Invalid node degree (index[i]-index[i-1]) < 0 Invalid neighbor edges[i] < 0 or edges[i]>=nnodes Asymmetric graph Conflicting collective operations on communicator Related information