示例#1
0
 public IEnumerable<Edge> Apply(Vertex source)
 {
     foreach (var kvp in Logic(source, Graph))
     {
         yield return kvp;
     }
 }
示例#2
0
        public IEnumerable<Edge> Apply(Vertex source)
        {
            foreach (var kvp_iter in Logic(source.Object))
            {
                var kvp = kvp_iter; // just make resharper happeh
                Func<Vertex> createVertex = () => new Vertex(kvp.Value, ++_idFactory, source.DistanceFromRoot + 1);

                if (kvp.Value == null)
                {
                    yield return new Edge(kvp.Key, source, createVertex());
                }
                else
                {
                    var contains = SafetyTools.SafeEval(() => _cache.ContainsKey(kvp.Value), true);
                    if (!contains)
                    {
                        SafetyTools.SafeDo(() => _cache.Add(kvp.Value, createVertex()));
                    }

                    var vertex = SafetyTools.SafeEval(() => _cache[kvp.Value], createVertex);
                    yield return new Edge(kvp.Key, source, vertex);
                }
            }
        }
示例#3
0
 public bool IsValid(Vertex v)
 {
     return !Logic(v, Graph).IsEmpty();
 }
示例#4
0
 public Edge OutEdge(Vertex v, int index)
 {
     return(_impl.OutEdge(v, index));
 }
示例#5
0
 public bool TryGetOutEdges(Vertex v, out IEnumerable <Edge> edges)
 {
     return(_impl.TryGetOutEdges(v, out edges));
 }
示例#6
0
 public IEnumerable <Edge> OutEdges(Vertex v)
 {
     return(_impl.OutEdges(v));
 }
示例#7
0
 public int OutDegree(Vertex v)
 {
     return(_impl.OutDegree(v));
 }
示例#8
0
 public bool IsOutEdgesEmpty(Vertex v)
 {
     return(_impl.IsOutEdgesEmpty(v));
 }
示例#9
0
 public bool ContainsVertex(Vertex vertex)
 {
     return(_impl.ContainsVertex(vertex));
 }
示例#10
0
 public bool IsValid(Vertex v)
 {
     return !Logic(v.Object).IsEmpty();
 }