#define maxnode 30
#define null 0
#define m 20
#include <stdio.h>
typedef struct st_arc
{
int adjvex;
int weight;
struct st_arc *nextarc;
}arcnode;
typedef struct
{
int vertex;
struct st_arc *firstarc;
}vernode;
typedef vernode adjlist[maxnode];
int queue[maxnode];
void dfs(adjlist g,int k,int visited[])
{/*从顶点K出发深度优先搜索*/
arcnode *p;
int w;
visited[k]=1;
printf("%d ",g[k].vertex);
p=g[k].firstarc;
while(p!=null)
{
w=p->adjvex;
if(visited[w]==0)
dfs(g,w,visited);