Forums

Full Version: problem with placing newly added nodes in the visualization
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello prefusians,

I have a node positioning issue with the attachted program, which implements a dynamically growing graph.

In this program a new set of nodes is always connected to one random node of the existing graph. The idea is to set the new nodes close to the node they are connected with in order to make the graph unfolding nice. The position of the new nodes is set with
Code:
PrefuseLib.setX(aNodeItem,null,connectorX);
PrefuseLib.setY(aNodeItem,null,connectorY);
where aNodeItem is the newly added node item and connectorX and connectorY are the position of the connecting node.

This works fine most of the time but when the graph grows during the course of the program sometimes this position setting doesn't seem to have any effect, nodes are placed far from the connecting node. Also the prefuse ActicvityManager is complaining sometimes.

Any suggestions how to deal with this problem are highly appreciated.

Thanks

martin


You might have to play around with the two variables
Code:
public static final int NODES_PER_ROUND = 17;
public static final int MILISEC_BETWEEN_ROUNDS = 500;
to see the undesired effect.
Some improvements quickly posted
  • stopping the running actions before modifying the graph
  • synchronizing the method in which the graph modification happens
  • synchronizing the getVisualItem() method of the Visualization class

This means don't solve the problem but lessen the undesired effect, which is nice but not what was desired. I don't think they are actually hitting the point, the problem seems to occur on a much deeper level as pointed out by NomadNZ in the sourceforge forum http://sourceforge.net/forum/forum.php?t..._id=343013
Good morning,

incredible, after dynamic node adding/removing being an open issue for so long now there seems to be a solution around, at least it works for this demo program here. The solution was provided by Pierre Mudry in the prefuse sourceforge forum

http://sourceforge.net/forum/message.php?msg_id=5063232


Great, thanks a lot Pierre

martin


ps The solution applied to this demo program is attached to this thread - as mentioned by Pierre, cancelling of the running actions is not necessary!
Reference URL's