219
>
//af subgraful obtinut prin eliminare noduri si muchii
//dintr-un graf orientat
# include <stdio.h>
# include <conio.h>
void main(void)
{
int a[50][50],v[50],n,i,j,k,nr;
FILE *f=fopen("c:intrare.txt","r");
fscanf(f,"%d",&n);
for(i=1;i<=n;i++)
for(j=1;j<=n;j++)
fscanf(f,"%d",&a[i][j]);
fclose(f);
printf("Cate noduri elimin?");
scanf("%d",&nr);
for(i=1;i<=nr;i++)
{
printf("Elimin nodul: ");
scanf("%d",&v[i]);
}
for(k=1;k<=nr;k++)
{
for(i=v[k];i<n;i++)
for(j=1;j<=n;j++)
a[i][j]=a[i+1][j];
for(i=1;i<=n;i++)
for(j=v[k];j<n;j++)
a[i][i]=a[i][j+1];
n=n-1;
}
printf("Afisare matrice adiacenta:n");
for(i=1;i<=n;i++)
{
for(j=1;j<=n;j++)
printf(" %d ",a[i][j]);
printf("n");
}
getch();
clrscr();
}