|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sourceforge.combean.graph.prop.statics.ConstructableNumberedGraphBuilder
public class ConstructableNumberedGraphBuilder
Convenience class which supports constructing a graph where the nodes and edges are referenced through integers.
Constructor Summary | |
---|---|
ConstructableNumberedGraphBuilder(ConstructableNumberedGraphProp g)
Constructor |
Method Summary | |
---|---|
int |
addEdge(int fromNodeNum,
int toNodeNum)
Add an edge |
int |
addEdge(int fromNodeNum,
int toNodeNum,
double doubleVal)
Add an edge and set its weight in an edge map |
void |
addEdges(int[][] edges)
Add multiple edges. |
void |
addEdgesWithWeights(int[][] edgesWithWeights)
Add multiple edges and set their (integer) weights. |
int |
addNode()
Add a new node |
int |
addNode(double doubleVal)
Add a new node and set its weight |
int |
addNodes(int numNodesToAdd)
Add several nodes simulatenously |
int |
addNodesWithWeights(int numNodesToAdd,
double[] nodeWeights)
Add several nodes simultaneously and fill a NodeMap |
void |
addPathEdges(int fromNodeNum,
int toNodeNum)
Add edges forming a path on consecutive nodes, i.e., edges (fromNodeNum, fromNodeNum+1), (fromNodeNum+1, fromNodeNum+2), ..., (toNodeNum-1, toNodeNum) |
void |
addPathEdgesWithWeights(int fromNodeNum,
int toNodeNum,
double[] edgeWeights)
Add edges forming a path on consecutive nodes, i.e., edges (fromNodeNum, fromNodeNum+1), (fromNodeNum+1, fromNodeNum+2), ..., (toNodeNum-1, toNodeNum) with edge weights |
void |
fillDoubleEdgeMap(DoubleEdgeMap mapToFill,
double[] edgeWeights)
Fill a DoubleEdgeMap with double values for all edges in the graph. |
void |
fillDoubleNodeMap(DoubleNodeMap mapToFill,
double[] nodeWeights)
Fill a DoubleNodeMap with double values for all nodes in the graph. |
void |
fillEdgeMap(EdgeMap<Double> mapToFill,
double[] edgeWeights)
Fill an EdgeMap with double values for all edges in the graph. |
void |
setEdgeMap(EdgeMap<Double> edgeMap)
When creating edges, it is possible to store edge weights. |
void |
setNodeMap(NodeMap<Double> nodeMap)
When creating nodes, it is possible to store node weights. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ConstructableNumberedGraphBuilder(ConstructableNumberedGraphProp g)
g
- the graph which shall be builtMethod Detail |
---|
public void setNodeMap(NodeMap<Double> nodeMap)
nodeMap
- NodeMap to be used for node weightspublic void setEdgeMap(EdgeMap<Double> edgeMap)
edgeMap
- EdgeMap to be used for edge weightspublic int addNode()
public int addNode(double doubleVal)
doubleVal
- the weight of the node
public int addNodes(int numNodesToAdd)
numNodesToAdd
- the number of nodes be added
public int addNodesWithWeights(int numNodesToAdd, double[] nodeWeights)
numNodesToAdd
- the number of nodes be addednodeWeights
- the weights of the nodes to be added
public int addEdge(int fromNodeNum, int toNodeNum)
fromNodeNum
- the integer identifier of the source nodetoNodeNum
- the integer identifier of the target node
public int addEdge(int fromNodeNum, int toNodeNum, double doubleVal)
fromNodeNum
- the integer identifier of the source nodetoNodeNum
- the integer identifier of the target nodedoubleVal
- the value to be assigned to the new edge
public void addEdges(int[][] edges)
edges
- an array defining the edges and their weights.
edgesWithWeights[i] contains the source and the target node at
the indices 0 and 1.public void addEdgesWithWeights(int[][] edgesWithWeights)
edgesWithWeights
- an array defining the edges and their weights.
edgesWithWeights[i] contains the source and the target node at
the indices 0 and 1, as well as the edge weight at index 2.public void addPathEdges(int fromNodeNum, int toNodeNum)
fromNodeNum
- the index of the first node in the pathtoNodeNum
- the index of the last node in the pathpublic void addPathEdgesWithWeights(int fromNodeNum, int toNodeNum, double[] edgeWeights)
fromNodeNum
- the index of the first node in the pathtoNodeNum
- the index of the last node in the pathedgeWeights
- the weights of the edges (array must contain
toNodeNum - fromNodeNum elements)public void fillEdgeMap(EdgeMap<Double> mapToFill, double[] edgeWeights)
mapToFill
- the EdgeMap to be fillededgeWeights
- an array containing the weights to store in the mappublic void fillDoubleEdgeMap(DoubleEdgeMap mapToFill, double[] edgeWeights)
mapToFill
- the DoubleEdgeMap to be fillededgeWeights
- an array containing the weights to store in the mappublic void fillDoubleNodeMap(DoubleNodeMap mapToFill, double[] nodeWeights)
mapToFill
- the DoubleNodeMap to be fillednodeWeights
- an array containing the weights to store in the map
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |