예제 #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();
 }