-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgraph.h
More file actions
37 lines (32 loc) · 793 Bytes
/
graph.h
File metadata and controls
37 lines (32 loc) · 793 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#pragma once
#include <stack>
#include <vector>
#include <string>
#include <fstream>
#include <iostream>
using namespace std;
// state
struct No{
char op;
int size;
int vertex;
bool ehLambdaT;
string operationType;
vector<No*> nodesList; // saving which state connects to which
};
class Graph {
private:
int V; // number of states on the regular expression
int E;
string expression;
vector<No*> adjList;
public:
Graph(string exp);
bool recognize(string word);
void printGraph();
void addEdge(int v, int w);
void dfsR(int v, bool* marked);
void buildAutomata(string regexp);
bool defineLambdaT(string exp, int index);
string defineOp(string exp, int index);
};