justcoding121 / advanced-algorithms Goto Github PK
View Code? Open in Web Editor NEW100+ algorithms & data structures generically implemented in C#
License: MIT License
100+ algorithms & data structures generically implemented in C#
License: MIT License
Hi, the Bentley-Ottmann algorithm implementation seems to fail to detect all intersection points.
var lines = new List<Line>()
{
new Line(new Point(0.307769600445297, 0.496908523373729), new Point(0.752325133305194, 0.247345594804429)),
new Line(new Point(0.59643911784349, 0.212231021938953), new Point(0.936056684207198, 0.558365820701404)),
new Line(new Point(0.362570754886871, 0.145859633640321), new Point(0.837961102294718, 0.571770970510212)),
new Line(new Point(0.415960443865489, 0.216604132306112), new Point(0.746803699409032, 0.5559045125525)),
};
BentleyOttmann bentleyOttmann = new BentleyOttmann(7);
var count = bentleyOttmann.FindIntersections(lines).Count;
Console.WriteLine(count); // only 2 instead of 3
Hi, I need to perform Tarjan strongly components finding algorithm on a weighted directed graph. Is there any way to do that, except for manually trying to convert one graph to another? Thanks.
if (current.Point.X == point.X && current.Point.Y == point.Y) return current;
Given a simple fully connected bipartite graph K_{3,3} the maximum matching algorithm crashes with an error:
assuming U={A, B, C} and V={D, E, F}
the exception is raised in the following line:
System.ArgumentException: 'An item with the same key has already been added. Key: E'
Since rightMatch dictionary already contains a mapping between E and A the algorithm cannot add a mapping between E and C on top of it
Hi,
would it be possible for Clone() method on graphs to be public? Is there any reason why it's not at the moment?
For example I want to build one part of the graph (because it's static for my problem), but later I'd like to add some edges. I don't want to modify the static part of the graph because I will need it once more. Now I'm forced to Clone it myself and I don't even know how to do it, because I don't see any way of enumerating the vertices atm (only enumerating the vertex values).
Hi,
BloomFilter uses GetHashCode, which yields for strings no deterministic value.
This means every test returns true.
Advanced.Algorithms.DataStructures.BloomFilter<string> bloomFilter = new Advanced.Algorithms.DataStructures.BloomFilter<string>(10);
bloomFilter.AddKey("foo");
bloomFilter.AddKey("bar");
bloomFilter.AddKey("apple");
bloomFilter.AddKey("orange");
bloomFilter.AddKey("banana");
bloomFilter.KeyExists("bar").ShouldBe(true);
bloomFilter.KeyExists("ba111r").ShouldBe(true); // is true
bloomFilter.KeyExists("banana").ShouldBe(true);
bloomFilter.KeyExists("dfs11j").ShouldBe(false);`// is also true
tracePath method implementation not working for all Nullible types. While loop:
while (!currentV.Equals(default(T)) && !parentMap[currentV].Equals(default(T)))
Will throw null reference exception on null.equals(null)
https://en.wikipedia.org/wiki/Edmonds%27_algorithm implementation is missing. It would be great to have it altogether with other graph-related stuff.
Bentley-Ottman algorithm throws NullReferenceException with certain input.
Example input:
Line 1: 100, 0; 150, 130
Line 2: 20, 80; 80, 70
Line 3: 80, 70; 50, 100
The following graph is considered as not bipartite by the algorithm (which in reality is):
(0) -- (2)
(1) -- (3)
as in MColorer appears to be unable to color the disconnected graph using 2 colors.
Firstly, massive and heartfelt thanks for this great selection of algorithms I need to write my project. Been trying them out - saved me weeks of coding and testing.
For this (and the Dijkstra and possibly others) VS can't seem to locate the classes inherited from the abstract IShortestPathOperators in any of the using directives. I've tried quite a few. Not a massive problem as I copied the FloydWarshallShortestPathOperators class into my project from your online source code and all works well, but I figure you intended that they should be automatically available somewhere.
Anyway, thanks again, these are fantastic!
Any plans for targeting .NetStandard 1/2 and releasing all this great work as a NuGet package?
Thanks for this library! It is the best I have found on C# for this. I'd suggest you add some C# documentation on your main calls. Although comments usually are a bad practice, for libraries they really help to understand the calls.
For example, by reading the code I could understand what the combination class does, but by reading the method name itself, I couldn't. It would be nice to provide at least a simple example of input/output. Nothing more.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.