26 using System.Collections.Generic;
44 private bool defaultNodeEnabled;
45 private HashSet<Node> nodeExceptions =
new HashSet<Node>();
46 private bool defaultArcEnabled;
47 private HashSet<Arc> arcExceptions =
new HashSet<Arc>();
61 defaultNodeEnabled = enabled;
62 nodeExceptions.Clear();
69 defaultArcEnabled = enabled;
70 arcExceptions.Clear();
77 bool exception = (defaultNodeEnabled != enabled);
79 nodeExceptions.Add(node);
80 else nodeExceptions.Remove(node);
87 bool exception = (defaultArcEnabled != enabled);
89 arcExceptions.Add(arc);
90 else arcExceptions.Remove(arc);
96 return defaultNodeEnabled ^ nodeExceptions.Contains(node);
102 return defaultArcEnabled ^ arcExceptions.Contains(arc);
120 private IEnumerable<Node> NodesInternal()
122 foreach (var node
in graph.
Nodes())
128 if (nodeExceptions.Count == 0)
130 if (defaultNodeEnabled)
return graph.
Nodes();
131 return Enumerable.Empty<
Node>();
133 return NodesInternal();
138 foreach (var arc
in graph.
Arcs(filter))
145 foreach (var arc
in graph.
Arcs(u, filter))
152 foreach (var arc
in graph.
Arcs(u, v, filter))
158 return defaultNodeEnabled ? graph.
NodeCount() - nodeExceptions.Count : nodeExceptions.Count;
163 if (nodeExceptions.Count == 0 && filter ==
ArcFilter.All)
164 return defaultNodeEnabled ?
165 (defaultArcEnabled ? graph.
ArcCount() - arcExceptions.Count : arcExceptions.Count)
168 return Arcs(filter).Count();
173 return Arcs(u, filter).Count();
178 return Arcs(u, v, filter).Count();