Пример #1
0
int isdelknot(pointnames *graph){
	pointnames *current = NULL;
	current = graph;
	current = current->next;
	while (current != NULL){
		marker_null(graph);
		current->locate->marker = 2;
		if (iscycle(graph)==0) return 1;
		current = current->next;
	}
	return 0;
}
Пример #2
0
int main()
{
	struct graph *g=(struct graph*)malloc(sizeof(struct graph));
	creat_graph(3,3,g);
	add_edge(g,0,1,0);
	add_edge(g,1,2,1);
	add_edge(g,2,0,2);
	if(iscycle(g))
	printf("Cycle is detected\n");
	else
	printf("Cycle is not detected\n");
	return 0;
}