|
@@ -14,7 +14,7 @@ import java.util.*;
|
|
|
public class GraphService {
|
|
public class GraphService {
|
|
|
private static final int NODE_NUM=7;
|
|
private static final int NODE_NUM=7;
|
|
|
//获取一个新的无向非带权图
|
|
//获取一个新的无向非带权图
|
|
|
- public UDUWGraph getNewUDUDGraph(){
|
|
|
|
|
|
|
+ public UDUWGraph getNewUDUWGraph(){
|
|
|
ArrayList<ArrayList<Integer>> content=new ArrayList<ArrayList<Integer>>();
|
|
ArrayList<ArrayList<Integer>> content=new ArrayList<ArrayList<Integer>>();
|
|
|
for(int i=0;i<NODE_NUM;i++){
|
|
for(int i=0;i<NODE_NUM;i++){
|
|
|
ArrayList<Integer> raw=new ArrayList<Integer>();
|
|
ArrayList<Integer> raw=new ArrayList<Integer>();
|
|
@@ -27,10 +27,10 @@ public class GraphService {
|
|
|
int tokeTimes = Math.round(((float)Math.random())*10)+11;
|
|
int tokeTimes = Math.round(((float)Math.random())*10)+11;
|
|
|
int edgeNum=0;
|
|
int edgeNum=0;
|
|
|
for(int i=1;i<=tokeTimes;i++){
|
|
for(int i=1;i<=tokeTimes;i++){
|
|
|
- int left=Math.round(((float)Math.random())*7);
|
|
|
|
|
- int right=Math.round(((float)Math.random())*7);
|
|
|
|
|
|
|
+ int left=Math.round(((float)Math.random())*6);
|
|
|
|
|
+ int right=Math.round(((float)Math.random())*6);
|
|
|
while(left==right){
|
|
while(left==right){
|
|
|
- right=Math.round(((float)Math.random())*7);
|
|
|
|
|
|
|
+ right=Math.round(((float)Math.random())*6);
|
|
|
}
|
|
}
|
|
|
if(content.get(left).get(right)==1){
|
|
if(content.get(left).get(right)==1){
|
|
|
i--;
|
|
i--;
|
|
@@ -58,10 +58,10 @@ public class GraphService {
|
|
|
int tokeTimes = Math.round(((float)Math.random())*10)+11;
|
|
int tokeTimes = Math.round(((float)Math.random())*10)+11;
|
|
|
int edgeNum=0;
|
|
int edgeNum=0;
|
|
|
for(int i=1;i<=tokeTimes;i++){
|
|
for(int i=1;i<=tokeTimes;i++){
|
|
|
- int left=Math.round(((float)Math.random())*7);
|
|
|
|
|
- int right=Math.round(((float)Math.random())*7);
|
|
|
|
|
|
|
+ int left=Math.round(((float)Math.random())*6);
|
|
|
|
|
+ int right=Math.round(((float)Math.random())*6);
|
|
|
while(left==right){
|
|
while(left==right){
|
|
|
- right=Math.round(((float)Math.random())*7);
|
|
|
|
|
|
|
+ right=Math.round(((float)Math.random())*6);
|
|
|
}
|
|
}
|
|
|
if(content.get(left).get(right)==1){
|
|
if(content.get(left).get(right)==1){
|
|
|
i--;
|
|
i--;
|