nct.graph.basic
Class BasicDistanceGraph<NodeType extends java.lang.Comparable<? super NodeType>,WeightType extends java.lang.Comparable<? super WeightType>>
java.lang.Object
nct.graph.basic.BasicGraph<NodeType,WeightType>
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. |
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 |
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.
BasicDistanceGraph
public BasicDistanceGraph()
- Constructor.
BasicDistanceGraph
public BasicDistanceGraph(java.lang.String id)
- Constructor.
- Parameters:
id
- The fileName identifying the graph.
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.