[GRASS-SVN] r68031 - grass/trunk/lib/vector/neta
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Mar 9 12:38:32 PST 2016
Author: mmetz
Date: 2016-03-09 12:38:32 -0800 (Wed, 09 Mar 2016)
New Revision: 68031
Modified:
grass/trunk/lib/vector/neta/articulation_point.c
grass/trunk/lib/vector/neta/components.c
grass/trunk/lib/vector/neta/spanningtree.c
grass/trunk/lib/vector/neta/utils.c
Log:
netalib: minor updates
Modified: grass/trunk/lib/vector/neta/articulation_point.c
===================================================================
--- grass/trunk/lib/vector/neta/articulation_point.c 2016-03-09 15:34:34 UTC (rev 68030)
+++ grass/trunk/lib/vector/neta/articulation_point.c 2016-03-09 20:38:32 UTC (rev 68031)
@@ -3,7 +3,7 @@
\brief Network Analysis library - connected components
- Computes strongly and weakly connected components.
+ Computes network articulation points.
(C) 2009-2010 by Daniel Bundala, and the GRASS Development Team
Modified: grass/trunk/lib/vector/neta/components.c
===================================================================
--- grass/trunk/lib/vector/neta/components.c 2016-03-09 15:34:34 UTC (rev 68030)
+++ grass/trunk/lib/vector/neta/components.c 2016-03-09 20:38:32 UTC (rev 68031)
@@ -277,5 +277,7 @@
dglNode_T_Release(&nt);
G_free(stack);
+ G_free(order);
+ G_free(processed);
return components;
}
Modified: grass/trunk/lib/vector/neta/spanningtree.c
===================================================================
--- grass/trunk/lib/vector/neta/spanningtree.c 2016-03-09 15:34:34 UTC (rev 68030)
+++ grass/trunk/lib/vector/neta/spanningtree.c 2016-03-09 20:38:32 UTC (rev 68031)
@@ -88,10 +88,12 @@
int NetA_spanning_tree(dglGraph_s * graph, struct ilist *tree_list)
{
int nnodes, edges, nedges, i, index;
- edge_cost_pair *perm; /*permutaion of edges in ascending order */
+ edge_cost_pair *perm; /*permutation of edges in ascending order */
struct union_find uf;
dglEdgesetTraverser_s et;
+ /* TODO: consider closed nodes / node costs */
+
nnodes = dglGet_NodeCount(graph);
nedges = dglGet_EdgeCount(graph);
perm = (edge_cost_pair *) G_calloc(nedges, sizeof(edge_cost_pair));
@@ -99,7 +101,7 @@
G_fatal_error(_("Out of memory"));
return -1;
}
- /*for some obscure reasons, dglGetEdge always returns NULL. Therefore this complicated enumeration of the edges... */
+ /* dglGetEdge is only supported with graphs version > 1. Therefore this complicated enumeration of the edges... */
index = 0;
G_message(_("Computing minimum spanning tree..."));
G_percent_reset();
@@ -136,6 +138,7 @@
Vect_list_append(tree_list, dglEdgeGet_Id(graph, perm[i].edge));
}
}
+ G_percent(index, index, 1);
G_free(perm);
uf_release(&uf);
return edges;
Modified: grass/trunk/lib/vector/neta/utils.c
===================================================================
--- grass/trunk/lib/vector/neta/utils.c 2016-03-09 15:34:34 UTC (rev 68030)
+++ grass/trunk/lib/vector/neta/utils.c 2016-03-09 20:38:32 UTC (rev 68031)
@@ -141,8 +141,12 @@
if (!Vect_cat_get(Cats, layer, &cat))
continue;
Vect_get_line_nodes(In, i, &node, NULL);
- if (db_CatValArray_get_value_double(&vals, cat, &value) == DB_OK)
- node_costs[node] = value * In->dgraph.cost_multip;
+ if (db_CatValArray_get_value_double(&vals, cat, &value) == DB_OK) {
+ if (value < 0)
+ node_costs[node] = -1;
+ else
+ node_costs[node] = value * In->dgraph.cost_multip;
+ }
}
}
More information about the grass-commit
mailing list