-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGraph.h
More file actions
41 lines (31 loc) · 881 Bytes
/
Graph.h
File metadata and controls
41 lines (31 loc) · 881 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
38
39
40
41
// Graph ADT interface for Ass2 (COMP2521)
#include <stdbool.h>
#ifndef _CS2521_GRAPH_H
#define _CS2521_GRAPH_H
typedef struct GraphRep *Graph;
// vertices are ints
typedef int Vertex;
typedef struct _adjListNode {
Vertex w;
int weight;
struct _adjListNode *next;
} adjListNode;
typedef adjListNode* AdjList;
Graph newGraph(int noNodes);
void insertEdge(Graph g, Vertex src, Vertex dest, int weight);
void removeEdge(Graph g, Vertex src, Vertex dest);
bool adjacent(Graph g, Vertex src, Vertex dest);
int numVerticies(Graph g);
/*
* Returns a list of adjacent vertices
* on outgoing edges from a given vertex.
**/
AdjList outIncident(Graph g, Vertex v);
/*
* Returns a list of adjacent vertices
* on incoming edges from a given vertex.
**/
AdjList inIncident(Graph g, Vertex v);
void showGraph(Graph g);
void freeGraph(Graph g);
#endif