## SimpleGraph 2.0 Released!

Please post bug reports, feature requests, or any question regarding the DELPHI AREA projects here.
Kambiz wrote:Simply use the following code, to prevent links being used as a connection point.

Code: Select all
procedure TForm1.SimpleGraphObjectInsert(Graph: TSimpleGraph;  GraphObject: TGraphObject);begin  with GraphObject do    if IsLink then      Options := Options - [goLinkable];end;

Thats great. I take not of that. (Never thought of it beeing so simple).

BUT, what does it exactly do? It seems like event handler for onObjectInsert. So when I insert a link I prevent this link to accept other links on itself. Right??

kokkoras
Moderator

Posts: 317
Joined: March 12th, 2005, 11:19 pm
Location: Thessaloniki, Greece

Kambiz wrote:My gosh! Seems you don't like to write even a single line of code in your application, right? Dropping components on the form, setting properties, and voila!

Are you talking to me?? I am dying to find time for programming. Unfortunatly I have a thesis to write.

kokkoras
Moderator

Posts: 317
Joined: March 12th, 2005, 11:19 pm
Location: Thessaloniki, Greece

No, I was talking in general.
Kambiz

Kambiz

Posts: 2430
Joined: March 7th, 2003, 7:10 pm

kokkoras wrote:
Kambiz wrote:Simply use the following code, to prevent links being used as a connection point.

Code: Select all
procedure TForm1.SimpleGraphObjectInsert(Graph: TSimpleGraph;  GraphObject: TGraphObject);begin  with GraphObject do    if IsLink then      Options := Options - [goLinkable];end;

Thats great. I take not of that. (Never thought of it beeing so simple).

BUT, what does it exactly do? It seems like event handler for onObjectInsert. So when I insert a link I prevent this link to accept other links on itself. Right??

No, this causes the new inserted object cannot be used as a hook for the other links.

Another way you can prevent a link for being used as a hook is:

Code: Select all
procedure TForm1.SimpleGraphCanHookLink(Graph: TSimpleGraph;  GraphObject: TGraphObject; Link: TGraphLink; Index: Integer;  var CanHook: Boolean);begin  if GraphObject.IsLink then    CanHook := False;end;
Kambiz

Kambiz

Posts: 2430
Joined: March 7th, 2003, 7:10 pm

Kambiz wrote:No, this causes the new inserted object cannot be used as a hook for the other links. Another way you can prevent a link for being used as a hook is:

Code: Select all
procedure TForm1.SimpleGraphCanHookLink(Graph: TSimpleGraph;  GraphObject: TGraphObject; Link: TGraphLink; Index: Integer;  var CanHook: Boolean);begin  if GraphObject.IsLink then    CanHook := False;end;

So, I can easily prevent links over links, as well as certain nodes to accept links. Love it!

Other questions:
Can I have both versions installed? I guess I need a different name.
(No plan to use both in the same project of course).

kokkoras
Moderator

Posts: 317
Joined: March 12th, 2005, 11:19 pm
Location: Thessaloniki, Greece

Kambiz wrote:Whenever it was saved to place a field in protected or public section, they are there. And, whenever it was possible I've provided a protected method for accessing to the private field. The remained private fields are really private variables an because of that without F prefix.

Naturally, one can choose to name anything <b><i>anything</b></i> other than reseved keywords, but my point in suggesting prefixing <b><i>all</b></i> private variables with an 'F' is merely to do with conssitency. It helps a lot when you're reading someone else's code. In the case of TS, renaming them doesn't affect any functionality, but improves readability. Then again, it is your code.
Kambiz wrote:
Adem wrote:When there are a large number of nodes, it is very time consuming to iterate TSimpleGraph.Objects in order to find which node a particular node (TGraphNode) is linked to (and by what TGraphLink object).
Consider that since this release:
1. Links as well as nodes can be hooked to a link. So, if we define a list of hooked objects, it should be contain of all graph object types.
2. Two objects can connect together more than once. Because of that, you have to look again in all the objects to find all connections.
Maybe for some specific implementations we can use a list to speed up things, but in general it doesn't help so much.

There are three OnObjectHook, OnObjectUnhook, and OnLinkObjects events, and TGraphObjectList type that a host application can use it to build up a custom list of connected objects if needed.

Kambiz, you're defending a wrong design principle, <i>IMHO</i> and <i>with respect</i>.

