#include <iostream>
#include <stdlib.h>
using namespace std;
typedef int E;
typedef char T;
const int maxWeight=1000;
class Graph{
private:
T *verticesList;
E **edge;
int numVertices;
int maxVertices;
int numEdges;
public:
Graph(int sz=100);
T getValue(int v);
bool insertVertex(const T vertex);
bool insertEdge(int v1,int v2,E cost);
bool removeVertex(int v);
int getFirstNeighbor(int v);
int getNextNeighbor(int v,int w);
};
Graph::Graph(int sz){
maxVertices=sz;
numEdges=0;
numVertices=0;
verticesList=new T[maxVertices];
edge=new E*[maxVertices];
for(int i=0;i<maxVertices;i++){
edge[i]=new E[maxVertices];
}
for(int i=0;i<maxVertices;i++){
for(int j=0;j<maxVertices;j++){
edge[i][j]=(i==j)?0:maxWeight;
}
}
}
T Graph::getValue(int v){
if(v>=0&&v<numVertices)
return verticesList[v];
else
exit(1);
}
bool Graph::insertVertex(const T vertex){
if(numVertices==maxVertices)
return false;
verticesList[numVertices]=vertex;
numVertices++;
return true;
}
bool Graph::insertEdge(int v1,int v2,E cost){
if(v1<0||v2<0||v1>numEdges||v2>numEdges)
return false;
edge[v1][v2]=cost;
edge[v2][v1]=cost;
numEdges++;
return true;
}
bool Graph::removeVertex(int v){
if(v<0||v>numVertices)
return false;
if(numVertices==1)
return false;
verticesList[v]=verticesList[numVertices-1];
for(int i=0;i<numVertices;i++){
edge[v][i]=edge[numVertices-1][i];
}
numVertices--;
for(int i=0;i<numVertices;i++){
edge[i][v]=edge[i][numVertices-1];
}
return true;
}
int Graph::getFirstNeighbor(int v){
if(v>=0){
for(int i=0;i<numVertices;i++){
if(edge[v][i]<maxWeight&&edge[v][i]>0)
return i;
}
}
return -1;
}
int Graph::getNextNeighbor(int v,int w){
if(v>=0&&w>=0){
}
}
void DFS(Graph &G,int v,bool &visited[]){
cout<<G.getValue(v)<<' ';
visited[v]=true;
int w=G.get
}
int main(){
return 0;
}