how to add information to an edge? 
Author Message
 how to add information to an edge?

Hello,

how can I add some information to an edge of an graph? Exists there an
attribute, which I can use for a line, which connects two nodes? I use the
method :


      new(link(in, out, line(arrows := second)))).

to connect the nodes.

many thanks,

Marbod Hopfner



Sun, 12 Dec 2004 16:49:07 GMT  
 how to add information to an edge?

Quote:

> Hello,

> how can I add some information to an edge of an graph? Exists there an
> attribute, which I can use for a line, which connects two nodes? I use the
> method :


>       new(link(in, out, line(arrows := second)))).

> to connect the nodes.

> many thanks,

> Marbod Hopfner

Its not really clear what you want.  In general you can add `payload'
information to any object in two ways: subclass the class and add more
instance-variables or attach instance-level attributes to it.

For example:

:- pce_begin_class(mybox, box).

variable(payload, prolog, both, "Associated payload").

:- pce_end_class(mybox).

        ...,
        new(X, mybox),
        send(X, payload, hello(world)),

Or:

        ...,
        new(X, box),
        send(X, attribute, payload, prolog(hello(world))),

Links and connections are a bit tricky and depend on how you create
the relation.  For example:


        send(C, attribute, payload, prolog(hello(world))),

after which you can do

payload(Box1, Box2, Payload) :-
        get(Box1, connections, Box2, Connections),
        get(Connections, size, 1),      % ensure there is 1
        get(Connections, head, C),
        get(C, payload, Payload).

        Cheers --- Jan



Sun, 12 Dec 2004 20:08:47 GMT  
 how to add information to an edge?
Hello Jan,

It wasn't really what I wanted, but your suggestion gave me some new idea,
which is much more better than my old idea.

Many thanks

Kind Regards
Marbod

Quote:
----- Original Message -----

Newsgroups: comp.lang.prolog
Sent: Wednesday, June 26, 2002 2:08 PM
Subject: Re: how to add information to an edge?


> > Hello,

> > how can I add some information to an edge of an graph? Exists there an
> > attribute, which I can use for a line, which connects two nodes? I use
the
> > method :


> >       new(link(in, out, line(arrows := second)))).

> > to connect the nodes.

> > many thanks,

> > Marbod Hopfner

> Its not really clear what you want.  In general you can add `payload'
> information to any object in two ways: subclass the class and add more
> instance-variables or attach instance-level attributes to it.

> For example:

> :- pce_begin_class(mybox, box).

> variable(payload, prolog, both, "Associated payload").

> :- pce_end_class(mybox).

> ...,
> new(X, mybox),
> send(X, payload, hello(world)),

> Or:

> ...,
> new(X, box),
> send(X, attribute, payload, prolog(hello(world))),

> Links and connections are a bit tricky and depend on how you create
> the relation.  For example:


> send(C, attribute, payload, prolog(hello(world))),

> after which you can do

> payload(Box1, Box2, Payload) :-
> get(Box1, connections, Box2, Connections),
> get(Connections, size, 1), % ensure there is 1
> get(Connections, head, C),
> get(C, payload, Payload).

> Cheers --- Jan



Mon, 13 Dec 2004 16:37:07 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. printercode edge to edge

2. I need to manipulate only X values of Edge coordinates (IMAQ Find Vertical Edge VI)

3. USE both rising edge and falling edge

4. USE both rising edge and falling edge

5. Product Update CWRES 2.0 - Add version information to Clarion EXEs

6. Add version information to your Clarion EXEs

7. adding information with EAI

8. Adding/Changing expiration and serial information in programs

9. Adding hour and minute information

10. Cannot Add Header Information Error

11. Cannot add header information

12. Req: any information about retrieving register information of CPU

 

 
Powered by phpBB® Forum Software