First Upload
This commit is contained in:
41
29 - Graphs/ex2.c
Normal file
41
29 - Graphs/ex2.c
Normal file
@@ -0,0 +1,41 @@
|
||||
#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)
|
||||
{
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user