18

I need to implement a Diff algorithm in VB.NET to find the changes between two different versions of a piece of text. I've had a scout around the web and have found a couple of different algorithms.

Does anybody here know of a 'best' algorithm that I could implement?

Rais Alam
  • 6,970
  • 12
  • 53
  • 84
Chris Roberts
  • 18,622
  • 12
  • 60
  • 67
  • [Here's another good answer](http://stackoverflow.com/a/2817556/2388257) suitable to your question. – Hi-Angel Sep 27 '16 at 13:04

3 Answers3

7

Well I've used the c# version on codeproject and its really good for what I wanted...

http://www.codeproject.com/KB/recipes/diffengine.aspx

You can probably get this translated into VB.net via an online converter if you can't do it yourself...

Jeff Atwood
  • 63,320
  • 48
  • 150
  • 153
Calanus
  • 25,619
  • 25
  • 85
  • 120
  • This should be a comment, how got it accepted? There's no even mention what diff algorithm is used in the linked project. – Hi-Angel Sep 27 '16 at 12:58
7

I like An O(ND) Difference Algorithm and Its Variations by Eugene Myers. I believe it's the algorithm that was used in GNU diff. For a good background see Wikipedia.

This is quite theoretical and you might wish to find source code, but I'm not aware of any in VB.

Christian Lescuyer
  • 18,893
  • 5
  • 49
  • 45
3

I don't know for sure if it's the best diff algorithms but you might want to check out those links that talks about SOCT4 and SOCT6

http://dev.libresource.org/home/doc/so6-user-manual/concepts

and also:
http://www.loria.fr/~molli/pmwiki/uploads/Main/so6group03.pdf http://www.loria.fr/~molli/pmwiki/uploads/Main/diffalgo.pdf

Paul
  • 2,813
  • 2
  • 19
  • 12