SHARE
TWEET

Untitled

a guest Apr 23rd, 2019 75 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class DAG<T>
  2.     {
  3.         public IList<Vertex<T>> Vertices{get; set;}
  4.  
  5.         public DAG()
  6.         {
  7.             Vertices = new List<Vertex<T>>();  
  8.         }
  9.  
  10.         public void AddVertex(Vertex<T> v)
  11.         {
  12.             Vertices.Add(v);
  13.         }
  14.         // Cyclic Graf oluşturmayı engelle
  15.         public bool TryAddEdge(Vertex<T> src, Vertex<T> dest)
  16.         {
  17.             if(dest.IsTraversePossible(src))
  18.             {
  19.                 return false;
  20.             }
  21.             src.OutgoingVertices.Add(dest);
  22.             dest.IncomingVertices.Add(src);
  23.             return true;
  24.         }
  25.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top