Quantcast
Viewing all articles
Browse latest Browse all 4386

New Post: Problem with duplicate vertices

Our posts crossed paths.

Your approach is somewhat similar to what I suggested, but you are not using the Dictionary correctly. By iterating through it you are defeating its purpose, which it to provide quick lookups. Use Dictionary.TryGetValue() instead. And if you use a Dictionary, you do not also need to use Graph.Vertices.Contains().

Also, I hope you are not implementing the same code twice, once for each vertex. Create one GetOrAddVertex() function instead, and call it twice.

-- Tony

Viewing all articles
Browse latest Browse all 4386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>