unbbayes.util
Class GraphLayoutUtil

java.lang.Object
  extended by unbbayes.util.GraphLayoutUtil

public class GraphLayoutUtil
extends Object


Field Summary
protected  List<List<Node>> graphLevelMatrix
           
protected  Network network
           
protected  boolean[] nodeAddedList
           
protected  HashMap<Node,Integer> nodeIndexMap
           
protected  int[] nodeLevelList
           
 
Constructor Summary
GraphLayoutUtil(Network network)
           
 
Method Summary
protected  boolean addChildrenToNextLevel(ArrayList<Node> children, List<Node> nodeList)
          Take the children of a node that have already been added to the queue.
protected  void createGraphLevelMatrix()
          Creates the queue of the nodes that are going to be analyzed.
 void doLayout()
           
protected  void initGraphLevelMatrix()
          Initializes the queue with the nodes that are root.
protected  boolean wereAllNodesAdded()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

network

protected Network network

graphLevelMatrix

protected List<List<Node>> graphLevelMatrix

nodeIndexMap

protected HashMap<Node,Integer> nodeIndexMap

nodeAddedList

protected boolean[] nodeAddedList

nodeLevelList

protected int[] nodeLevelList
Constructor Detail

GraphLayoutUtil

public GraphLayoutUtil(Network network)
Method Detail

doLayout

public void doLayout()

createGraphLevelMatrix

protected void createGraphLevelMatrix()
Creates the queue of the nodes that are going to be analyzed.


wereAllNodesAdded

protected boolean wereAllNodesAdded()

initGraphLevelMatrix

protected void initGraphLevelMatrix()
Initializes the queue with the nodes that are root. In other words. It will put in the queue the nodes that do not have parents.

Parameters:
nodeAddedList - Keeps track of the nodes that have already been added to the queue (nodeAddedList[nodeIndex]=true).

addChildrenToNextLevel

protected boolean addChildrenToNextLevel(ArrayList<Node> children,
                                         List<Node> nodeList)
Take the children of a node that have already been added to the queue. Analyze them one by one and add the child that is not in the queue yet.

Parameters:
children - Children of a node that is already in the queue.
nodeAddedList - Nodes that have already been added to the queue.


Copyright © 2001-2010 University of Brasilia - UnB. All Rights Reserved.