#include<stdio.h>
#include<iostream.h>
#include<list>
#include<strstrea.h>
#include<stdlib.h>
#define MaxVerNum 4
#define MaxVertexNum 4
#include<vector>//vetor是一个容器,存放任意类型的动态的“数组”。
using namespace std;//c++标准程序库中的所有标识符都被定义在一个名为std的namespace中;
int n, m, x, y, i;
list<int>::iterator j;//建立一个迭代器j,读取每一个值,读完以后再指向下一个数据;//list->链表;
vector<list<int> >a;//a[i]储存从i出去的边的集合,即邻接表,c是逆邻接表
vector<pair<int, int> >b;//b[i]储存i点的入度和出度,第一个是入度,第二个数出度
//pair的作用,里面有两个参数。将两个数据组合成一个数据;把每条边集合起来,形成一个图;通过make_pair实现;
typedef struct node{ /*边表结点*/
int adjvex; /*邻接点域*/
struct node * next; /*指向下一个邻接点的指针域*/
}EdgeNode;/*若要表示边上信息,则应增加一个数据域info*/
typedef struct ArcNode{
int adjvex;
ArcNode *nextarc;
//InfoType *info;
}ArcNode;
typedef struct vnode{ /*顶点表结点*/
char vertex [20]; /*顶点域*/
EdgeNode * firstedge;/*边表头指针*/
ArcNode *firstarc;
}VertexNode;
typedef VertexNode AdjList[MaxVerNum]; /*AdjList 是邻接表类型*/
typedef struct {
AdjList adjlist; /*邻接表*/
int n,e; /*顶点数和边数*/ <
#include<iostream.h>
#include<list>
#include<strstrea.h>
#include<stdlib.h>
#define MaxVerNum 4
#define MaxVertexNum 4
#include<vector>//vetor是一个容器,存放任意类型的动态的“数组”。
using namespace std;//c++标准程序库中的所有标识符都被定义在一个名为std的namespace中;
int n, m, x, y, i;
list<int>::iterator j;//建立一个迭代器j,读取每一个值,读完以后再指向下一个数据;//list->链表;
vector<list<int> >a;//a[i]储存从i出去的边的集合,即邻接表,c是逆邻接表
vector<pair<int, int> >b;//b[i]储存i点的入度和出度,第一个是入度,第二个数出度
//pair的作用,里面有两个参数。将两个数据组合成一个数据;把每条边集合起来,形成一个图;通过make_pair实现;
typedef struct node{ /*边表结点*/
int adjvex; /*邻接点域*/
struct node * next; /*指向下一个邻接点的指针域*/
}EdgeNode;/*若要表示边上信息,则应增加一个数据域info*/
typedef struct ArcNode{
int adjvex;
ArcNode *nextarc;
//InfoType *info;
}ArcNode;
typedef struct vnode{ /*顶点表结点*/
char vertex [20]; /*顶点域*/
EdgeNode * firstedge;/*边表头指针*/
ArcNode *firstarc;
}VertexNode;
typedef VertexNode AdjList[MaxVerNum]; /*AdjList 是邻接表类型*/
typedef struct {
AdjList adjlist; /*邻接表*/
int n,e; /*顶点数和边数*/ <