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

From: Justin W <jusw85_at_...32...>
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:
http://www.graphviz.org/doc/info/attrs.html

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.
http://www.graphviz.org/doc/info/attrs.html#d:pos
http://www.graphviz.org/doc/info/attrs.html#k: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?

Regards,
Justin

_________________________________________________________________
What can you do with the new Windows Live? Find out
http://www.microsoft.com/windows/windowslive/default.aspx
Received on Mon Apr 13 2009 - 14:20:23 CEST

This archive was generated by hypermail 2.3.0 : Tue Apr 16 2024 - 09:13:20 CEST