An item (either a link or a node) should have all the information pertinent to itself in itself.

There is no significant difficulty in re-arranging the code to be that way; and, unless, by TSimpleGraph, what you really mean and emphasize is the <b><i>simple</b></i> part of it, the performance hit is <b>significant</b>.

One could use TSimpleGraph to depict a network (either a physical network, or a social network), or sitemap, or something similar and can easily come up with (hundreds of) thousands nodes.

There are very few things in TS that make it infeasible to use in such an application, the most important of which is <b>this</b>: You have to iterate all those objects to determine what uses what.

This information belongs with the item object; is static; does not change momentarily.. so, what rational is there to force the application to waste CPU power to retrieve it --Other than it is good enough for simple things.. and, that <b>it is <i>your</i> code</b>
Active Member

Posts: 22
Joined: February 20th, 2006, 12:47 pm

Hello
Thank you for the excellent work.

I am very happy for this work

Thank you kambiz.

Mirage
Junior Member

Posts: 44
Joined: October 26th, 2005, 11:41 am

Consider too that TSimpleGraph is becoming a very versatile component and there's not very much alternatives like this in Delphi. As for me I'll continue sending you comments and code; I'm conviced that soon you will see your component running in lots of applications.
elias
Senior Member

Posts: 90
Joined: November 8th, 2005, 12:09 pm
Location: Galicia, Spain

:) When I first found DelphiArea, I didn't Know I was going to become habitual; so I used a mail account to keeping from not desired mail, eliasbasura@hotmail.com; "basura" is a spanish word that comes to mean "rubbish"... Not my surname, how you thought when writting acknowledges. Now I can see in documentation a guy such "Elias Rubbish". ----Embarrassed :)
Last edited by elias on July 8th, 2008, 3:28 pm, edited 1 time in total.
elias
Senior Member

Posts: 90
Joined: November 8th, 2005, 12:09 pm
Location: Galicia, Spain

elias wrote:..."basura" is a spanish word that comes to mean "rubbish"... Not my surname, how you thought when writting acknowledges

I am LOL not because of your surname but about Kambiz's assumption.

BTW, my surname (kokkoras) means "Rooster" in greek.

Regarding TSimpleGraph, I searched a lot for quite some time. There is nothing similar of this quality. But I also believe that it must stay clean of any personal desire unless it fits the vision. Such representations are usually used to visualize some more or less serious ideas. I personally use them to draw semantic networs. I have no demant from Kambiz to implement specific features for me. If asked, I will vote YES only for features that can potencialy serve many users and do no harm to existing users.

Fotis Kokkoras

kokkoras
Moderator

Posts: 317
Joined: March 12th, 2005, 11:19 pm
Location: Thessaloniki, Greece

I'm so sorry elias. Soon we will have v2.1 of SimpleGraph, and this sor of bugs will be fixed too.

To be honest, I looked for the meaning of kokkoras but I couldn't find anything. Thanks for telling us its meaning.
Kambiz

Kambiz

Posts: 2430
Joined: March 7th, 2003, 7:10 pm

Kambiz wrote::lol: I'm so sorry elias. Soon we will have v2.1 of SimpleGraph, and this sor of bugs will be fixed too.

To be honest, I looked for the meaning of kokkoras but I couldn't find anything. Thanks for telling us its meaning.

I quess you will use the surname, not it's meaning

kokkoras
Moderator

Posts: 317
Joined: March 12th, 2005, 11:19 pm
Location: Thessaloniki, Greece

About having a list (or some lists) of linkes hooked to an object: I was not denying what Adem told. The subject is how we can make it more general. I make a new topic for this issue, let's have a survey about it.
Kambiz

Kambiz

Posts: 2430
Joined: March 7th, 2003, 7:10 pm

Kambiz wrote:About having a list (or some lists) of linkes hooked to an object: I was not denying what Adem told. The subject is how we can make it more general. I make a new topic for this issue, let's have a survey about it.

In my POV, the link owns the nodes. But if you want to traverse a graph optimaly, then you definitely need the node to know the links it hosts. But, all these have a managerial trade-off.

kokkoras
Moderator

Posts: 317
Joined: March 12th, 2005, 11:19 pm
Location: Thessaloniki, Greece

Here is the topic for the link issue:
http://www.delphiarea.com/forum/viewtopic.php?t=647
Kambiz

Kambiz