digraph/directed_graph.c
/*
 * The dijkstra function below constructs a shortest path within the DirectedGraph* struct 
 * from the void* origin vertex to the void* destination vertex. A LinkedList* of Vertex structs 
 * of this shotest path is returned to the client. Note: the returned LinkedList* is linear 
 * from origin vertex to destination vertex.
 */
The dijkstra function below constructs a shortest path within the DirectedGraph* struct
from the void* origin vertex to the void* destination vertex. A LinkedList* of Vertex structs
of this shotest path is returned to the client. Note: the returned LinkedList* is linear
from origin vertex to destination vertex.
The dijkstra function below constructs a shortest path within the DirectedGraph * struct from the void * origin vertex to the void * destination vertex . A LinkedList * of Vertex structs of this shotest path is returned to the client . Note : the returned LinkedList * is linear from origin vertex to destination vertex .
LinkedList* dijkstra(DirectedGraph* graph, void* origin, void* destination)
{
	if(graph == NULL || origin == NULL || destination == NULL)
		return NULL;
	LinkedList* vList = linked_list_initialize(sizeof(Vertex), "Vertex");
	buildTree(graph, origin);
	Vertex* end = get_vertex(graph, destination);
	while(end != NULL)
	{
		linked_list_add_first(vList, end); 
		end = get_vertex_parent(end);
	}	
	reset_parent_links(graph);
	set_visited_field(graph, false);
	return vList;
}
LinkedList * dijkstra ( DirectedGraph * graph , void * origin , void * destination ) { if ( graph == NULL || origin == NULL || destination == NULL ) return NULL ; LinkedList * vList = linked_list_initialize ( sizeof ( Vertex ) , " " ) ; buildTree ( graph , origin ) ; Vertex * end = get_vertex ( graph , destination ) ; while ( end != NULL ) { linked_list_add_first ( vList , end ) ; end = get_vertex_parent ( end ) ; } reset_parent_links ( graph ) ; set_visited_field ( graph , false ) ; return vList ; }
The dijkstra function below constructs a shortest path within the DirectedGraph* struct
 from the void* origin vertex to the void* destination vertex.
The dijkstra function below constructs a shortest path within the DirectedGraph * struct from the void * origin vertex to the void * destination vertex .
// Instantiate a Linkedlist struct to hold Vertex pointers. // Call to build a tree of parent links from the origin vertex within the Directed Graph. // Retrieve the destination vertex from the Directed Graph.  // While the end vertex variable is not NULL. // Add the end variable vertex reference to the linkedlist struct. // The end variable is updated to be the parent reference of the previous end variable. // Reset all parent links and the visited field of each vertex to false. // Return the vertex list of the shortest path, in order, from origin vertex to destination vertex.