You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
734 B
44 lines
734 B
#include <stdio.h>
|
|
#include <string.h>
|
|
#include <stdlib.h>
|
|
#define MAX 1000
|
|
typedef struct node {
|
|
char a[100];
|
|
struct node* next;
|
|
}edgenode;
|
|
typedef struct {
|
|
char name[100];
|
|
edgenode* firstnode;
|
|
}vexnode;
|
|
typedef struct {
|
|
vexnode adjust[7];
|
|
int e, n;
|
|
}
|
|
void createjz(){//创建邻接矩阵函数
|
|
edgenode *p;
|
|
aaa();
|
|
int i;
|
|
for(i=0;i<nm.n;i++){
|
|
p=nm.adjust[i].firstnode;
|
|
while(p!=NULL){
|
|
int h;
|
|
for(h=0;h<nm.n;h++)
|
|
if(!strcmp(p->a,nm.adjust[h].name)) break;
|
|
cont[i][h]=1;
|
|
p=p->next;
|
|
}
|
|
}
|
|
}
|
|
void print() {
|
|
edgenode* p;
|
|
int i;
|
|
for(i=0;i<nm.n;i++){
|
|
printf("[%s]",nm.adjust[i].name);
|
|
p=nm.adjust[i].firstnode;
|
|
while(p!=NULL){
|
|
printf("-->[%s]",p->a);
|
|
p=p->next;
|
|
}
|
|
printf("\n");
|
|
}
|
|
} |