nct.graph.basic
Class BasicDistanceGraph<NodeType extends java.lang.Comparable<? super NodeType>,WeightType extends java.lang.Comparable<? super WeightType>>

java.lang.Object
  extended by nct.graph.basic.BasicGraph<NodeType,WeightType>
      extended by nct.graph.basic.BasicDistanceGraph<NodeType,WeightType>
All Implemented Interfaces:
java.lang.Cloneable, java.lang.Comparable<Graph<NodeType,WeightType>>, DistanceGraph<NodeType,WeightType>, Graph<NodeType,WeightType>
Direct Known Subclasses:
BlastGraph, FastaGraph, InteractionGraph

public class BasicDistanceGraph<NodeType extends java.lang.Comparable<? super NodeType>,WeightType extends java.lang.Comparable<? super WeightType>>
extends BasicGraph<NodeType,WeightType>
implements DistanceGraph<NodeType,WeightType>

An extension of BasicGraph that calculates the minimum distance between nodes.


Field Summary
protected  java.util.Map<NodeType,java.util.Map<NodeType,java.lang.Byte>> distMap
          A mapping of node to node to distance.
 
Fields inherited from class nct.graph.basic.BasicGraph
assumeGraphFinished, descMap, id, numEdges, score, weightMap
 
Constructor Summary
BasicDistanceGraph()
          Constructor.
BasicDistanceGraph(java.lang.String id)
          Constructor.
 
Method Summary
 byte getDistance(NodeType nodeA, NodeType nodeB)
          Returns the minimum distance between the specified nodes.
 
Methods inherited from class nct.graph.basic.BasicGraph
addEdge, addEdge, addNode, clone, compareTo, degreeOfNode, getEdge, getEdgeDescription, getEdges, getEdgeWeight, getId, getNeighbors, getNodes, getScore, isEdge, isNode, numberOfEdges, numberOfNodes, removeEdge, removeNode, setEdgeDescription, setEdgeWeight, setScore, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface nct.graph.Graph
addEdge, addEdge, addNode, clone, compareTo, degreeOfNode, getEdge, getEdgeDescription, getEdges, getEdgeWeight, getId, getNeighbors, getNodes, getScore, isEdge, isNode, numberOfEdges, numberOfNodes, removeEdge, removeNode, setEdgeDescription, setEdgeWeight, setScore, toString
 

Field Detail

distMap

protected java.util.Map<NodeType extends java.lang.Comparable<? super NodeType>,java.util.Map<NodeType extends java.lang.Comparable<? super NodeType>,java.lang.Byte>> distMap
A mapping of node to node to distance. Note that this structure only includes mappings between nodes with distances lte 2. Anything greater is not stored and is assumed be of distance 3.

Constructor Detail

BasicDistanceGraph

public BasicDistanceGraph()
Constructor.


BasicDistanceGraph

public BasicDistanceGraph(java.lang.String id)
Constructor.

Parameters:
id - The fileName identifying the graph.
Method Detail

getDistance

public byte getDistance(NodeType nodeA,
                        NodeType nodeB)
Returns the minimum distance between the specified nodes.

Specified by:
getDistance in interface DistanceGraph<NodeType extends java.lang.Comparable<? super NodeType>,WeightType extends java.lang.Comparable<? super WeightType>>
Parameters:
nodeA - From node.
nodeB - To node.
Returns:
The distance between the nodes specified.