-
Notifications
You must be signed in to change notification settings - Fork 0
/
SymbolGraph.h
47 lines (45 loc) · 1.08 KB
/
SymbolGraph.h
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
38
39
40
41
42
43
44
45
46
47
#pragma once
#include <string>
#include"Digraph.h"
#include <unordered_map>
#include <fstream>
#include <string.h>
#include <iostream>
#include <list>
using namespace std;
class SymbolGraph
{
public:
/**
* given a filename, open that file, and use whitespace as delimeter.
* every line of that file responds to an edge in digraph
*/
SymbolGraph(string filename);
~SymbolGraph();
/**
* Does this symbol graph have this key as a node?
*/
bool contains(string key);
/**
* given a string version vertex, return the integer index(integer version vertex) of the digraph
*/
int index(string key);
/**
* given a integer index(integer version vertex), return the string version vertex
*/
std::string name(int v);
Digraph * G();
private:
/**
* returns the digraph.
*/
Digraph * digraph;
unordered_map<string, int> umap;// mapping between vertex name and
//integer index
string * keys;// mapping between vertex name and
//integer index
/**
* implement a split method just like split() in Java.
*/
static string * split(string line);
};