/// <summary> /// Marks a node as being visited. Returns whether the node had previously been visited. Only valid for use by /// nodes that were in the graph at the time this VisitationTracker was created. /// </summary> public bool MarkVisited(NodeId node) { Contract.Requires(node.IsValid); if (m_visited.TrySet((int)(node.Value - 1), true)) { Interlocked.Increment(ref m_visitedCount); return(true); } return(false); }
public static ConcurrentBitArray CraeteBitArrayWithRandomContent(int length) { var bitArray = new ConcurrentBitArray(length); for (int i = 0; i < length; i++) { if ((s_random.Next(100) % 2) == 0) { bitArray.TrySet(i, true); } } return(bitArray); }