Draw graphs in prolog

This is a discussion on Draw graphs in prolog within the PROLOG forums in Programming Languages category; Hi all. Is there an easy way to print out an adjacency list (for example: [[1,2],[1,3],[1,4],[1,5],[2,3],[2,4],[3,4],[4,5]]) as a graph? I use SWI-Prolog. Thanks in advance. =)...

Go Back   Application Development Forum > Programming Languages > PROLOG

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 07-04-2008, 04:08 AM
HeaD
Guest
 
Default Draw graphs in prolog

Hi all. Is there an easy way to print out an adjacency list (for
example: [[1,2],[1,3],[1,4],[1,5],[2,3],[2,4],[3,4],[4,5]]) as a graph?
I use SWI-Prolog.

Thanks in advance. =)
Reply With Quote
  #2  
Old 07-04-2008, 04:34 AM
Jan Wielemaker
Guest
 
Default Re: Draw graphs in prolog

On 2008-07-04, HeaD <a_ieloNO@NOvirgilio.it> wrote:
> Hi all. Is there an easy way to print out an adjacency list (for
> example: [[1,2],[1,3],[1,4],[1,5],[2,3],[2,4],[3,4],[4,5]]) as a graph?
> I use SWI-Prolog.
>
> Thanks in advance. =)


See the graphviewer demo from XPCE. Type

?- manpce.

Then use File/Demo programs, select 'GraphViewer'. You can
run it from there or fetch the source and tailor it to suit
your needs.

Alternatively, write a file for graphviz (dot) and run that.

Enjoy --- Jan
Reply With Quote
  #3  
Old 07-04-2008, 04:42 AM
HeaD
Guest
 
Default Re: Draw graphs in prolog

Jan Wielemaker ha scritto:
>
> See the graphviewer demo from XPCE. Type
>
> ?- manpce.
>
> Then use File/Demo programs, select 'GraphViewer'. You can
> run it from there or fetch the source and tailor it to suit
> your needs.
>
> Alternatively, write a file for graphviz (dot) and run that.
>
> Enjoy --- Jan


Thank you Jan!

I've just tried out the graph_viewer, but I'm a prolog newbie, is not so
simple for me and i cannot understand how it works. I need someting
easier. Is there an easier XPCE implementation for that?

I'll try graphviz. too, thanks.
Reply With Quote
  #4  
Old 07-04-2008, 08:28 AM
Jan Wielemaker
Guest
 
Default Re: Draw graphs in prolog

On 2008-07-04, HeaD <a_ieloNO@NOvirgilio.it> wrote:
> Jan Wielemaker ha scritto:
>>
>> See the graphviewer demo from XPCE. Type
>>
>> ?- manpce.
>>
>> Then use File/Demo programs, select 'GraphViewer'. You can
>> run it from there or fetch the source and tailor it to suit
>> your needs.
>>
>> Alternatively, write a file for graphviz (dot) and run that.
>>
>> Enjoy --- Jan

>
> Thank you Jan!
>
> I've just tried out the graph_viewer, but I'm a prolog newbie, is not so
> simple for me and i cannot understand how it works. I need someting
> easier. Is there an easier XPCE implementation for that?


It shouldn't be that hard to find the bits collecting the graph and
change them to your needs. Sure it can be done a lot shorter if you
remove the menus, user interaction and simplify the nodes. That is
left as an excercise to the user though :-)

> I'll try graphviz. too, thanks.


That will be comparable in complexity if you don't know graphviz syntax.

--- Jan
Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 04:32 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.