diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2014-03-30 22:39:13 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2014-04-10 08:47:11 +0200 |
commit | 318dc8a0dde38b593d3b5a84fbebe145f6c0e716 (patch) | |
tree | 2777c86d3871cec752cbd066dd4ab55ba68b8a14 /src/lib/eina_graph_dfs.c | |
parent | d44cd9ff53941d72c42c46d1fe73cc36c6969688 (diff) | |
download | eina_graph-master.zip eina_graph-master.tar.gz |
Diffstat (limited to 'src/lib/eina_graph_dfs.c')
-rw-r--r-- | src/lib/eina_graph_dfs.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/src/lib/eina_graph_dfs.c b/src/lib/eina_graph_dfs.c index 3488185..2476de6 100644 --- a/src/lib/eina_graph_dfs.c +++ b/src/lib/eina_graph_dfs.c @@ -39,7 +39,6 @@ _eina_graph_dfs_swalk(_Eina_Graph *_g, _Eina_Graph_DFS *_dfs, { Eina_Array *stack = NULL; Eina_Array *adjs; - _Eina_Graph_DFS_Data *vd; unsigned int p, w, n, i; p = v; @@ -51,10 +50,9 @@ _eina_graph_dfs_swalk(_Eina_Graph *_g, _Eina_Graph_DFS *_dfs, w = eina_array_top_uint_get(stack); eina_array_pop(stack); - vd = &_dfs->data[w]; - if(vd->m) continue; - vd->m = EINA_TRUE; - vd->e = p; + if (_dfs->data[w].m) continue; + _dfs->data[w].m = EINA_TRUE; + _dfs->data[w].p = p; p = w; adjs = _g->adjs[w]; @@ -74,7 +72,6 @@ static void _eina_graph_dfs_rwalk(_Eina_Graph *_g, _Eina_Graph_DFS *_dfs, unsigned int v) { Eina_Array *adjs; - _Eina_Graph_DFS_Data *vd; unsigned int i, n, w; _dfs->data[v].m = EINA_TRUE; @@ -84,11 +81,10 @@ _eina_graph_dfs_rwalk(_Eina_Graph *_g, _Eina_Graph_DFS *_dfs, unsigned int v) for (i = 0; i < n; i++) { w = eina_array_uint_nth_get(adjs, i); - vd = &_dfs->data[w]; - if (!vd->m) + if (!_dfs->data[w].m) { + _dfs->data[w].p = v; _eina_graph_dfs_rwalk(_g, _dfs, w); - vd->e = v; } } } @@ -174,7 +170,7 @@ eina_graph_dfs_path_get(Eina_Graph_DFS *dfs, unsigned int v) while (w != _dfs->s) { path = eina_list_prepend(path, CAST_V(w)); - w = _dfs->data[w].e; + w = _dfs->data[w].p; } path = eina_list_prepend(path, CAST_V(_dfs->s)); |