private void FillValuesByProbability(double probability, int stepCount) { while (stepCount > 0) { List <EdgesAddedOrRemoved> step = (GenerationSteps != null) ? new List <EdgesAddedOrRemoved>() : null; for (int i = 1; i < container.Size; ++i) { List <int> neighbours = new List <int>(); List <int> nonNeighbours = new List <int>(); for (int k = 0; k < container.Size && k < i; ++k) { if (container.AreConnected(i, k)) { neighbours.Add(k); //if (step != null) // step.Add(new EdgesAddedOrRemoved(i, k, true)); } else { nonNeighbours.Add(k); //if (step != null) // step.Add(new EdgesAddedOrRemoved(i, k, false)); } } if (nonNeighbours.Count > 0) { int size_neighbours = neighbours.Count; for (int j = 0; j < size_neighbours; ++j) { int r = WSStep(probability, nonNeighbours, neighbours[j]); if (r != neighbours[j]) { //container.Disconnect(i, neighbours[j]); //container.AreConnected(i, r); container.AddConnection(i, r); container.RemoveConnection(i, neighbours[j]); if (step != null) { step.Add(new EdgesAddedOrRemoved(i, r, true)); step.Add(new EdgesAddedOrRemoved(i, neighbours[j], false)); } } } } } GenerationSteps.Add(step); --stepCount; } }
private void FillValuesByProbability(double probability, uint stepCount) { while (stepCount > 0) { for (int i = 1; i < container.Size; ++i) { List <int> neighbours = new List <int>(); List <int> nonNeighbours = new List <int>(); for (int k = 0; k < container.Size && k < i; ++k) { if (container.AreConnected(i, k)) { neighbours.Add(k); } else { nonNeighbours.Add(k); } } if (nonNeighbours.Count > 0) { int size_neighbours = neighbours.Count; for (int j = 0; j < size_neighbours; ++j) { int r = WSStep(probability, nonNeighbours, neighbours[j]); if (r != neighbours[j]) { //container.Disconnect(i, neighbours[j]); container.AreConnected(i, r); } } } } --stepCount; } }