public class HierarchicalBCEngine extends java.lang.Object implements GraphConstants, LayoutEngine
There have been a few modifications made, however. The crossings function is changed as it was non-linear in time complexity. Furthermore, we don't have any interconnection matrices for each level, instead we just have one big interconnection matrix for the whole graph and a int[][] array which stores the vertices present in each level.
| Modifier and Type | Field and Description |
|---|---|
protected int[][] |
graphMatrix
Interconnection matrix for the graph
|
protected java.util.ArrayList<LayoutCompleteEventListener> |
layoutCompleteListeners
FastVector containing listeners for layoutCompleteEvent generated by this
LayoutEngine
|
protected boolean |
m_completeReLayout
This tells the the LayoutGraph method if a completeReLayout should be
performed when it is called.
|
protected javax.swing.JPanel |
m_controlsPanel
The panel containing extra options, specific to this LayoutEngine, for
greater control over layout of the graph
|
protected java.util.ArrayList<GraphEdge> |
m_edges |
protected javax.swing.JCheckBox |
m_jCbEdgeConcentration
controls edge concentration by concentrating multilple singular dummy child
nodes into one plural dummy child node
|
protected javax.swing.JRadioButton |
m_jRbBottomup |
protected javax.swing.JRadioButton |
m_jRbNaiveLayout |
protected javax.swing.JRadioButton |
m_jRbPriorityLayout |
protected javax.swing.JRadioButton |
m_jRbTopdown |
protected int |
m_nodeHeight
The nodeWidth and nodeHeight
|
protected java.util.ArrayList<GraphNode> |
m_nodes
FastVector containing nodes and edges
|
protected int |
m_nodeWidth
The nodeWidth and nodeHeight
|
protected javax.swing.JProgressBar |
m_progress
The progress bar to show the progress of the layout process
|
protected int[][] |
nodeLevels
Array containing the indices of nodes in each level.
|
DIRECTED, DOUBLE, NORMAL, PLURAL_DUMMY, REVERSED, SINGULAR_DUMMY| Constructor and Description |
|---|
HierarchicalBCEngine()
SimpleConstructor If we want to instantiate the class first, and if
information for nodes and edges is not available.
|
HierarchicalBCEngine(java.util.ArrayList<GraphNode> nodes,
java.util.ArrayList<GraphEdge> edges,
int nodeWidth,
int nodeHeight)
Constructor - takes in FastVectors of nodes and edges, and the initial
width and height of a node
|
HierarchicalBCEngine(java.util.ArrayList<GraphNode> nodes,
java.util.ArrayList<GraphEdge> edges,
int nodeWidth,
int nodeHeight,
boolean edgeConcentration)
Constructor - takes in FastVectors of nodes and edges, the initial width
and height of a node, and a boolean value to indicate if the edges should
be concentrated.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addLayoutCompleteEventListener(LayoutCompleteEventListener l)
Method to add a LayoutCompleteEventListener
|
protected void |
assignLevels(int[] levels,
int depth,
int i,
int j)
This method assigns a vertical level to each node.
|
protected float[] |
calcColBC(int lindex,
int[][] levels)
See Sugiyama et al. 1981 (full reference give at top)
|
protected float[] |
calcRowBC(int lindex,
int[][] levels)
See Sugiyama et al. 1981 (full reference give at top)
|
protected void |
clearTemps_and_EdgesFromNodes()
This method removes the temporary nodes that were added to fill in the
gaps, and removes all edges from all nodes in their edges[][] array
|
protected void |
copy2DArray(int[][] from,
int[][] to)
Copies one array of type int[][] to another.
|
protected void |
copyMatrix(int[][] from,
int[][] to)
Copies one Matrix of type int[][] to another.
|
protected int |
crossings(int[][] levels)
Computes the number of edge crossings in the whole graph Takes as an
argument levels of nodes.
|
void |
fireLayoutCompleteEvent(LayoutCompleteEvent e)
Fires a LayoutCompleteEvent.
|
javax.swing.JPanel |
getControlPanel()
This method returns a handle to the extra controls panel, so that the
visualizing class can add it to some of it's own gui panel.
|
java.util.ArrayList<GraphNode> |
getNodes()
give access to set of graph nodes
|
javax.swing.JProgressBar |
getProgressBar()
Returns a handle to the progressBar of this LayoutEngine.
|
protected static void |
isort(int[] level,
float[] BC)
This methods sorts the vertices in level[] according to their barycenters
in BC[], using insertion sort.
|
void |
layoutGraph()
This method does a complete layout of the graph which includes removing
cycles, assigning levels to nodes, reducing edge crossings and laying out
the vertices horizontally for better visibility.
|
protected int |
lBCenter(int lindex,
int eindex,
int[] horPositions) |
protected int |
lConnectivity(int lindex,
int eindex) |
protected void |
makeGUIPanel(boolean edgeConc)
This methods makes the gui extra controls panel "m_controlsPanel"
|
protected void |
makeProperHierarchy() |
protected void |
naiveLayout()
This method lays out the vertices horizontally, in each level.
|
protected void |
phaseID(int lindex,
int[][] levels)
See Sugiyama et al. 1981 (full reference give at top) lindex is the index
of the level we want to process.
|
void |
phaseIID(int lindex,
int[][] levels)
See Sugiyama et al. 1981 (full reference give at top)
|
void |
phaseIIU(int lindex,
int[][] levels)
See Sugiyama et al. 1981 (full reference give at top)
|
void |
phaseIU(int lindex,
int[][] levels)
See Sugiyama et al. 1981 (full reference give at top) lindex is the index
of the level we want to process.
|
protected void |
printMatrices(int[][] levels)
Prints out the interconnection matrix at each level.
|
protected void |
priorityLayout1()
This method lays out the vertices horizontally, in each level.
|
protected void |
processGraph()
This method makes the "graphMatrix" interconnection matrix for the graph
given by m_nodes and m_edges vectors.
|
protected void |
removeCycles()
The following two methods remove cycles from the graph.
|
void |
removeLayoutCompleteEventListener(LayoutCompleteEventListener e)
Method to remove a LayoutCompleteEventListener.
|
void |
setNodesEdges(java.util.ArrayList<GraphNode> nodes,
java.util.ArrayList<GraphEdge> edges)
Sets the nodes and edges for this LayoutEngine.
|
void |
setNodeSize(int nodeWidth,
int nodeHeight)
Sets the size of a node.
|
protected int |
uBCenter(int lindex,
int eindex,
int[] horPositions) |
protected int |
uConnectivity(int lindex,
int eindex) |
protected java.util.ArrayList<GraphNode> m_nodes
protected java.util.ArrayList<GraphEdge> m_edges
protected java.util.ArrayList<LayoutCompleteEventListener> layoutCompleteListeners
protected int[][] graphMatrix
protected int[][] nodeLevels
protected int m_nodeWidth
protected int m_nodeHeight
protected javax.swing.JRadioButton m_jRbNaiveLayout
protected javax.swing.JRadioButton m_jRbPriorityLayout
protected javax.swing.JRadioButton m_jRbTopdown
protected javax.swing.JRadioButton m_jRbBottomup
protected javax.swing.JCheckBox m_jCbEdgeConcentration
protected javax.swing.JPanel m_controlsPanel
protected javax.swing.JProgressBar m_progress
protected boolean m_completeReLayout
public HierarchicalBCEngine(java.util.ArrayList<GraphNode> nodes, java.util.ArrayList<GraphEdge> edges, int nodeWidth, int nodeHeight)
public HierarchicalBCEngine(java.util.ArrayList<GraphNode> nodes, java.util.ArrayList<GraphEdge> edges, int nodeWidth, int nodeHeight, boolean edgeConcentration)
nodes - - FastVector containing all the nodesedges - - FastVector containing all the edgesnodeWidth - - A node's allowed widthnodeHeight - - A node's allowed heightedgeConcentration - - True: if want to concentrate edges, False:
otherwisepublic HierarchicalBCEngine()
protected void makeGUIPanel(boolean edgeConc)
public java.util.ArrayList<GraphNode> getNodes()
getNodes in interface LayoutEnginepublic javax.swing.JPanel getControlPanel()
getControlPanel in interface LayoutEnginepublic javax.swing.JProgressBar getProgressBar()
getProgressBar in interface LayoutEnginepublic void setNodesEdges(java.util.ArrayList<GraphNode> nodes, java.util.ArrayList<GraphEdge> edges)
setNodesEdges in interface LayoutEnginenodes - - FastVector containing all the nodesedges - - FastVector containing all the edgespublic void setNodeSize(int nodeWidth,
int nodeHeight)
setNodeSize in interface LayoutEnginenodeWidth - - A node's allowed widthnodeHeight - - A node's allowed heightpublic void addLayoutCompleteEventListener(LayoutCompleteEventListener l)
addLayoutCompleteEventListener in interface LayoutEnginel - - Listener to receive the LayoutCompleteEvent by this class.public void removeLayoutCompleteEventListener(LayoutCompleteEventListener e)
removeLayoutCompleteEventListener in interface LayoutEnginee - - The LayoutCompleteEventListener to remove.public void fireLayoutCompleteEvent(LayoutCompleteEvent e)
fireLayoutCompleteEvent in interface LayoutEnginee - - The LayoutCompleteEvent to firepublic void layoutGraph()
The layout is performed in a separate thread and the progress bar of the class is updated for each of the steps as the process continues.
layoutGraph in interface LayoutEngineprotected void clearTemps_and_EdgesFromNodes()
protected void processGraph()
protected void makeProperHierarchy()
protected int crossings(int[][] levels)
protected void removeCycles()
protected void assignLevels(int[] levels,
int depth,
int i,
int j)
protected void phaseID(int lindex,
int[][] levels)
public void phaseIU(int lindex,
int[][] levels)
public void phaseIID(int lindex,
int[][] levels)
public void phaseIIU(int lindex,
int[][] levels)
protected float[] calcRowBC(int lindex,
int[][] levels)
protected float[] calcColBC(int lindex,
int[][] levels)
protected void printMatrices(int[][] levels)
protected static void isort(int[] level,
float[] BC)
protected void copyMatrix(int[][] from,
int[][] to)
protected void copy2DArray(int[][] from,
int[][] to)
protected void naiveLayout()
protected int uConnectivity(int lindex,
int eindex)
protected int lConnectivity(int lindex,
int eindex)
protected int uBCenter(int lindex,
int eindex,
int[] horPositions)
protected int lBCenter(int lindex,
int eindex,
int[] horPositions)
protected void priorityLayout1()