|
mxGraph 2.4.0.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.mxgraph.analysis.mxGraphGenerator
public class mxGraphGenerator
Constructor Summary | |
---|---|
mxGraphGenerator(mxGeneratorFunction generatorFunction,
mxCostFunction costFunction)
|
Method Summary | |
---|---|
void |
getBipartiteGraph(mxAnalysisGraph aGraph,
int numVerticesGroup1,
int numVerticesGroup2)
|
void |
getCompleteBipartiteGraph(mxAnalysisGraph aGraph,
int numVerticesGroup1,
int numVerticesGroup2)
|
void |
getCompleteGraph(mxAnalysisGraph aGraph,
int numVertices)
|
mxCostFunction |
getCostFunction()
|
void |
getFriendshipWindmillGraph(mxAnalysisGraph aGraph,
int numBranches,
int branchSize)
|
mxGeneratorFunction |
getGeneratorFunction()
|
static mxGeneratorFunction |
getGeneratorFunction(mxGraph graph,
boolean weighted,
double minWeight,
double maxWeight)
|
void |
getGridGraph(mxAnalysisGraph aGraph,
int numColumns,
int numRows)
|
void |
getKingGraph(mxAnalysisGraph aGraph,
int xDim,
int yDim)
|
Object[] |
getKingMoveVertexes(mxAnalysisGraph aGraph,
int xDim,
int yDim,
int xCoord,
int yCoord)
|
void |
getKnightGraph(mxAnalysisGraph aGraph,
int xDim,
int yDim)
|
Object[] |
getKnightMoveVertexes(mxAnalysisGraph aGraph,
int xDim,
int yDim,
int xCoord,
int yCoord)
|
void |
getKnightTour(mxAnalysisGraph aGraph,
int xDim,
int yDim,
int startVertexValue)
|
Double |
getNewEdgeValue(mxAnalysisGraph aGraph)
Creates a new edge value based on graph properties in mxAnalysisGraph. |
void |
getNullGraph(mxAnalysisGraph aGraph,
int numVertices)
|
void |
getPathGraph(mxAnalysisGraph aGraph,
int numVertices)
|
void |
getPetersenGraph(mxAnalysisGraph aGraph)
|
int |
getRandomInt(int minValue,
int maxValue)
|
void |
getSimpleRandomGraph(mxAnalysisGraph aGraph,
int numNodes,
int numEdges,
boolean allowSelfLoops,
boolean allowMultipleEdges,
boolean forceConnected)
Generates a random graph |
void |
getSimpleRandomTree(mxAnalysisGraph aGraph,
int vertexCount)
Generates a random tree graph |
void |
getStarGraph(mxAnalysisGraph aGraph,
int numVertices)
|
int[] |
getVertexGridCoords(int xDim,
int yDim,
int value)
use this only with the grid graph, and various chess-board graphs, because of vertex ordering |
void |
getWheelGraph(mxAnalysisGraph aGraph,
int numVertices)
|
void |
getWindmillGraph(mxAnalysisGraph aGraph,
int numBranches,
int branchSize)
|
void |
oneSpanningTree(mxAnalysisGraph aGraph,
boolean forceConnected,
boolean forceSimple)
|
void |
setBipartiteGraphSpacing(mxAnalysisGraph aGraph,
int numVerticesGroup1,
int numVerticesGroup2,
double vertexSpacing,
double groupSpacing)
Sets the physical spacing between vertices in a bipartite graph. |
void |
setCostFunction(mxCostFunction costFunction)
|
void |
setGridGraphSpacing(mxAnalysisGraph aGraph,
double xSpacing,
double ySpacing,
int numColumns,
int numRows)
Sets the physical spacing between vertices in a grid graph. |
void |
setPathGraphSpacing(mxAnalysisGraph aGraph,
double spacing)
Sets the physical spacing between vertices in a path graph. |
void |
setStarGraphLayout(mxAnalysisGraph aGraph,
double graphSize)
Sets the physical size of a star graph. |
void |
setWindmillGraphLayout(mxAnalysisGraph aGraph,
int numBranches,
int numVerticesInBranch,
double graphSize)
Sets the layout of a windmill graph. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public mxGraphGenerator(mxGeneratorFunction generatorFunction, mxCostFunction costFunction)
Method Detail |
---|
public void getNullGraph(mxAnalysisGraph aGraph, int numVertices)
aGraph
- numVertexes
- public void getCompleteGraph(mxAnalysisGraph aGraph, int numVertices)
aGraph
- numVertices
- number of verticespublic void getGridGraph(mxAnalysisGraph aGraph, int numColumns, int numRows)
aGraph
- numRows
- - number of rows in the grid graphnumColumns
- - number of columns in the grid graphpublic void setGridGraphSpacing(mxAnalysisGraph aGraph, double xSpacing, double ySpacing, int numColumns, int numRows)
aGraph
- xSpacing
- - horizontal spacing between verticesySpacing
- - vertical spacing between verticesnumRows
- - number of rows in the grid graphnumColumns
- - number of columns in the grid graphpublic void getBipartiteGraph(mxAnalysisGraph aGraph, int numVerticesGroup1, int numVerticesGroup2)
aGraph
- numVerticesGroup1
- number of vertices in group 1numVerticesGroup2
- number of vertices in group 2public void setBipartiteGraphSpacing(mxAnalysisGraph aGraph, int numVerticesGroup1, int numVerticesGroup2, double vertexSpacing, double groupSpacing)
aGraph
- numVerticesGroup1
- - number of vertices in group 1numVerticesGroup2
- - number of vertices in group 2vertexSpacing
- - vertical spacing between vertices in the same groupgroupSpacing
- - spacing between groupspublic void getCompleteBipartiteGraph(mxAnalysisGraph aGraph, int numVerticesGroup1, int numVerticesGroup2)
aGraph
- numVerticesGroup1
- number of vertices in group 1numVerticesGroup2
- number of vertices in group 2public void getKnightGraph(mxAnalysisGraph aGraph, int xDim, int yDim)
aGraph
- xDim
- yDim
- public Object[] getKnightMoveVertexes(mxAnalysisGraph aGraph, int xDim, int yDim, int xCoord, int yCoord)
aGraph
- xDim
- x dimension of chess-board, size starts from 1yDim
- y dimension of chess-board, size starts from 1xCoord
- x coordinate on the chess-board, coordinate starts from 1yCoord
- y coordinate on the chess-board, coordinate starts from 1
public int[] getVertexGridCoords(int xDim, int yDim, int value)
xDim
- x dimension of chess-board, size starts from 1yDim
- y dimension of chess-board, size starts from 1value
- value of the vertex that needs coordinates returned
public void getKingGraph(mxAnalysisGraph aGraph, int xDim, int yDim)
xDim
- yDim
- weights
- Return a king graph of size xDim x yDim
Note that the minimum size is 4x4public Object[] getKingMoveVertexes(mxAnalysisGraph aGraph, int xDim, int yDim, int xCoord, int yCoord)
aGraph
- xDim
- x dimension of the chessboardyDim
- y dimension of the chessboardxCoord
- the current x position of the kingyCoord
- the current y position of the king
public void getPetersenGraph(mxAnalysisGraph aGraph)
aGraph
- Returns a Petersen graphpublic void getPathGraph(mxAnalysisGraph aGraph, int numVertices)
aGraph
- numVertices
- Returns a path graphpublic void setPathGraphSpacing(mxAnalysisGraph aGraph, double spacing)
aGraph
- spacing
- public void getStarGraph(mxAnalysisGraph aGraph, int numVertices)
aGraph
- numVertices
- Returns a star graph
Note that minimum vertex number is 4public void setStarGraphLayout(mxAnalysisGraph aGraph, double graphSize)
aGraph
- graphSize
- public void getWheelGraph(mxAnalysisGraph aGraph, int numVertices)
aGraph
- numVertices
- Returns a wheel graph. Note that numVertices has to be at least 4.public void getFriendshipWindmillGraph(mxAnalysisGraph aGraph, int numBranches, int branchSize)
aGraph
- numBranches
- number of branches (minimum >= 2)branchSize
- number of vertices in a single branch (minimum >= 2)
Returns a friendship windmill graph (aka Dutch windmill)public void getWindmillGraph(mxAnalysisGraph aGraph, int numBranches, int branchSize)
aGraph
- numBranches
- - number of branches (minimum >= 2)branchSize
- - number of vertices in a single branch (minimum >= 2)
Returns a windmill graphpublic void setWindmillGraphLayout(mxAnalysisGraph aGraph, int numBranches, int numVerticesInBranch, double graphSize)
aGraph
- numBranches
- numVerticesInBranch
- graphSize
- public void getSimpleRandomGraph(mxAnalysisGraph aGraph, int numNodes, int numEdges, boolean allowSelfLoops, boolean allowMultipleEdges, boolean forceConnected)
aGraph
- numNodes
- number of vertexesnumEdges
- number of edges (may be inaccurate if forceConnected is set to trueallowSelfLoops
- if true, there will be a chance that self loops will be generated tooallowMultipleEdges
- if true, there will be a chance that multiple edges will be generated (multiple edges between the same two vertices)forceConnected
- if true the resulting graph will be always connected, but this may alter numEdgespublic void getSimpleRandomTree(mxAnalysisGraph aGraph, int vertexCount)
aGraph
- vertexCount
- public Double getNewEdgeValue(mxAnalysisGraph aGraph)
aGraph
-
public static mxGeneratorFunction getGeneratorFunction(mxGraph graph, boolean weighted, double minWeight, double maxWeight)
graph
- weighted
- if true, the edges will be weighted, otherwise all will have default value (1.0)minWeight
- minimum edge weight if weightedmaxWeight
- maximum edge weight if weighted
public mxGeneratorFunction getGeneratorFunction()
public int getRandomInt(int minValue, int maxValue)
minValue
- maxValue
-
public void oneSpanningTree(mxAnalysisGraph aGraph, boolean forceConnected, boolean forceSimple) throws StructuralException
graph
- forceConnected
- if true, an unconnected graph is made connectedforceSimple
- if true, a non-simple graph is made simple
Calculates one spanning tree of graph, which doesn't have to be but can be minimal
(this is faster than minimal spanning tree, so if you need any spanning tree, use this one)
Self loops and multiple edges are automatically removed!
Also, unconnected graphs are made connected!
StructuralException
- the graph has to be simple (no self-loops and no multiple edges)public void getKnightTour(mxAnalysisGraph aGraph, int xDim, int yDim, int startVertexValue) throws StructuralException
aGraph
- xDim
- x dimension of the chessboardyDim
- y dimension of the chessboardstartVertexValue
- vertex where the tour will start
StructuralException
- not all size combinations are allowed, see wikipedia for a more detailed explanation
Returns a Knight's Tour graphpublic mxCostFunction getCostFunction()
public void setCostFunction(mxCostFunction costFunction)
|
mxGraph 2.4.0.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |