Recent

Author Topic: Graphs - Data structure (not graphics)  (Read 3706 times)

dgaspary

  • Jr. Member
  • **
  • Posts: 55
Graphs - Data structure (not graphics)
« on: July 09, 2014, 07:27:43 pm »
Hi.

Is there (maybe at FCL) this type of data structure and its algorithms?

Lazarus seems to have now some Graphs objects at LvlGraphCtrl Unit.

But they are related to LCL controls.

Thank you.

Leledumbo

  • Hero Member
  • *****
  • Posts: 8111
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Graphs - Data structure (not graphics)
« Reply #1 on: July 10, 2014, 10:04:04 am »
On my to do list, currently I've only implemented k-ary tree with depth & breadth first: http://svn.freepascal.org/svn/fpc/trunk/packages/fcl-stl/src/gtree.pp
Actually, I should've implemented graph in the first place, then make tree as a special case of graph. My knowledge is a bit weak on graph, though. I only got B- on the respective programming subject and even C (on the second attempt, first attempt was D) on the respective mathematical subject. There are just too many graph traversal algorithm...

dgaspary

  • Jr. Member
  • **
  • Posts: 55
Re: Graphs - Data structure (not graphics)
« Reply #2 on: July 10, 2014, 02:12:29 pm »
On my to do list, currently I've only implemented k-ary tree with depth & breadth first: http://svn.freepascal.org/svn/fpc/trunk/packages/fcl-stl/src/gtree.pp
Actually, I should've implemented graph in the first place, then make tree as a special case of graph. My knowledge is a bit weak on graph, though. I only got B- on the respective programming subject and even C (on the second attempt, first attempt was D) on the respective mathematical subject. There are just too many graph traversal algorithm...

I will take a look when I have some time. Thank you.

Basile B.

  • Guest
Re: Graphs - Data structure (not graphics)
« Reply #3 on: July 12, 2014, 04:02:30 pm »
You have an AVL tree somewhere in the FCL.

avra

  • Hero Member
  • *****
  • Posts: 1712
    • Additional info
Re: Graphs - Data structure (not graphics)
« Reply #4 on: September 02, 2019, 06:36:23 pm »
I also need graph data structure so I would like to know if there is anything new on this matter in FreePascal?
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

Thaddy

  • Hero Member
  • *****
  • Posts: 9167
Re: Graphs - Data structure (not graphics)
« Reply #5 on: September 02, 2019, 06:41:11 pm »
You have an AVL tree somewhere in the FCL.
In RTL-generics....Not FCL.
also related to equus asinus.

lucamar

  • Hero Member
  • *****
  • Posts: 2076
Re: Graphs - Data structure (not graphics)
« Reply #6 on: September 02, 2019, 06:45:51 pm »
You have an AVL tree somewhere in the FCL.
In RTL-generics....Not FCL.

There is one also in the FCL, in the unit: AVL_Tree
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus 2.0.2/2.0.4  - FPC 3.0.4 on:
(K|L)Ubuntu 12..16, Windows XP SP3, various DOSes.

julkas

  • Sr. Member
  • ****
  • Posts: 412
  • KISS principle / Lazarus 2.0.0 / FPC 3.0.4
Re: Graphs - Data structure (not graphics)
« Reply #7 on: September 02, 2019, 06:47:33 pm »
I also need graph data structure so I would like to know if there is anything new on this matter in FreePascal?
Check - https://github.com/avk959/LGenerics
procedure mulu64(a, b: QWORD; out clo, chi: QWORD); assembler;
asm
  mov rax, a
  mov rdx, b
  mul rdx
  mov [clo], rax
  mov [chi], rdx
end;

avra

  • Hero Member
  • *****
  • Posts: 1712
    • Additional info
Re: Graphs - Data structure (not graphics)
« Reply #8 on: September 03, 2019, 12:15:29 am »
I also need graph data structure so I would like to know if there is anything new on this matter in FreePascal?
Check - https://github.com/avk959/LGenerics
Thanks!  :D
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

julkas

  • Sr. Member
  • ****
  • Posts: 412
  • KISS principle / Lazarus 2.0.0 / FPC 3.0.4
Re: Graphs - Data structure (not graphics)
« Reply #9 on: September 03, 2019, 10:08:50 am »
Also (if you know Python) take a look here - https://github.com/ufkapano/graphs-dict
procedure mulu64(a, b: QWORD; out clo, chi: QWORD); assembler;
asm
  mov rax, a
  mov rdx, b
  mul rdx
  mov [clo], rax
  mov [chi], rdx
end;

zamtmn

  • Sr. Member
  • ****
  • Posts: 365
Re: Graphs - Data structure (not graphics)
« Reply #10 on: September 03, 2019, 10:23:07 am »

zamtmn

  • Sr. Member
  • ****
  • Posts: 365
Re: Graphs - Data structure (not graphics)
« Reply #11 on: September 03, 2019, 11:02:45 am »
Quote
Thanks but you did not read topic carefull enough. I was not looking for visual graphs, but for implementation of graph data structure explained here: https://en.wikipedia.org/wiki/Graph_(abstract_data_type)
This is not a visual library, only the implementation of graphs and algorithms over them.  See examples https://github.com/zamtmn/zcad/tree/master/cad_source/other/AGraphLaz/Test/Graph

avra

  • Hero Member
  • *****
  • Posts: 1712
    • Additional info
Re: Graphs - Data structure (not graphics)
« Reply #12 on: September 03, 2019, 11:08:47 am »
@zamtmn:
I did not look deeper as I probably should have. I deleted the post before I saw that you have already replied. I apologize for the inconvenience I made.

@all:
I have added LGenerics to the wiki page and mentioned that it supports graphs:
https://wiki.freepascal.org/Data_Structures,_Containers,_Collections
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

zamtmn

  • Sr. Member
  • ****
  • Posts: 365
Re: Graphs - Data structure (not graphics)
« Reply #13 on: September 03, 2019, 11:25:09 am »
avra
No problem.
Once upon a time I found this library. It is really powerful and convenient, implements many different mathematical algorithms. With the author I could not contact, all are very old contacts. I fixed some bugs related to 64 bit systems, and posted on github.
The only bad place is that the library was written long before the generics. And uses different hacks to implement generics functionality

jamie

  • Hero Member
  • *****
  • Posts: 2073
Re: Graphs - Data structure (not graphics)
« Reply #14 on: September 03, 2019, 06:03:18 pm »
Don't worry about not using generics, the only think you are missing is the bloat that comes with it.

 These are my own opinions of course from the peanut gallery.
Number 1 at blue screen app creations!