GithubHelp home page GithubHelp logo

justcoding121 / advanced-algorithms Goto Github PK

View Code? Open in Web Editor NEW
1.3K 60.0 287.0 6.41 MB

100+ algorithms & data structures generically implemented in C#

License: MIT License

C# 100.00%
csharp algorithms binary-trees heap sorting-algorithms avl-tree red-black-tree fibonacci-heap pairing-heap splaytrees

advanced-algorithms's People

Contributors

admalexus avatar buildbot171 avatar github-actions[bot] avatar justcoding121 avatar tvildo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

advanced-algorithms's Issues

Graph Clone

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).

FloydWarshallShortestPathOperators() (and others) not found

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!

API Documentation

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.

HopcroftKarpMatching Bug

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:

https://github.com/justcoding121/Advanced-Algorithms/blob/0e1b90aaf322104ec9bdf7e5b4ab55a39e920aed/src/Advanced.Algorithms/Graph/Matching/HopcroftKarp.cs#L57

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

Non weighted graph algorithms on weighted graphs

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.

BloomFilter with string doesn't work with .Net Core

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

BentleyOttmann: not all intersections are reported.

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

image

Dijikstra TracePath bug

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.