lgraph.h
Go to the documentation of this file.00001 #ifndef LGRAPH_H
00002 #define LGRAPH_H
00003
00004
00005
00006
00007 #include <list>
00008 #include <map>
00009 #include <iostream>
00010 #include <vector>
00011 #include <string>
00012
00013 using namespace std;
00014
00018 struct vertexinfo {
00019 vertexinfo() : id(), color('w'), parent(-1), discover(-1), finish(-1), numchildren(0) {}
00020
00021 vertexinfo(const string &label) : id(label), color('w'), parent(-1), discover(-1), finish(-1), numchildren(0) {}
00022 string id;
00023 char color;
00024 int discover;
00025 int finish;
00026 int parent;
00027 int low;
00028 int numchildren;
00029 };
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041 class lgraph {
00042 public:
00043 lgraph() : adjl(), vertices(), time(0) {}
00044
00045 lgraph(istream &ins);
00046
00047
00048 void fromSQL(const string &query);
00049 void dfs();
00050 void dfsvisit(const int u);
00051 void show();
00052 vector<string> articulation();
00053 private:
00054 int time;
00055 vector<vertexinfo> vertices;
00056 vector<list<int> > adjl;
00057 };
00058 #endif