Menu

ReingoldTilford layout

sam
2002-11-27
2002-11-27
  • sam

    sam - 2002-11-27

    yugen,

    I think the reason why the x-coordinate are 1.2 apart but the y-coordinate are 1 apart in ReingoldTilford layout is it add sthe default node size (0.2) to x-coordinate of the node. If I send the default node size to 0, then all x-coordinate are 1 apart. I am wonder why it does not add node size to y-coordinate to every node. Is this a bug?

    Also in ReingoldTilford.java,  the setLayerDistance() method is
    public void setLayerDistance(double baseDistance) {
        this.layerDistance = layerDistance;
      }
    should that be:
    public void setLayerDistance(double baseDistance) {
        this.layerDistance = baseDistance);
      }

    same as the constructor of StoredIterator,
    it is
      public StoredIterator(ListIterator theIterator) {
          super(null, null, null);
          theIterator = theIterator;
        }
    should that be:
      public StoredIterator(ListIterator theIterator) {
          super(null, null, null);
          this.theIterator = theIterator;
        }

     
    • yugen

      yugen - 2002-11-27

      > I think the reason why the x-coordinate are 1.2
      > apart but the y-coordinate are 1 apart in
      > ReingoldTilford layout is it add sthe default
      > node size (0.2) to x-coordinate of the node. If I
      > send the default node size to 0, then all x-coordinate
      > are 1 apart. I am wonder why it does not add > node size to y-coordinate to every node. Is this
      > a bug?

      It looks like it :)    However, in practice, this is unlikely to cause too much trouble since node sizes are typically small relative to the spaces between nodes.  But I will fix this -- thank you for looking into it.

      Your comments on setLayerDistance() and StoredIterator(ListIterator) also appear to be correct. These methods have not caused any problems because they are legacy methods that are not called anywhere in the current code base.  However, I will make the appropriate fixes.  Thanks for pointing this out!

       
    • sam

      sam - 2002-11-27

      Thanks. 

      In the Layout Class, it has method setDefaultNodeSize(), It seems to me the Layout method treats every node as a Square. Do you think the layout method should treat each node a Rectangle? It will be more generic?

      Sorry for keep asking you this. You mention a number of times that "node size are typically small relative to the space between nodes". Why you said that?

      As I mention earlier the if the layout algorithm gives me co-ordinate like these:
      x=1.0 y=0.0
      x=0.0 y=-1.0
      x=1.0 y=-1.0
      x=2.0 y=-1.0

      How should i translate when I draw it? If my node is 20 pixels wide and 10 pixels high, should I multiple x by a factor of 20 and y by a factor of 10? before I draw it?

      Thank you again.

      The layout method has getNodeSize() method,

       
      • yugen

        yugen - 2002-11-27

        > As I mention earlier the if the layout algorithm
        > gives me co-ordinate like these:
        >
        > x=1.0 y=0.0
        > x=0.0 y=-1.0
        > x=1.0 y=-1.0
        > x=2.0 y=-1.0

        > How should i translate when I draw it? If my
        > node is 20 pixels wide and 10 pixels
        > high, should I multiple x by a factor of 20 and y
        > by a factor of 10? before
        > draw it?

        See https://sourceforge.net/forum/message.php?msg_id=1773207 to start with, and then we can see if you have further questions.

         

Log in to post a comment.