Move node in the same aggregate

  • David Lechevalier

    Hello everybody,

    I build dynamically several aggregates. How can I move the nodes which are in the same aggregate in order to them to be close each other when I build this aggregate?

    thank you in advance,

  • Björn Kruse

    Björn Kruse - 2012-05-26


    aggregates are just drawn around the nodes they contain. So simply lay out the nodes as desired.

    Hope it's that easy,

  • David Lechevalier

    Thank you for you answer.

    I use the ForcedDirectedLayout and I suppose it automatically lays out itself the nodes thanks to  a private function named updateNodePosition. So if I want to keep and to extend the ForcedDirectedLayout, I can't overwrite this function as it is private.
    So do you have an idea to lay out the nodes in keeping the ForcedDirectedLayout?

    Thamk you

  • Björn Kruse

    Björn Kruse - 2012-05-29

    Ah, ForceDirectedLayout, ok.
    With some of the parameters, you can configure how strong nodes appeal each other or not.
    One of the demos with FDL has a side pane on the right where you can play with some parameters (spring length, etc., I really can't remember…).

    Also a little more advanced idea:
    - differentiate between the edges that are between two nodes in the same aggregate and between edges that connect two nodes in differen (or only one) aggregate
    - use this to return different springs or forces for the different types of edges (maybe put it as a flag in a custom datafield of the edges)

    Sorry, I can't remember whether ForceSimulator or something else is the point where you need to dig in deeper…

    best regards,

  • David Lechevalier

    I was thinking about the ForceSimulator. Indeed, I can change the gravitational attractivity but there is no edge between two nodes in the same aggregate.  2 nodes can be in the same aggregate, but not especially link each other.

    So I think that as they aren't linked themselves together, it depends on the order in which the nodes are drawn?

    I can start by the node from the aggregate A then the nodes from the aggregate B etc…

    Does that make sense for you?

  • Björn Kruse

    Björn Kruse - 2012-05-29

    Hmm, what depends on the order?
    And what do you mean by "start by node from aggregate A"?

    If you want to stick with (the animated, cool) FDL, maybe add "fake" edges between the nodes in one aggregate and set those fake-edges invisible?

    regards, Björn

  • David Lechevalier

    I mean that if I start by drawn the nodes which are in the same aggregate, they will be close to each other no?

  • David Lechevalier


    I try to implement the method to build invisible edge. But if the edges are invisble (with the method setVisible), the Visualization makes like there was no edge. Do I have to use another function or another way of building these edges?

  • Björn Kruse

    Björn Kruse - 2012-05-30

    I mean that if I start by drawn the nodes which are in the same aggregate, they will be close to each other no?

    I didn't fully get that (you don't draw nodes manually, do you? You mean the order of adding them to the graph?), but I think the answer is no.

    Yes, invisible edges are not taken into account by default.
    I overlooked that, sorry. Better make visible edges, where the colorAction assigns a fully transparent color to them   ; )
    Also good for debugging, as in a first step you can set them to semi-transparent.

    I suggest to "mark" those edges. Create a (boolean) datafield on the edge table, named like "isSpecialLayoutEdge", and set it to true for the edges you added for the layout. Then you can easily write predicates or expressions to use in ColorActions, SizeAction, etc.

    hope that helps,

  • David Lechevalier

    Finally, I use your method which consists in add fake edge. It works good.

    Thank you for your help

  • Amendra

    Amendra - 2012-09-11

    Dear leda06,

    I have built an application using java and perfuse which visualizes the users and their friends network. I have used ForcedDirectedLayout and animated the graph. I have made the users as node and their friend network as edges of graph.
    It is for sure that all of the user in network may not have friend. So, those users who do not have friends have no edges. So, those users without edges (i.e without any friends) are moving away towards infinity.
    I was thinking of giving fake edges to those nodes which do not have friend network so that they will be connected with any other user of network and stay with them. I read that you have done this. It would be great of you, if you could share your implementation.

    Thank You.



Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks