-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgraph.h
40 lines (36 loc) · 1.27 KB
/
graph.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
// Copyright 2024 <2021111230,2021112139>
#ifndef GRAPH_H_
#define GRAPH_H_
#include <bits/stdc++.h>
#include <map>
#include <string>
#define MaxNum 100
class Graph {
private:
static void textPreprocess(std::string&);
int v, e;
const std::string path;
std::map<std::string, int> mp;
public:
explicit Graph(const std::string&);
using vertex_t = std::string;
using edge_t = int;
vertex_t Vex[MaxNum];
edge_t Edge[MaxNum][MaxNum];
int get_v() const;
int get_e() const;
int FindNum(const std::string&) const;
std::string FindBridgeWords(int, int) const;
std::string RandomBridgeWords(int, int) const;
};
extern void showDirectedGraph(const Graph&, const std::string&);
extern std::string queryBridgeWords(const Graph&,
const std::string&,
const std::string&);
extern std::string generateNewText(const Graph&, const std::string&);
extern std::string calcShortestPath(const Graph&,
const std::string&,
const std::string&);
extern std::string calcShortestPath(const Graph&, const std::string&);
extern std::string randomWalk(const Graph&);
#endif // GRAPH_H_