digraph/directed_graph.c
/*
 * The _connected_vertices_count_recursive function takes a DirectedGraph* struct pointer 
 * and a void* origin pointer to a vertex. This function recursively visits each vertex 
 * traversable via the vertx's arc list that has already not been visited and counts the
 * number of vertices. The count of the number of vertices visited is returned to the client.
 * If either parameter is NULL, -1 is returned.
 */
The _connected_vertices_count_recursive function takes a DirectedGraph* struct pointer
and a void* origin pointer to a vertex. This function recursively visits each vertex
traversable via the vertx's arc list that has already not been visited and counts the
number of vertices. The count of the number of vertices visited is returned to the client.
If either parameter is NULL, -1 is returned.
The _connected_vertices_count_recursive function takes a DirectedGraph * struct pointer and a void * origin pointer to a vertex . This function recursively visits each vertex traversable via the vertx ' s arc list that has already not been visited and counts the number of vertices . The count of the number of vertices visited is returned to the client . If either parameter is NULL - 1 is returned .
int _connected_vertices_count_recursive(DirectedGraph* graph, void* origin)
{
	if(graph == NULL || origin == NULL)
		return -1;
	int count     = 0;
	Vertex* start = get_vertex(graph, origin);
	if(!(been_visited(start)))
	{
		set_visited(start, true);
		count            = 1;
		LinkedList* list = get_arc_list(start);  
		for(int i = 0; i < linked_list_size(list); i++)
		{
			Arc* arc = (Arc*) linked_list_get(list, i);
			if(!(been_visited(arc->vertex)))
			{	
				void* ptr = (void*) arc->vertex->data;				
				count    += _connected_vertices_count_recursive(graph, ptr);	
			}
		}		
	}
	return count;
}
int _connected_vertices_count_recursive ( DirectedGraph * graph , void * origin ) { if ( graph == NULL || origin == NULL ) return -1 ; int count = 0 ; Vertex * start = get_vertex ( graph , origin ) ; if ( ! ( been_visited ( start ) ) ) { set_visited ( start , true ) ; count = 1 ; LinkedList * list = get_arc_list ( start ) ; for ( int i = 0 ; i < linked_list_size ( list ) ; i ++ ) { Arc * arc = ( Arc * ) linked_list_get ( list , i ) ; if ( ! ( been_visited ( arc -> vertex ) ) ) { void * ptr = ( void * ) arc -> vertex -> data ; count += _connected_vertices_count_recursive ( graph , ptr ) ; } } } return count ; }
The _connected_vertices_count_recursive function takes a DirectedGraph* struct pointer
 and a void* origin pointer to a vertex.
The _connected_vertices_count_recursive function takes a DirectedGraph * struct pointer and a void * origin pointer to a vertex .
// If either parameter is NULL, return -1. // Temporary count and start vertex variables. // If this start vertex has not been visited. /*
 		 * Set this start vertex visited flag to true, count assigned to 1, 
 		 * and retrieve the arc list of this vertex.
 		 */ // For each arc in this vertex's arc list. // Retrieve the arc struct at index i. // If the vertex in the arc struct has not been visited. // Cast the data of this vertex to a void pointer local variable. // count in incremented by a call to connected_vertices_count_recursive function.