zrwusa / data-structure-typed

Javascript Data Structure & TypeScript Data Structure. Heap, Binary Tree, Red Black Tree, Linked List, Deque, Trie, HashMap, Directed Graph, Undirected Graph, Binary Search Tree, AVL Tree, Priority Queue, Graph, Queue, Tree Multiset, Singly Linked List, Doubly Linked List, Max Heap, Max Priority Queue, Min Heap, Min Priority Queue, Stack.
https://data-structure-typed-docs.vercel.app
MIT License
114 stars 8 forks source link

Removing an edge of a DirectedGraph deletes additional edges #52

Closed rkrump closed 9 months ago

rkrump commented 9 months ago

Describe the bug When using deleteEdge(edge) it deletes all outgoing edges of the source vertex and all incoming edges of destination vertex. This is not the case for deleteEdgeSrcToDest(src, dest).

To Reproduce

  1. Create a graph with the vertices "hello", "hi", "hey"
  2. Create the edges "hello"->"hi", "hello"->"hey"
  3. Delete the edge "hello"->"hi"
  4. The edge "hello"->"hey" has been deleted even though that was not requested

Expected behavior Only the specified edge should be deleted.

Desktop (please complete the following information):

Additional context directed-graph.ts#L201 directed-graph.ts#L206

zrwusa commented 9 months ago

This bug was fixed in version 1.48.4.