41 lines
1.2 KiB
C
41 lines
1.2 KiB
C
#include "General.h"
|
|
|
|
//---------------------------------------------------------------------------------------
|
|
// DoesExistPath
|
|
// -------------
|
|
//
|
|
// General : Check if have path from point a to point b in graph with number of arc
|
|
//
|
|
// Parameters : Graph * a - the first item.
|
|
// Graph * b - the second item.
|
|
// unsigned int number_road - the number of arc.
|
|
//
|
|
// Return Value : Void
|
|
//
|
|
//---------------------------------------------------------------------------------------
|
|
// Programer : Cohen Idan
|
|
// Student No. : 211675038
|
|
// Date : 04.01.2020
|
|
//---------------------------------------------------------------------------------------
|
|
unsigned int DoesExistPath(Graph * start_point, Graph * end_point, unsigned int number_road)
|
|
{
|
|
LLL * temp;
|
|
if (!number_road)
|
|
{
|
|
return (start_point == end_point);
|
|
}
|
|
else
|
|
{
|
|
temp = start_point->list;
|
|
while (temp && !DoesExistPath(((Arc *)temp->value.pointer)->point, end_point, number_road - ONE))
|
|
{
|
|
temp = temp->next;
|
|
}
|
|
return (!temp);
|
|
}
|
|
}
|
|
|
|
void main(void)
|
|
{
|
|
|
|
} |