Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Draw graphs in prolog

2 views
Skip to first unread message

HeaD

unread,
Jul 4, 2008, 4:08:39 AM7/4/08
to
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. =)

Jan Wielemaker

unread,
Jul 4, 2008, 4:34:28 AM7/4/08
to

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

HeaD

unread,
Jul 4, 2008, 4:42:07 AM7/4/08
to
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.

Jan Wielemaker

unread,
Jul 4, 2008, 8:28:20 AM7/4/08
to
On 2008-07-04, HeaD <a_ie...@NOvirgilio.it> wrote:

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

0 new messages