boolean la_t_edge_connector(uint *vertex)
{
	double *vertex_array;
	uint *edge, edge_length, *crease, create_final[8] = { -1, -1, -1, -1, -1, -1, -1, -1 }, crease_final[8] = {0, 0, 0, 0, 0, 0, 0, 0};
	uint *ref, ref_length, vertex_length;

	udg_get_geometry(&vertex_length, &ref_length, &vertex_array, &ref, &crease);
	if(crease_edge(crease, vertex, ref, ref_length))
		return FALSE;
	edge = udg_get_edge_data(&edge_length);
//	print_edge_list(edge, edge_length);
	GlobalSurfaceCreate.list_length[0] = 0;
	GlobalSurfaceCreate.list_length[1] = 0;
	GlobalSurfaceCreate.create_length = 0;
	find_neighbor_polygon(ref, ref_length, vertex_length, vertex);
	find_neighbor_edges(edge, edge_length, vertex);
//	print_neighbor();
	find_triangles(vertex);
	find_quads(vertex, ref, ref_length, edge, edge_length);
	if(GlobalSurfaceCreate.create_length == 0)
		return TRUE;
	select_found(vertex_array, vertex, create_final);
	destroy_edges(edge, edge_length, create_final);
	destroy_surface(ref, crease, vertex_length, ref_length, create_final, crease_final);
	create_surface(create_final, crease_final);
	return FALSE;
}
double cluster_coefficient(Graph& g)
{
  typedef typename count_triangles<Graph>::size_type ct_size_type;

  ct_size_type count = 0;

  dynamic_array<triple<ct_size_type, ct_size_type, ct_size_type> > result;

  count_triangles<Graph> ctv(g, result, count);

  find_triangles(g, ctv);

#ifdef DEBUG
  fprintf(stdout, "found %lu triangles\n", (long unsigned) count);
#endif

  int count2 = find_connected_triples(g);

#ifdef DEBUG
  fprintf(stdout, "found %d connected triples\n", count2);
#endif

  return (double) 3 * count / count2;
}