private void Initialize() { distanceToSink.Clear(); flow.Clear(); excess.Clear(); activeNodes.Clear(); sourceGroup.Clear(); sourceGroup.AddRange(Sources); nodesAtDistance[0] = Set <NodeType> .FromEnumerable(Sinks); foreach (NodeType sink in Sinks) { distanceToSink[sink] = 0; } Set <NodeType> nodesAtDistance1 = new Set <NodeType>(); foreach (NodeType node in graph.Nodes) { if (!Sources.Contains(node) && !Sinks.Contains(node)) { nodesAtDistance1.Add(node); } } nodesAtDistance[1] = nodesAtDistance1; foreach (NodeType source in Sources) { if (!Sinks.Contains(source)) { distanceToSink[source] = int.MaxValue; } foreach (EdgeType edge in graph.EdgesOutOf(source)) { float f = capacity(edge); flow[edge] = f; if (!IsSinkEdge(edge)) { NodeType target = graph.TargetOf(edge); if (!Sources.Contains(target) && !Sinks.Contains(target)) { excess[target] += f; activeNodes.Add(target); } } } foreach (EdgeType edge in graph.EdgesInto(source)) { if (!IsSinkEdge(edge)) { float f = reverseCapacity(edge); flow[edge] = -f; NodeType target = graph.SourceOf(edge); if (!Sources.Contains(target) && !Sinks.Contains(target)) { excess[target] += f; activeNodes.Add(target); } } } } }
public void Clear() { queue.Clear(); bfs.Clear(); visitCount = 0; IsScheduled.Clear(); MaxScheduledCost = default(Cost); }
public IndexedProperty <int, T> CreateNodeData <T>(T defaultValue) { T[] data = new T[info.Length]; IndexedProperty <int, T> prop = MakeIndexedProperty.FromArray <T>(data, defaultValue); prop.Clear(); return(prop); }
public IndexedProperty <int, T> CreateEdgeData <T>(T defaultValue = default(T)) { if (IsReadOnly) { T[] data = new T[edges.Count]; IndexedProperty <int, T> prop = MakeIndexedProperty.FromArray <T>(data, defaultValue); prop.Clear(); return(prop); } else { return(new IndexedProperty <int, T>(new Dictionary <int, T>(), defaultValue)); } }
public IndexedProperty <int, T> CreateNodeData <T>(T defaultValue = default(T)) { if (NodeCountIsConstant) { T[] data = new T[inEdges.Count]; IndexedProperty <int, T> prop = MakeIndexedProperty.FromArray <T>(data, defaultValue); prop.Clear(); return(prop); } else { return(new IndexedProperty <int, T>(new Dictionary <int, T>(), defaultValue)); } }
public virtual void Clear() { IsVisited.Clear(); }
public void Clear() { isBlocked.Clear(); blockedSources.Clear(); onPath.Clear(); }