[eclipse-clp-users] Modifying node attributes in lib(graphviz)

From: Justin W <jusw85_at_hotmail.com>
Date: Mon, 13 Apr 2009 22:20:18 +0800
The following is sample code for modifying node attributes when visualising a graph using lib(graphviz).

node_colour(Graph, Node, Attrs) :-
	( Node = 1 -> Attrs = [color=red] ; true ).

?- make_random_graph(5, 10, true, true, true, G), 
   view_graph(G, [node_attrs_generator:node_colour]).

Attrs is a list of Name=Value pairs that specify the attributes of the node.
The list of attributes can be found at the following website:

So for example, the following is valid and works perfectly fine:
Attrs = [color=red, height=1.00, label=node1]

and the corresponding line in the dot file generated by Eclipse:
1 [label=node1, color=red, height="1.00", pos="63,108", width="0.75"];

The problem I have is specifying the pos, or coordinate attribute of the node, which is of type point.

I've tried all of the following, and either I error out, or the position attribute isn't biting.
Attrs = [pos="1,1"]
Attrs = [pos='1,1']
Attrs = [pos=1,1]
Attrs = [pos=[1,1]]
Attrs = [pos=[](1,1)]
Attrs = [pos=(1,1)]

Any help?


What can you do with the new Windows Live? Find out
Received on Mon Apr 13 2009 - 14:20:23 CEST

This archive was generated by hypermail 2.2.0 : Thu Feb 02 2012 - 02:31:58 CET