예제 #1
0
        virtual public GraphAdjListVertex <NAME> AddVertex(NAME v)
        {
            GraphAdjListVertex <NAME> vv = null;

            // NB: This code is very efficient if the name space
            // is integer, and has been preconstructed. Otherwise,
            // it will truly suck in speed.

            // Add name.
            NameSpace.Add(v);

            // Find bijection v into int domain.
            int iv = NameSpace.BijectFromBasetype(v);

            // Find node from int domain.
            if (iv >= VertexSpace.Length)
            {
                Array.Resize(ref VertexSpace, VertexSpace.Length * 2);
            }
            if (VertexSpace[iv] == null)
            {
                vv              = (GraphAdjListVertex <NAME>)CreateVertex();
                vv.Name         = v;
                vv._Graph       = this;
                VertexSpace[iv] = vv;
            }
            else
            {
                vv = VertexSpace[iv];
            }
            return(vv);
        }
예제 #2
0
 public void AddName(BaseType v)
 {
     finite_total_order.Add(v);
 }