jdsl.algo
Class BCTree

java.lang.Object
  |
  +--jdsl.algo.BCTree

public class BCTree
extends java.lang.Object
implements InspectableTree

This class is the result of executing the ConnectivityAnalyzer on an InspectableGraph. It conforms to the InspectableTree interface and may also be queried to learn about the connectivity of the graph on which the analysis was run. Elements of the nodes in the BCTree are representative elements of the block which those nodes represent. Nodes representing cut-positions hold the cut-vertex or cut-edge that makes up the separating node, and biconnected nodes (or blocks) hold some position within that biconnected componenent in the InspectableGraph on which the query was run.


Field Summary
static Position NOSUCHPOSITION
          Returned by getCutPosBetween(Position, Position) if no cut-position exists between the two parameter positions.
 
Constructor Summary
protected BCTree()
           
 
Method Summary
 boolean areBiconnected(Position a, Position b)
           
 boolean areInAdjacentBlocks(Position a, Position b)
           
 boolean areInSameBlock(Position a, Position b)
           
 java.util.Iterator children(Position p)
           
 java.util.Iterator elements()
           
 Position getCutPosBetween(Position a, Position b)
           
 InspectableGraph graph()
           
 boolean isCutEdge(Edge e)
           
 boolean isCutPosition(Position p)
           
 boolean isCutVertex(Vertex v)
           
 boolean isEmpty()
           
 boolean isExternal(Position p)
           
 boolean isInternal(Position p)
           
 boolean isRoot(Position p)
          InspectableTree methods
 Container newContainer()
          Container methods
protected  jdsl.algo.BCTNode nodeOf(Position p)
           
 Position parent(Position p)
           
 java.util.Iterator positions()
          PositionalContainer methods
 java.lang.Object replace(Position p, java.lang.Object obj)
           
 Position root()
           
 java.util.Iterator siblings(Position p)
           
 int size()
           
 void swap(Position a, Position b)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NOSUCHPOSITION

public static final Position NOSUCHPOSITION
Returned by getCutPosBetween(Position, Position) if no cut-position exists between the two parameter positions.
Constructor Detail

BCTree

protected BCTree()
Method Detail

isCutVertex

public boolean isCutVertex(Vertex v)
Parameters:
v - A vertex in InspectableGraph graph().
Returns:
true if the vertex is a cut-vertex, false otherwise.

isCutEdge

public boolean isCutEdge(Edge e)
Parameters:
e - An edge in InspectableGraph graph().
Returns:
true if the edge is a cut-edge, false otherwise.

isCutPosition

public boolean isCutPosition(Position p)
Parameters:
p - A position in the InspectableGraph graph().
Returns:
true if the position is a cut-position, false otherwise.

areInSameBlock

public boolean areInSameBlock(Position a,
                              Position b)
Parameters:
a - A position in the InspectableGraph graph()
b - A position in the InspectableGraph graph()
Returns:
true if both a and b belong to the same block of graph elements (i.e., the same biconnected component), false otherwise

areInAdjacentBlocks

public boolean areInAdjacentBlocks(Position a,
                                   Position b)
Parameters:
a - A position in the InspectableGraph graph()
b - A position in the InspectableGraph graph()
Returns:
true if the block to which a belongs is the parent of the block to which b belongs or vice versa; false otherwise

areBiconnected

public boolean areBiconnected(Position a,
                              Position b)
Parameters:
a - A position in the InspectableGraph graph()
b - A position in the InspectableGraph graph()
Returns:
true if a and b are in the same biconnected component, false otherwise.

getCutPosBetween

public Position getCutPosBetween(Position a,
                                 Position b)
Parameters:
a - A position in the InspectableGraph graph()
b - A position in the InspectableGraph graph()
Returns:
A cut-position between the two parameter positions in the analyzed graph. Returns null if there are no blocks separating the blocks holding a and b.

graph

public InspectableGraph graph()
Returns:
The graph of which this data structure is an analysis

nodeOf

protected jdsl.algo.BCTNode nodeOf(Position p)
Parameters:
p - A position in the graph
Returns:
The BCTNode associated with p

newContainer

public Container newContainer()
Container methods

elements

public java.util.Iterator elements()

size

public int size()

isEmpty

public boolean isEmpty()

positions

public java.util.Iterator positions()
PositionalContainer methods

replace

public java.lang.Object replace(Position p,
                                java.lang.Object obj)
                         throws InvalidPositionException

swap

public void swap(Position a,
                 Position b)
          throws InvalidPositionException

isRoot

public boolean isRoot(Position p)
               throws InvalidPositionException,
                      InvalidContainerException
InspectableTree methods
Specified by:
isRoot in interface InspectableTree

isInternal

public boolean isInternal(Position p)
                   throws InvalidContainerException,
                          InvalidPositionException
Specified by:
isInternal in interface InspectableTree

isExternal

public boolean isExternal(Position p)
                   throws InvalidPositionException,
                          InvalidContainerException
Specified by:
isExternal in interface InspectableTree

root

public Position root()
              throws InvalidContainerException
Specified by:
root in interface InspectableTree

parent

public Position parent(Position p)
                throws InvalidContainerException,
                       InvalidPositionException
Specified by:
parent in interface InspectableTree

children

public java.util.Iterator children(Position p)
                            throws InvalidContainerException,
                                   InvalidPositionException
Specified by:
children in interface InspectableTree

siblings

public java.util.Iterator siblings(Position p)
                            throws InvalidPositionException,
                                   InvalidContainerException
Specified by:
siblings in interface InspectableTree