Recent

Author Topic: Any way to visualize e.g. x-xxx K nodes and their relationshipts  (Read 818 times)

MISV

  • Hero Member
  • *****
  • Posts: 632
What i am looking for is something like this:

https://www.google.com/search?q=visualize+nodes+graph

It does not have to be perfect and I can mold the data, so it fits the graphing cpabilities


wp

  • Hero Member
  • *****
  • Posts: 6235
Re: Any way to visualize e.g. x-xxx K nodes and their relationshipts
« Reply #1 on: June 29, 2019, 10:43:08 am »
Not ready-made. Maybe you can start with the TBubbleSeries which draws circles at arbitrary points, circle radius and position are taken from the ChartSource assigned to the series. It does not draw the links, though - you'll have to do this by yourself.

Documentation: https://wiki.lazarus.freepascal.org/TAChart_documentation#Bubble_series
Demo: (lazarus)/components/tachart/demo/multi/ (https://wiki.lazarus.freepascal.org/TAChart_Demos#multi)
« Last Edit: June 29, 2019, 11:02:59 am by wp »
Lazarus trunk / fpc 3.0.4 / all 32-bit on Win-10

howardpc

  • Hero Member
  • *****
  • Posts: 3153
Re: Any way to visualize e.g. x-xxx K nodes and their relationshipts
« Reply #2 on: June 29, 2019, 11:05:06 am »
You might find the TLvlGraphControl Mattias wrote for the Package Graph functionality in the IDE a good starting point.
$(lazarus)/components/lazcontrols/lvlgraphctrl.pas

julkas

  • Sr. Member
  • ****
  • Posts: 383
  • KISS principle / Lazarus 2.0.0 / FPC 3.0.4
Re: Any way to visualize e.g. x-xxx K nodes and their relationshipts
« Reply #3 on: June 29, 2019, 03:22:31 pm »
@MISV Can you describe requirements for application in more details? What is your goal? Desktop or web, interactivity, …? Why your post under TAChart?
« Last Edit: June 29, 2019, 03:31:39 pm by julkas »
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: 1689
    • Additional info
Re: Any way to visualize e.g. x-xxx K nodes and their relationshipts
« Reply #4 on: June 29, 2019, 05:21:03 pm »
Maybe using something external like GraphViz could fit? https://www.graphviz.org/gallery/
or adaptation of PasViz and PUDGB? https://forum.lazarus.freepascal.org/index.php/topic,34040.msg222027.html

ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

julkas

  • Sr. Member
  • ****
  • Posts: 383
  • KISS principle / Lazarus 2.0.0 / FPC 3.0.4
Re: Any way to visualize e.g. x-xxx K nodes and their relationshipts
« Reply #5 on: June 29, 2019, 05:41:45 pm »
Maybe using something external like GraphViz could fit? https://www.graphviz.org/gallery/
I agree. Great starting point. +5.
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;

MISV

  • Hero Member
  • *****
  • Posts: 632
Re: Any way to visualize e.g. x-xxx K nodes and their relationshipts
« Reply #6 on: June 29, 2019, 07:43:45 pm »
I want to map "hubs" and links in e.g. a million page website.

I am ok with e.g. "only" handling 1000-10000 pages websites - but generating a dot file for graphviz ... unfortunately rendering takes ages with e.g. 1000 pages website - even when simplifying the data a lot and tried a lot of different renderings and settings.

I also tried Gephi feeding it my dot files and was quite surprised I was not able to get decent results with that. That has to be my fault. That said, I would prefer being able to ship the functionality internally in my app. (i.e. not depend on user downloading 3rd party)

Additionally... And I know this is borderline unreasonable, in a dream world I would also like to move/rerender in a 3D plane - but that is not essential if the initial graph is good.

The goal is to visualize all the import "hubs" in the website based on internal linking.

I was hoping maybe TAChart had something... best bet. Google searching for Delhi/Lazarus give zero results.

There are some impressive examples in other languages (even web)
https://medium.com/neo4j/visualizing-graphs-in-3d-with-webgl-9adaaff6fe43
https://medium.com/kineviz-blog/visualizing-node-link-graphs-84a40a9b2fcc

The best result I got sofar with graphviz is attached - but that data is highly simplified + small website.

... That said I know my request is very niche.

Maybe CastleEngine or things similar to that would almost be more appropriate. I am a noob at 3D, but possibly a fun and educating project if I got time some day.
« Last Edit: June 29, 2019, 08:39:14 pm by MISV »

wp

  • Hero Member
  • *****
  • Posts: 6235
Re: Any way to visualize e.g. x-xxx K nodes and their relationshipts
« Reply #7 on: June 29, 2019, 10:39:28 pm »
These are nice pictures, but I must confess that I do not understand this kind of visualization... Please give me a short tutorial: I assume that the nodes are the bubbles in TAChart's TBubbleSeries. What are the criteria where the nodes/bubbles are placed? What determines the size of the bubbles? Maybe the number of links going to other nodes so that an "important" node will be large, an "unimportant" link small? The color probably is used for some kind of grouping? How does the user know which information is associated with each node? Do the nodes have to be clicked (or the mouse moved over it) to see a small popup window with descriptive information? In this case of user interaction all the "dead" visualizations given in the examples are nothing but nice images. Can you present a small set of input data so that I can understand the basics?
Lazarus trunk / fpc 3.0.4 / all 32-bit on Win-10

MISV

  • Hero Member
  • *****
  • Posts: 632
Re: Any way to visualize e.g. x-xxx K nodes and their relationshipts
« Reply #8 on: July 01, 2019, 08:56:49 pm »
The attached screenshot is not TAChart but instead from graphviz someone suggested (which I do not like - I find it confusing in various ways)

I would like those "bubbles" designated to be important to be larger.

And then I would like to have at least the "most value passing" "connectors" between the "bubbles" to be drawn as well.
« Last Edit: July 01, 2019, 09:13:03 pm by MISV »

440bx

  • Hero Member
  • *****
  • Posts: 1131
Re: Any way to visualize e.g. x-xxx K nodes and their relationshipts
« Reply #9 on: July 01, 2019, 09:44:38 pm »
What i am looking for is something like this:

https://www.google.com/search?q=visualize+nodes+graph

It does not have to be perfect and I can mold the data, so it fits the graphing cpabilities
The best way I have seen of visualizing nodes and their relationships is using what's called an "activity on arrow" (AOA) graph.  Those are commonly used in PERT/CPM as they lend themselves very well to apply mathematical methods on the graph to optimize the project (increase parallelism among activities and lower the cost of the overall project as well as synchronizing resource availability with their usage.)

I've attached a picture of one of the many examples you can find using Google.  Unfortunately, I did not find an example of what I consider the optimal rendition of an AOA.  In what I consider an optimal rendition, activity arrows are always drawn horizontally and straight (no inclined arrows anywhere, no changes in direction) and "set completion arrows" (commonly referred to as "dummies") are always vertical.  A graph that satisfies those two conditions is extremely easy to read and understand regardless of project/relationship complexity.  Producing such an optimized graph can be difficult depending on the relationships among activities.

The sample attached, meets one of the requirements of such a graph, which is to have all the nodes vertically aligned and all activity arrows between two nodes, the same length (though in a project, part of the arrow will commonly be "dashed" to show a different start time and duration.)  The purpose of the vertical alignment and constant length among nodes is to make it easy to visualize the logical number of steps.  If the project is correctly optimized that number of steps is the absolute minimum number of steps required to go from the beginning to the end (start of project, end of project.)

Though most commonly used in project management, those graphs are extremely useful in other applications.

HTH.




using FPC v3.0.4 and Lazarus 1.8.2 on Windows 7 64bit.

MISV

  • Hero Member
  • *****
  • Posts: 632
Re: Any way to visualize e.g. x-xxx K nodes and their relationshipts
« Reply #10 on: July 02, 2019, 12:26:56 pm »
You might find the TLvlGraphControl Mattias wrote for the Package Graph functionality in the IDE a good starting point.
$(lazarus)/components/lazcontrols/lvlgraphctrl.pas

This looks as most promising suggestion sofar. I will give it a look! Thanks :)


wp

  • Hero Member
  • *****
  • Posts: 6235
Re: Any way to visualize e.g. x-xxx K nodes and their relationshipts
« Reply #11 on: July 02, 2019, 12:37:27 pm »
To assist you in applying the TLvlGraphControl I am posting a little helper project which I used to create the hierarchy images in the TAChart documentation (https://wiki.lazarus.freepascal.org/TAChart_documentation#Series, https://wiki.lazarus.freepascal.org/TAChart_documentation#Sources).

A mini tutorial can be found at http://www.pp4s.co.uk/main/tu-form-level-graph.html.
« Last Edit: July 02, 2019, 12:41:21 pm by wp »
Lazarus trunk / fpc 3.0.4 / all 32-bit on Win-10

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 5635
    • wiki
Re: Any way to visualize e.g. x-xxx K nodes and their relationshipts
« Reply #12 on: July 02, 2019, 02:00:13 pm »
One thiny you should be aware of with TLvlGraphControl.

If you use the autolayout, and you then want to add more nodes, you should add all nodes from scratch again.
Some positions are set, by autolayout, that are not cleared before the next autolayout, and can affect  the outcome.

One idea / future feature to solve this, is for the autolayout to create an internal copy. Then expose the user placement, and current placement through separate properties.