I want to generate a random graph for a given number of nodes + edges. When I run it, it returns an edgelist of all zeroes (e.g. if I run it with five nodes and edges, it returns five pairs of zeroes as the edgelist). Is there something wrong with this part of the code that would be causing that?
public GraphEdgeList(int nNodes, int nEdges) {
if (nNodes != 0){
for (int i = 0; i < nEdges; i++){
int u = (int) Math.random()* nNodes;
int v = (int) Math.random()* nNodes;
addEdge(u, v);
}
}
}
Aucun commentaire:
Enregistrer un commentaire