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); }
public int FindName(BaseType v) { return(finite_total_order.BijectFromBasetype(v)); }