CLIM mail archive


Duplicate Nodes in Graphs

    Date: Thu, 11 Jun 1992 21:51+0200
    From: Richard Hull <unido!!hull>

	Thanks to the people who responded to my question about formatting graphs
    in CLIM version 1.0 (basically it was: get CLIM version 1.1 and use the
    :merge-duplicates keyword).  But this still doesn't seem to work.  The call
    I'm making looks like the following: 

       #'(lambda( node ) (and (atom (first node)) (cdr node)))
       :merge-duplicates t
       :orientation ':vertical

    where tree is a list of the form ((a (b c d (e ...] and print-func is
    my function which uses clim:surrounding-output-with-border to display
    the node names in rectangles.

	For some reason the merge-duplicates keyword is not doing the job
    because I still have duplicate nodes.  What is interesting is if I set
    the merge-duplicates keyword to NIL, I still get the duplicate nodes
    but they are farther apart, almost as if when :merge-duplicates is
    t it tries to merge them but can't quite make it.  For example:

     :merge-duplicates t                       :merge-duplicates nil

	     A                                         A
	  /     \                                   /     \
	B         C                               B         C
	 \       /                                |         |
	  D     D                                 D         D

    Of course what I would like is:

	  /     \
	B         C 
	  \     /

    Do you have any ideas why this might be happening?  Thanks.

First, I urge you to provide the mailing list with running examples
when possible - like in this case. That makes it easier to reproduce
the behavior you observed.

However, I did not receive the behavior you described, instead the
normal, two expected layouts.
But maybe providing an appropriate :duplicates-test function could help
(the default is #`EQL wich might be too strict in your case):

  (list (cons 1 (list (cons 2 (list (cons 4 NIL)))
		      (cons 3 (list (cons 4 NIL))))))
  #'(lambda (node stream) (surrounding-output-with-border (stream)
			    (print (car node) stream)))
  #'(lambda (node) (if (atom node) NIL (cdr node)))
  :stream *standard-output*
  :merge-duplicates T
  :orientation :vertical)

I observed two more odd/buggy things about clim:format-graph-from-roots
you should consider in your work:
1) a blank character is added to any node - at least in my example
2) :cutoff-depth doesn't count the depth but instead the total number
of nodes, which is of course incorrect in the general case

Please note: All of my statements are valid for Symbolics CLIM 1.1 only.

Markus Fischer, MF@SGER.UUCP              Mergenthaler Allee 77-81
Consulting Services                       W-6236 Eschborn, Germany
Symbolics Systemhaus GmbH                 Phone: +49 6196 47220, Fax 481116


Main Index | Thread Index