ca.cas.multigraph
Class AbGraph

java.lang.Object
  extended by ca.cas.multigraph.AbGraph

public class AbGraph
extends java.lang.Object

The Aberration Multigraph Class.


Constructor Summary
AbGraph()
           
 
Method Summary
 boolean addBreak(Break br)
          Adds a break.
 boolean addChromosome(Chromosome chrom)
          Adds the specified chromosome to the Aberration Multigraph.
 boolean addEdge(AbEdge e)
          Adds an edge to the graph but does not the vertices.
 void addEdges(java.util.Set edge_set)
          Adds all edges in the edge_set
 boolean addFinalEdge(AbVertex v1, AbVertex v2)
          Joins v1 to v2 with a final edge and adds that final edge to this AbGraph
 boolean addToComponent(AbVertex vertex, java.util.Set component, int in_edge)
          Adds vertices connected to vertex to the set component but without going back through the in_edge.
 boolean addVertex(AbVertex v)
          Adds a vertex to the graph but does not add any associated edges.
 void addVertices(java.util.Set vertex_set)
          Adds all vertices in the vertex_set
 java.util.Set connectedComponentOf(AbVertex vertex)
          Returns a set of vertices that are in the same connected component as vertex.
 java.util.Vector<AbGraph> connectedComponents()
          Returns a vector containing the connected components of this AbGraph.
 AbGraph exchangeGraph()
          Returns the exchange subgraph.
 AbGraph finalConfigurationGraph()
          Returns the final configuration subgraph.
 AbGraph fullCopy()
          Returns a full copy of this AbGraph
 AbEdge getEdge(AbVertex vertex, int type)
          Returns the edge incident on vertex, for edge type type.
 AbEdge getEdge(Chromosome chrom, long location)
          Returns the chromatin edge of chrom that contains location.
 java.util.Set getFreeEnds()
          Returns all the free ends.
 AbVertex getVertex()
          Returns a vertex -- a telomere first and if there are no telomeres, then a free end If there are no free ends, then it returns null.
 java.util.TreeSet getVertices(Chromosome chrom)
          Returns a tree set of all vertices of a given Chromosome
 AbVertex partnerOf(AbVertex vertex, int edge_type)
          Returns the partner of vertex of the given edge_type
 AbGraph removeComponentOf(AbVertex vertex)
          Removes the connected component of the specified vertex from this AbGraph and returns that connected component as an AbGraph.
 boolean removeEdge(AbEdge e)
          Remove the specified edge.
 boolean removeToComponent(AbVertex vertex, AbGraph component, int in_edge)
          Recursive function that removes to the component the edges and vertices connected to the specified vertex.
 boolean removeVertex(AbVertex vertex)
          Remove the specified vertex.
 AbGraph subgraph(boolean telomeres, boolean free_ends, boolean chrom, boolean init, boolean fin)
          Returns a subgraph of this AbGraph
 java.lang.String toString()
          A string representation of the multigraph.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbGraph

public AbGraph()
Method Detail

addChromosome

public boolean addChromosome(Chromosome chrom)
Adds the specified chromosome to the Aberration Multigraph. If the chromosome is not already present, this method will add two telomere vertices at either end of the chromosome and connect them with a chromatin edge.

Parameters:
chrom - chromosome to add
Returns:
true if chromosome is added, false if the AbGraph already contains that chromosome.

getFreeEnds

public java.util.Set getFreeEnds()
Returns all the free ends.

Returns:
all the free ends

getVertices

public java.util.TreeSet getVertices(Chromosome chrom)
Returns a tree set of all vertices of a given Chromosome

Parameters:
chrom - chromosome
Returns:
tree set of vertices of chrom

getEdge

public AbEdge getEdge(Chromosome chrom,
                      long location)
Returns the chromatin edge of chrom that contains location. null if no such edge exists.

Parameters:
chrom - chromosome
location - location
Returns:
chromatin edge of chrom containing location

getEdge

public AbEdge getEdge(AbVertex vertex,
                      int type)
Returns the edge incident on vertex, for edge type type. if the vertex is a telomere and the type != CHROM, returns null without looking.

