|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnct.graph.basic.BasicGraph<NodeType,WeightType>
nct.graph.basic.BasicKPartiteGraph<NodeType,WeightType,PartitionType>
public class BasicKPartiteGraph<NodeType extends java.lang.Comparable<? super NodeType>,WeightType extends java.lang.Comparable<? super WeightType>,PartitionType extends java.lang.Comparable<? super PartitionType>>
A generic implementation of the KPartiteGraph interface.
Field Summary | |
---|---|
protected int |
K
The number of partitions allowed in the graph, not necessarily the number currently contained in the graph. |
protected java.util.Map<NodeType,PartitionType> |
partitionMap
A mapping of nodes to partitions. |
static int |
UNLIMITED_PARTITIONS
This value indicates that an unlimited number of partitions is allowed in This graph. |
Fields inherited from class nct.graph.basic.BasicGraph |
---|
assumeGraphFinished, descMap, id, numEdges, score, weightMap |
Constructor Summary | |
---|---|
BasicKPartiteGraph()
Constructor that names the graph "none" and allows unlimited partitions. |
|
BasicKPartiteGraph(java.lang.String name)
Constructor that names the graph as specified and allows unlimited partitions. |
|
BasicKPartiteGraph(java.lang.String name,
int K)
Constructor that names the graph as specified and limits the number of partitions allowed in this graph. |
Method Summary | |
---|---|
boolean |
addEdge(NodeType nodeA,
NodeType nodeB,
WeightType weight)
Adds an edge to the graph. |
boolean |
addNode(NodeType node)
This method overrides the BasicGraph implementation of addNode and always returns false because it is impossible to add a node to a k-paritite graph without also specifying the partition. |
boolean |
addNode(NodeType node,
PartitionType partition)
Adds a node to the graph. |
java.util.List<java.util.List<NodeType>> |
getAllKCliques()
Returns a list of all k-cliques that exist in the graph. |
int |
getK()
This method returns the number of possible partitions. |
int |
getNumPartitions()
This method returns the number of existing partitions. |
java.util.List<PartitionType> |
getPartitions()
Returns a list of the partitions currently contained in the graph (not necessarily K if K partitions haven't yet been added). |
boolean |
isPartition(PartitionType p)
Checks whether a specified partition is one of the partitions used in the graph. |
Methods inherited from class nct.graph.basic.BasicGraph |
---|
addEdge, 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, clone, compareTo, degreeOfNode, getEdge, getEdgeDescription, getEdges, getEdgeWeight, getId, getNeighbors, getNodes, getScore, isEdge, isNode, numberOfEdges, numberOfNodes, removeEdge, removeNode, setEdgeDescription, setEdgeWeight, setScore, toString |
Field Detail |
---|
protected java.util.Map<NodeType extends java.lang.Comparable<? super NodeType>,PartitionType extends java.lang.Comparable<? super PartitionType>> partitionMap
protected int K
public static int UNLIMITED_PARTITIONS
Constructor Detail |
---|
public BasicKPartiteGraph()
public BasicKPartiteGraph(java.lang.String name)
name
- The name of the graph.public BasicKPartiteGraph(java.lang.String name, int K)
name
- The name of the graph.K
- The number of allowed partitions in this graph.Method Detail |
---|
public boolean addNode(NodeType node)
addNode
in interface Graph<NodeType extends java.lang.Comparable<? super NodeType>,WeightType extends java.lang.Comparable<? super WeightType>>
addNode
in class BasicGraph<NodeType extends java.lang.Comparable<? super NodeType>,WeightType extends java.lang.Comparable<? super WeightType>>
node
- The node that will NOT be added.
public boolean addNode(NodeType node, PartitionType partition)
addNode
in interface KPartiteGraph<NodeType extends java.lang.Comparable<? super NodeType>,WeightType extends java.lang.Comparable<? super WeightType>,PartitionType extends java.lang.Comparable<? super PartitionType>>
node
- The node to be added to the graph.partition
- The partition the node should be added to.
public boolean addEdge(NodeType nodeA, NodeType nodeB, WeightType weight)
addEdge
in interface Graph<NodeType extends java.lang.Comparable<? super NodeType>,WeightType extends java.lang.Comparable<? super WeightType>>
addEdge
in class BasicGraph<NodeType extends java.lang.Comparable<? super NodeType>,WeightType extends java.lang.Comparable<? super WeightType>>
nodeA
- The source node of the edge.nodeB
- The target node of the edge.weight
- The edge weight.
public java.util.List<PartitionType> getPartitions()
getPartitions
in interface KPartiteGraph<NodeType extends java.lang.Comparable<? super NodeType>,WeightType extends java.lang.Comparable<? super WeightType>,PartitionType extends java.lang.Comparable<? super PartitionType>>
public int getNumPartitions()
getNumPartitions
in interface KPartiteGraph<NodeType extends java.lang.Comparable<? super NodeType>,WeightType extends java.lang.Comparable<? super WeightType>,PartitionType extends java.lang.Comparable<? super PartitionType>>
public int getK()
getK
in interface KPartiteGraph<NodeType extends java.lang.Comparable<? super NodeType>,WeightType extends java.lang.Comparable<? super WeightType>,PartitionType extends java.lang.Comparable<? super PartitionType>>
public boolean isPartition(PartitionType p)
isPartition
in interface KPartiteGraph<NodeType extends java.lang.Comparable<? super NodeType>,WeightType extends java.lang.Comparable<? super WeightType>,PartitionType extends java.lang.Comparable<? super PartitionType>>
p
- The partition to check.
public java.util.List<java.util.List<NodeType>> getAllKCliques()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |