-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtime.h
More file actions
50 lines (41 loc) · 1.44 KB
/
time.h
File metadata and controls
50 lines (41 loc) · 1.44 KB
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
48
49
50
#include "graph.h"
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#define DONTCARE 0
// these functions stores the previous
// five time values from previous 5 inputs
// the input taken should be like
// feed us yhe previous 5 days data
// for each edge
// the user will give five situations for
// each edge. If he wants to give same
// data as privious day then he should have
// the option as well
typedef struct timeNode timeNode;
typedef struct timeHistoryTable timeHistoryTable;
struct timeHistoryTable
{
int no_of_vertices;
timeNode **tpointer;
};
struct timeNode
{
int vertexid;
double time[5];
double avgtime;
timeNode *timeNext;
};
timeHistoryTable *createEmptyTimeHistoryTable(int N);
timeNode* makeTimeNode(double t1, double t2, double t3, double t4, double t5, int v);
int isEdge(PtrAdjList G, int u, int v);
int timeDataAlreadyExists(timeHistoryTable* T,int u,int v);
void addTimeNode(PtrAdjList G, timeHistoryTable* T, int u, double t1, double t2, double t3, double t4, double t5, int v); // u to v
void printTimeHistoryTable(timeHistoryTable* T);
void deleteMemoryOfTable(timeHistoryTable *T);
void SafeAlgorithmStart(timeHistoryTable* T,PtrAdjList G,int source,int destination);
// in main.c file it would look something like
// enter data for this edge for previous days:
// 5 times scanf in a while loop(loop traverses through edges)
// take time from each entry and then use this functions
// to store the data