Parameters:
vertex -
type - edge type
Returns:
edge incident of vertex of type type.

addBreak

public boolean addBreak(Break br)
Adds a break. If the chromosome is not already in the multigraph, it will first add it.

Parameters:
br -
location -
Returns:
true if a break is added, false otherwise.

addVertex

public boolean addVertex(AbVertex v)
Adds a vertex to the graph but does not add any associated edges.

Parameters:
v - vertex to add
Returns:
true if multigraph does not already contain the vertex.

addVertices

public void addVertices(java.util.Set vertex_set)
Adds all vertices in the vertex_set

Parameters:
vertex_set -

addEdge

public boolean addEdge(AbEdge e)
Adds an edge to the graph but does not the vertices.

Parameters:
e - edge to add
Returns:
true if multigraph does not already contain the edge.

addFinalEdge

public boolean addFinalEdge(AbVertex v1,
                            AbVertex v2)
Joins v1 to v2 with a final edge and adds that final edge to this AbGraph

Parameters:
v1 -
v2 -
Returns:
true if multigraph does not already contain the edge.

addEdges

public void addEdges(java.util.Set edge_set)
Adds all edges in the edge_set

Parameters:
edge_set -

exchangeGraph

public AbGraph exchangeGraph()
Returns the exchange subgraph.

Returns:
exchange subgraph

finalConfigurationGraph

public AbGraph finalConfigurationGraph()
Returns the final configuration subgraph.

Returns:
exchange subgraph

fullCopy

public AbGraph fullCopy()
Returns a full copy of this AbGraph

Returns:
full copy of the AbGraph

subgraph

public AbGraph subgraph(boolean telomeres,
                        boolean free_ends,
                        boolean chrom,
                        boolean init,
                        boolean fin)
Returns a subgraph of this AbGraph

Parameters:
telomeres -
free_ends -
chrom -
init -
fin -
Returns:
subgraph of the AbGraph containing the specified components

removeEdge

public boolean removeEdge(AbEdge e)
Remove the specified edge.

Parameters:
edge - e
Returns:
true if removed

removeVertex

public boolean removeVertex(AbVertex vertex)
Remove the specified vertex.

Parameters:
edge - vertex
Returns:
true if removed

toString

public java.lang.String toString()
A string representation of the multigraph.

Overrides:
toString in class java.lang.Object
Returns:

connectedComponentOf

public java.util.Set connectedComponentOf(AbVertex vertex)
Returns a set of vertices that are in the same connected component as vertex.

Parameters:
vertex -
Returns:
set of vertices connected to the specified vertex.

addToComponent

public boolean addToComponent(AbVertex vertex,
                              java.util.Set component,
                              int in_edge)
Adds vertices connected to vertex to the set component but without going back through the in_edge. This function is the recursive inner workings of connectedComponentOf(AbVertex).

Parameters:
vertex -
component - set to add to
in_edge - the edge type traversed to reach this edge.
Returns:
true if vertex is not null and not already in the set.

removeComponentOf

public AbGraph removeComponentOf(AbVertex vertex)
Removes the connected component of the specified vertex from this AbGraph and returns that connected component as an AbGraph.

Parameters:
vertex -
Returns:
connected component of vertex

removeToComponent

public boolean removeToComponent(AbVertex vertex,
                                 AbGraph component,
                                 int in_edge)
Recursive function that removes to the component the edges and vertices connected to the specified vertex. It returns false if the vertex is null or is already contained in the component. Further, it avoids going back on the in_edge.

Parameters:
vertex -
component -
in_edge -
Returns:
true if vertex is not null and component does not contain vertex.

connectedComponents

public java.util.Vector<AbGraph> connectedComponents()
Returns a vector containing the connected components of this AbGraph. Each connected component is itself an AbGraph.

Returns:
vector comtaining the connected components of this AbGraph.

partnerOf

public AbVertex partnerOf(AbVertex vertex,
                          int edge_type)
Returns the partner of vertex of the given edge_type

Parameters:
vertex -
edge_type -
Returns:

getVertex

public AbVertex getVertex()
Returns a vertex -- a telomere first and if there are no telomeres, then a free end If there are no free ends, then it returns null.

Returns:
a vertex