Пример #1
0
 /// <summary>
 /// Adds Aresta into Grafo
 /// </summary>
 /// <param name="a">TODO</param>
 /// <returns></returns>
 public bool RemoveAresta(Aresta a)
 {
     if (a.isDirected == isDigraph)
     {
         Arestas.Remove(a);
     }
     return(false);
 }
Пример #2
0
        /// <summary>
        /// Removes an Aresta in adj list
        /// </summary>
        /// <param name="a"></param>
        public void remove_adj(Aresta a)
        {
            var v1_id = a.vertice1._id;
            var v2_id = a.vertice2._id;

            if (Adj[v1_id].Contains(v2_id))
            {
                Adj[v1_id].Remove(v2_id);
            }
            if (Adj[v2_id].Contains(v1_id))
            {
                Adj[v2_id].Remove(v1_id);
            }
        }
Пример #3
0
        /// <summary>
        /// Adds Aresta into Grafo
        /// </summary>
        /// <param name="a"></param>
        /// <returns></returns>
        public bool AddAresta(Aresta a)
        {
            if (a.isDirected == isDigraph)
            {
                if (!Vertices.Contains(a.vertice1))
                {
                    Vertices.Add(a.vertice1);
                }

                if (!Vertices.Contains(a.vertice2))
                {
                    Vertices.Add(a.vertice2);
                }

                Arestas.Add(a);

                if (a.vertice1._id == a.vertice2._id)
                {
                    isAciclic = false;                                   // no longer aciclic
                }
            }
            return(false);
        }