set node's parent edge

This commit is contained in:
c9s 2014-05-22 16:44:56 +08:00
parent 595dadba15
commit 24aaa881b1
4 changed files with 9 additions and 1 deletions

View file

@ -39,6 +39,7 @@ typedef struct _route route;
struct _node {
edge ** edges;
route ** routes;
edge * parent_edge;
uint32_t edge_len;
uint32_t edge_cap;
uint32_t route_len;
@ -60,7 +61,6 @@ struct _node {
void * data;
uint8_t endpoint;
};
struct _edge {

View file

@ -30,6 +30,9 @@ edge * r3_edge_create(char * pattern, int pattern_len, node * child) {
e->pattern_len = pattern_len;
e->child = child;
// update childs parent edge
child->parent_edge = e;
// default stats
e->hits = 0;
e->score = 0;

View file

@ -51,6 +51,8 @@ node * r3_tree_create(int cap) {
n->edge_len = 0;
n->edge_cap = cap;
n->parent_edge = NULL;
n->routes = NULL;
n->route_len = 0;
n->route_cap = 0;
@ -380,6 +382,8 @@ node * r3_node_create() {
n->edge_len = 0;
n->edge_cap = 0;
n->parent_edge = NULL;
n->routes = NULL;
n->route_len = 0;
n->route_cap = 0;

View file

@ -444,3 +444,4 @@
1400681414,10832905.89
1400685490,13185955.87
1400748100,12609470.07
1400748288,13317009.48

1 1400242718 5649455.80
444 1400681414 10832905.89
445 1400685490 13185955.87
446 1400748100 12609470.07
447 1400748288 13317009.48