/*
 * File         : Graphcomm.java
 * Author       : Xinying Li
 * Created      : Thu Apr  9 12:22:15 1998
 * Revision     : $Revision: 1.4 $
 * Updated      : $Date: 1999/09/14 20:50:09 $
 * Copyright: Northeast Parallel Architectures Center
 *            at Syracuse University 1998
 */

package mpi;

public class Graphcomm extends Intracomm {

  protected Graphcomm(long handle) {super(handle) ;}  

  /**
   * Returns graph topology information.
   * <p>
   * <table>
   * <tr><td><em> returns: </em></td><td> object defining node degress and
   *                                      edges of graph </tr>
   * </table>
   * <p>
   * Java binding of the MPI operation <tt>MPI_GRAPHDIMS_GET</tt>.
   * <p>
   * The number of nodes and number of edges can be extracted
   * from the sizes of the <tt>index</tt> and <tt>edges</tt> fields
   * of the returned object.
   */

  public native GraphParms Get() throws MPIException ;

  public Object clone() {
    return new Graphcomm(super.dup()) ;
  }

  /**
   * Provides adjacency information for general graph topology.
   * <p>
   * <table>
   * <tr><td><tt> rank     </tt></td><td> rank of a process in the group
   *                                      of this communicator </tr>
   * <tr><td><em> returns: </em></td><td> array of ranks of neighbouring
   *                                      processes to one specified </tr>
   * </table>
   * <p>
   * Java binding of the MPI operations <tt>MPI_GRAPH_NEIGHBOURS_COUNT</tt>
   * and <tt>MPI_GRAPH_NEIGHBOURS</tt>.
   * <p>
   * The number of neighbours can be extracted from the size of the result.
   */

  public native int [] Neighbours(int rank) throws MPIException ;

  /**
   * Compute an optimal placement.
   * <p>
   * <table>
   * <tr><td><tt> index    </tt></td><td> node degrees </tr>
   * <tr><td><tt> edges    </tt></td><td> graph edges </tr>
   * <tr><td><em> returns: </em></td><td> reordered rank of calling
   *                                      process </tr>
   * </table>
   * <p>
   * Java binding of the MPI operation <tt>MPI_GRAPH_MAP</tt>.
   * <p>
   * The number of nodes is taken to be size of the <tt>index</tt> argument.
   */

  public native int Map(int [] index, int [] edges) throws MPIException ;

}

