public class HierarchicalBCEngine extends 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 FastVector |
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 JPanel |
m_controlsPanel
The panel containing extra options,
specific to this LayoutEngine, for
greater control over layout of the graph
|
protected FastVector |
m_edges
FastVector containing nodes and edges
|
protected JCheckBox |
m_jCbEdgeConcentration
controls edge concentration by concentrating multilple singular dummy
child nodes into one plural dummy child node
|
protected JRadioButton |
m_jRbBottomup |
protected JRadioButton |
m_jRbNaiveLayout |
protected JRadioButton |
m_jRbPriorityLayout |
protected JRadioButton |
m_jRbTopdown |
protected int |
m_nodeHeight
The nodeWidth and nodeHeight
|
protected FastVector |
m_nodes
FastVector containing nodes and edges
|
protected int |
m_nodeWidth
The nodeWidth and nodeHeight
|
protected 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(FastVector nodes,
FastVector edges,
int nodeWidth,
int nodeHeight)
Constructor - takes in FastVectors of nodes and edges, and the initial
width and height of a node
|
HierarchicalBCEngine(FastVector nodes,
FastVector 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.
|
protected float[] |
calcRowBC(int lindex,
int[][] levels)
See Sugiyama et al.
|
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.
|
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.
|
FastVector |
getNodes()
give access to set of graph nodes
|
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.
|
void |
phaseIID(int lindex,
int[][] levels)
See Sugiyama et al.
|
void |
phaseIIU(int lindex,
int[][] levels)
See Sugiyama et al.
|
void |
phaseIU(int lindex,
int[][] levels)
See Sugiyama et al.
|
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(FastVector nodes,
FastVector 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 FastVector m_nodes
protected FastVector m_edges
protected FastVector layoutCompleteListeners
protected int[][] graphMatrix
protected int[][] nodeLevels
protected int m_nodeWidth
protected int m_nodeHeight
protected JRadioButton m_jRbNaiveLayout
protected JRadioButton m_jRbPriorityLayout
protected JRadioButton m_jRbTopdown
protected JRadioButton m_jRbBottomup
protected JCheckBox m_jCbEdgeConcentration
protected JPanel m_controlsPanel
protected JProgressBar m_progress
protected boolean m_completeReLayout
public HierarchicalBCEngine(FastVector nodes, FastVector edges, int nodeWidth, int nodeHeight)
public HierarchicalBCEngine(FastVector nodes, FastVector 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 FastVector getNodes()
getNodes
in interface LayoutEngine
public JPanel getControlPanel()
getControlPanel
in interface LayoutEngine
public JProgressBar getProgressBar()
getProgressBar
in interface LayoutEngine
public void setNodesEdges(FastVector nodes, FastVector edges)
setNodesEdges
in interface LayoutEngine
nodes
- - FastVector containing all the nodesedges
- - FastVector containing all the edgespublic void setNodeSize(int nodeWidth, int nodeHeight)
setNodeSize
in interface LayoutEngine
nodeWidth
- - A node's allowed widthnodeHeight
- - A node's allowed heightpublic void addLayoutCompleteEventListener(LayoutCompleteEventListener l)
addLayoutCompleteEventListener
in interface LayoutEngine
l
- - Listener to receive the LayoutCompleteEvent by this
class.public void removeLayoutCompleteEventListener(LayoutCompleteEventListener e)
removeLayoutCompleteEventListener
in interface LayoutEngine
e
- - The LayoutCompleteEventListener to remove.public void fireLayoutCompleteEvent(LayoutCompleteEvent e)
fireLayoutCompleteEvent
in interface LayoutEngine
e
- - 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 LayoutEngine
protected 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()
Copyright © 2015 University of Waikato, Hamilton, NZ. All rights reserved.