-
Notifications
You must be signed in to change notification settings - Fork 15
/
edge.h
41 lines (35 loc) · 1.1 KB
/
edge.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
#ifndef EDGE_H
#define EDGE_H
#include <iostream>
#include "node.h"
using namespace std;
class Edge {
public:
// Edges are hash-searched on the basis of startNode.
// startNode = -1 means that this edge is not valid yet.
int startNode;
int endNode;
int startLabelIndex;
int endLabelIndex;
void printID ();
void insert ();
void remove ();
// node is the starting node and c is the ASCII input char.
// Static because I want to call it without using an instantiated object.
static long returnHashKey(int node, int c);
static Edge findEdge(int node, int c);
// Constructors.
Edge () : startNode(-1) {};
// everytime a new edge is created, a new node is also created and thus the
// endNode is declared as below.
Edge (int start, int first, int last) :
startNode (start),
endNode (Node::noOfNodes++),
startLabelIndex (first),
endLabelIndex (last) {};
// Destructor
~Edge() {
// cout << "destroying edge " << startNode << " " << endNode << endl;
}
};
#endif