//Create by Wubo
//Revise on 08/25/06 03:32



#include "d:\scilab-4.0\routines\stack-c.h"
void decom __PARAMS((int *a, int n, int m, int *b, int *c));

int intdecom(fname) 
char *fname;
{
    static int l1, m1, n1, l2, m2, n2, l3,m3,n3,l4;
    static int minlhs=0, maxlhs=1, minrhs=2, maxrhs=2;   //why the minlhs must equal zero??

    /* Check number of inputs (rhs=2) and outputs (lhs=1) */
    CheckRhs(minrhs,maxrhs) ;
    CheckLhs(minlhs,maxlhs) ;
    //m2=10;
    GetRhsVar(1, "i", &m1, &n1, &l1);   //the following sentence must be wrote together!!!! 
    GetRhsVar(2, "i", &m1, &n1, &l2);   
    CreateVar(3, "i", &m2, &n2, &l3);
//  CreateVar(4, "i", &m1, &n1, &l4);  
    decom(istk(l1), m1, n1, istk(l2),istk(l3));
    /*  Return C (3)  */
    LhsVar(1) = 3;
//  LhsVar(2)=  4;
    return 0;
}


#include "stdio.h"
#include "stdlib.h"

FILE *fp;



void decom(a,n,m,b,c)
int a[],b[];
int c[];
int n,m;
{
    int i;
    int index=0;
    fp=fopen("edge.pairs","w");
    for (i=0;i<m;i++)
        fprintf(fp,"%d %d\n",a[i],b[i]);
    fclose(fp);
    system("fastcommunity_mh -f edge.pairs");

}
