예제 #1
0
 public void AgregarVertice(cVertice vertice)
 {
     if ((vertice != null) && (!ExisteVertice(vertice)))
     {
         if (aVertice != null)
         {
             if (vertice.nombre.CompareTo(aVertice.nombre) < 0)
             {
                 cGrafo aux = new cGrafo(aVertice, aLista, aSiguiente);
                 aVertice   = new cVertice(vertice.nombre);
                 aSiguiente = aux;
             }
             else //Agregar
             {
                 aSiguiente.AgregarVertice(vertice);
             }
         }
         else
         {
             aVertice   = new cVertice(vertice.nombre);
             aLista     = new cLista();
             aSiguiente = new cGrafo();
         }
     }
 }
예제 #2
0
 public cLista(cLista pLista)
 {
     if (pLista != null)
     {
         aElemento = pLista.aElemento;
         aSublista = pLista.aSublista;
         aPeso     = pLista.aPeso;
     }
 }
예제 #3
0
 public void Eliminar(cVertice pElemento)
 {
     if (pElemento != null)
     {
         if (aElemento.Equals(pElemento))
         {
             aElemento = aSublista.Elemento;
             aSublista = aSublista.Sublista;
         }
         else
         {
             aSublista.Eliminar(pElemento);
         }
     }
 }
예제 #4
0
 public void Agregar(cVertice pElemento, int pPeso)
 {
     if (pElemento != null)
     {
         if (aElemento == null)
         {
             aElemento = new cVertice(pElemento.nombre);
             aPeso     = pPeso;
             aSublista = new cLista();
         }
         else
         {
             if (!ExisteElemento(pElemento))
             {
                 aSublista.Agregar(pElemento, pPeso);
             }
         }
     }
 }
예제 #5
0
 public cLista(cVertice pElemento, cLista pSublista, int pPeso)
 {
     aElemento = pElemento;
     aSublista = pSublista;
     aPeso     = pPeso;
 }
예제 #6
0
 //Constructores
 public cLista()
 {
     aElemento = null;
     aSublista = null;
     aPeso     = 0;
 }
예제 #7
0
 public cGrafo(cVertice pVertice, cLista pLista, cGrafo pSiguiente)
 {
     aVertice   = pVertice;
     aLista     = pLista;
     aSiguiente = pSiguiente;
 }
예제 #8
0
 //Constructor
 public cGrafo()
 {
     aVertice   = null;
     aLista     = null;
     aSiguiente = null;
 }