digraph/vertex.c
/*
 * Removes an arc going from the origin Vertex* to the destination Vertex*.
 * returns true if removes successfully.
 */
Removes an arc going from the origin Vertex* to the destination Vertex*.
returns true if removes successfully.
Removes an arc going from the origin Vertex * to the destination Vertex * . returns true if removes successfully .
bool remove_vertex_arc(Vertex* origin, Vertex* destination)
{
	if(origin == NULL || destination == NULL)
		return false;
	LinkedList* list = origin->arcList;
	int prevSize = linked_list_size(list);
	for(int i = 0; i < linked_list_size(list); i++)
	{
		Arc* arc = linked_list_get(list, i);
		Vertex* elem = (Vertex*) arc->vertex;
		if(elem == destination) 
		{
			linked_list_remove(list, i);
			break;
		}
	}
	if(prevSize - linked_list_size(list) == 1)
	{
		return true;
	}
	else
	{
		return false;
	}
}
bool remove_vertex_arc ( Vertex * origin , Vertex * destination ) { if ( origin == NULL || destination == NULL ) return false ; LinkedList * list = origin -> arcList ; int prevSize = linked_list_size ( list ) ; for ( int i = 0 ; i < linked_list_size ( list ) ; i ++ ) { Arc * arc = linked_list_get ( list , i ) ; Vertex * elem = ( Vertex * ) arc -> vertex ; if ( elem == destination ) { linked_list_remove ( list , i ) ; break ; } } if ( prevSize - linked_list_size ( list ) == 1 ) { return true ; } else { return false ; } }
Removes an arc going from the origin Vertex* to the destination Vertex*.
Removes an arc going from the origin Vertex * to the destination Vertex * .