forked from sv00111/DFS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Graph.h
45 lines (31 loc) · 884 Bytes
/
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
41
42
43
44
//Shrey Valia
//svalia
//PA5 : Graph.h - header file for graph adt.
//
#include "List.h"
#include <stdio.h>
#include <stdlib.h>
#ifndef DFS_GRAPH_h
#define DFS_GRAPH_h
#define UNDEF -1
#define NIL 0
// private Graph type
typedef struct GraphObj* Graph;
/* Constructors-Destructors */
Graph newGraph(int n);
void freeGraph(Graph* pG);
/* Access functions */
int getOrder(Graph G);
int getSize(Graph G);
int getParent(Graph G, int u);
int getDiscover(Graph G, int u); /* Pre: 1<=u<=n=getOrder(G) */
int getFinish(Graph G, int u);
/* Manipulation procedures */
void addArc(Graph G, int u, int v); /* Pre: 1<=u<=n, 1<=v<=n */
void addEdge(Graph G, int u, int v); /* Pre: 1<=u<=n, 1<=v<=n */
void DFS(Graph G, List S); /* Pre: getLength(S)==getOrder(G) */
/* Other Functions */
Graph transpose(Graph G);
Graph copyGraph(Graph G);
void printGraph(FILE* out , Graph G);
#endif