powershell-algorithms icon indicating copy to clipboard operation
powershell-algorithms copied to clipboard

How about acyclic

Open cdhunt opened this issue 1 year ago • 1 comments

How would you implement a CheckCycle method with the Graph class. If I understand the code correctly, you are using GraphVertex.value as they key so duplicate values would make it cyclic.

https://github.com/dfinke/powershell-algorithms/blob/5e1f95b3111adb8c788786f773e63f087ac3d07b/src/data-structures/graph/Graph.ps1#L41

cdhunt avatar Mar 12 '24 18:03 cdhunt

Off the top of my had, maybe use a [System.Collections.Generic.HashSet] instead of an ordered dictionary

dfinke avatar Mar 13 '24 12:03 dfinke