-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgraph.h
More file actions
41 lines (35 loc) · 1.02 KB
/
graph.h
File metadata and controls
41 lines (35 loc) · 1.02 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
// header file: structs and function declarations for graphs
typedef struct Edge
{
int fromNodeID;
int toNodeID;
double weight;
struct Edge *nextEdge;
} Edge;
typedef struct Node
{
int nodeID;
Edge *edgeList;
struct Node *nextNode;
} Node;
typedef struct Graph
{
// fill in
Node *nodeList;
} Graph;
// add any additional struct definitions
Graph *initializeGraph();
void deleteGraph(Graph *myGraph);
void addNode(Graph *myGraph, int myNodeID);
void addEdge(Graph *myGraph, int myFromNodeID, int myToNodeID, double myEdgeweight);
void deleteNode(Graph *myGraph, int myNodeID);
void deleteEdge(Graph *myGraph, int myFromNodeID, int myToNodeID);
int calcNumNodes(Graph *myGraph);
int calcNumEdges(Graph *myGraph);
void printNodeList(Graph *myGraph);
void printEdgeList(Graph *myGraph);
// add any additional function declarations
Node *createNode(int myNodeID);
Edge *createEdge(int FromNodeID, int ToNodeID, double Edgeweight);
Node *findNode(Graph *myGraph, int NodeID);
void deleteEdgeList(Edge *curr);