Exemple #1
0
static void connectivity_dfs(Postprocessor *pp, Sublinkage *sublinkage,
			     int w, pp_linkset *ls)
{
  List_o_links *lol;
  pp->visited[w] = TRUE;
  for (lol = pp->pp_data.word_links[w]; lol != NULL; lol = lol->next) {
    if (!pp->visited[lol->word] &&
        !pp_linkset_match(ls, sublinkage->link[lol->link]->name)) 
      connectivity_dfs(pp, sublinkage, lol->word, ls);
  }
}
Exemple #2
0
static void connectivity_dfs(Postprocessor *pp, Linkage sublinkage,
                             int w, pp_linkset *ls)
{
	List_o_links *lol;
	assert(w < pp_data->num_words, "Bad word index");
	pp_data->visited[w] = true;
	for (lol = pp_data->word_links[w]; lol != NULL; lol = lol->next)
	{
		if (!pp_data->visited[lol->word] &&
				!pp_linkset_match(ls, sublinkage->link[lol->link]->name))
			connectivity_dfs(pp, sublinkage, lol->word, ls);
	}
}
Exemple #3
0
/* replaced in 3/98 with a slightly different algorithm shown below  ---DS*/
static int 
apply_connected_without(Postprocessor *pp,Sublinkage *sublinkage,pp_rule *rule)
{
  /* Returns true if the linkage is connected when ignoring the links
     whose names are in the given list of link names.
     Actually, what it does is this: it returns FALSE if the connectivity
     of the subgraph reachable from word 0 changes as a result of deleting
     these links. */
  int i;
  memset(pp->visited, 0, pp->pp_data.length*(sizeof pp->visited[0]));
  mark_reachable_words(pp, 0);
  for (i=0; i<pp->pp_data.length; i++) 
    pp->visited[i] = !pp->visited[i];
  connectivity_dfs(pp, sublinkage, 0, rule->link_set);
  for (i=0; i<pp->pp_data.length; i++) 
    if (pp->visited[i] == FALSE) return FALSE;
  return TRUE;
}