This commit is contained in:
Saturneric 2018-07-18 12:44:13 +08:00
parent a3f202d1c4
commit 30b15314d8
5 changed files with 39 additions and 15 deletions

1
graph/graph.c Normal file
View File

@ -0,0 +1 @@
#include "graph.h"

24
graph/graph.h Normal file
View File

@ -0,0 +1,24 @@
#ifndef GRAPH_H
#define GRAPH_H
#include "../list/list_expand.h"
typedef struct GNode{
unsigned long long id;
void *value;
List *routes;
int if_setValue;
}GNode;
typedef struct route{
unsigned long long id;
double distance;
int if_setValue;
GNode from, to;
}Route;
GNode *initGNode(void);
Route *initRoute(void);
#endif

Binary file not shown.

Binary file not shown.

View File

@ -21,7 +21,6 @@ typedef struct tree
}Tree;
int if_safeModeForTree;
int safeModeForTree(int ifon);
int releaseAllForTree(void);
@ -46,29 +45,29 @@ int TreeThroughDown(Tree *p_tree, int(*func)(TNode *, unsigned long long height)
int TreeThroughUp(Tree *p_tree, int(*func)(TNode *, unsigned long long height));
int TreeTravel(Tree *p_tree, int(*func)(TNode *, unsigned long long height));
int _dogetChildById(const char *type, void *value);
int _dogetChildByValue(const char *type, void *value);
int _doreleaseTree(TNode *p_tnode, unsigned long long height);
int _doTreeThroughDown(TNode *p_tnode, int height, int(*func)(TNode *, unsigned long long height));
int _doTreeThroughUp(TNode *p_tnode, int height, int(*func)(TNode *, unsigned long long height));
static int _dogetChildById(const char *type, void *value);
static int _dogetChildByValue(const char *type, void *value);
static int _doreleaseTree(TNode *p_tnode, unsigned long long height);
static int _doTreeThroughDown(TNode *p_tnode, int height, int(*func)(TNode *, unsigned long long height));
static int _doTreeThroughUp(TNode *p_tnode, int height, int(*func)(TNode *, unsigned long long height));
int releaseTree(Tree *p_tree);
int releaseOnlyTree(Tree *p_tree);
int releaseTNode(TNode *p_tnode);
int releaseOnlyTNode(TNode *p_tnode);
static int releaseOnlyTNode(TNode *p_tnode);
int setRoot(Tree *p_tree, TNode *p_tnode);
char *target_type;
void *target_value;
TNode *target_value_value;
static char *target_type;
static void *target_value;
static TNode *target_value_value;
unsigned long long target_id;
TNode *target_value_id;
static unsigned long long target_id;
static TNode *target_value_id;
List *tree_list;
List *tnode_list;
int if_safeModeForTree;
static List *tree_list;
static List *tnode_list;
static int if_safeModeForTree;
#endif