21 #include <grass/dgl/graph.h>
53 tin = (
int *)
G_calloc(nnodes + 1,
sizeof(
int));
54 min_tin = (
int *)
G_calloc(nnodes + 1,
sizeof(
int));
58 mark = (
int *)
G_calloc(nnodes + 1,
sizeof(
int));
59 if (!tin || !min_tin || !parent || !stack || !current || !mark) {
64 for (i = 1; i <= nnodes; i++) {
79 if (tin[current_id] == 0) {
83 stack[0] = current_node;
85 parent[current_id] =
NULL;
90 if (tin[node_id] == 0)
91 min_tin[node_id] = tin[node_id] = ++time;
101 if (min_tin[to] < min_tin[node_id])
102 min_tin[node_id] = min_tin[to];
107 for (; current_edge[node_id];
108 current_edge[node_id] =
112 if (to == parent[node_id])
118 if (tin[to_id] < min_tin[node_id])
119 min_tin[node_id] = tin[to_id];
122 if (node_id == current_id)
125 parent[to_id] = node;
126 stack[stack_size++] = to;
130 if (!current_edge[node_id])
140 for (i = 1; i <= nnodes; i++)
147 for (i = 1; i <= nnodes; i++)
int NetA_articulation_points(dglGraph_s *graph, struct ilist *articulation_list)
Get number of articulation points in the graph.
void G_free(void *)
Free allocated memory.
void void void void G_fatal_error(const char *,...) __attribute__((format(printf
int Vect_list_append(struct ilist *, int)
Append new item to the end of list if not yet present.
dglInt32_t * dglNode_T_First(dglNodeTraverser_s *pT)
dglInt32_t * dglNodeGet_OutEdgeset(dglGraph_s *pGraph, dglInt32_t *pnNode)
int dglEdgeset_T_Initialize(dglEdgesetTraverser_s *pT, dglGraph_s *pGraph, dglInt32_t *pnEdgeset)
int dglNode_T_Initialize(dglNodeTraverser_s *pT, dglGraph_s *pGraph)
dglInt32_t * dglEdgeset_T_Next(dglEdgesetTraverser_s *pT)
dglInt32_t * dglEdgeGet_Tail(dglGraph_s *pGraph, dglInt32_t *pnEdge)
dglInt32_t * dglNode_T_Next(dglNodeTraverser_s *pT)
int dglGet_NodeCount(dglGraph_s *pgraph)
void dglEdgeset_T_Release(dglEdgesetTraverser_s *pT UNUSED)
dglInt32_t * dglEdgeset_T_First(dglEdgesetTraverser_s *pT)
void dglNode_T_Release(dglNodeTraverser_s *pT)
dglInt32_t dglNodeGet_Id(dglGraph_s *pGraph, dglInt32_t *pnNode)
dglInt32_t * dglGetNode(dglGraph_s *pGraph, dglInt32_t nNodeId)