-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgraph.h
35 lines (28 loc) · 1.01 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
// Graph.h ... interface to Graph ADT
// This file was initially taken from course material, however it has been heavily modified to include many task-specific functions
#ifndef GRAPH_H
#define GRAPH_H
#include <stdio.h>
// graph representation is hidden
typedef struct GraphRep *Graph;
// vertices denoted by integers 0..N-1
typedef int Vertex;
int validV(Graph,Vertex); //validity check
// edges are pairs of vertices (end-points)
typedef struct { Vertex v; Vertex w; } Edge;
void insertEdge(Graph, Vertex, Vertex, int);
void removeEdge(Graph, Vertex, Vertex);
// operations on graphs
Graph newGraph(int nV);
void dropGraph(Graph);
Graph makeGraph(int, int**);
void showGraph(Graph);
int findPath(Graph, Vertex, Vertex, int, int *);
int getnumV(Graph g);
int vLinkw(Graph g, Vertex v, Vertex w);
double numInLinks(Graph g, Vertex v);
double numOutLinks(Graph g, Vertex v);
double sumInLinks(Graph g, Vertex v);
double sumOutLinks(Graph g, Vertex v);
void disposeGraph(Graph g);
#endif