Exemple #1
0
        virtual public GraphAdjListEdge <NAME> AddEdge(NAME f, NAME t)
        {
            GraphAdjListVertex <NAME> vf = AddVertex(f);
            GraphAdjListVertex <NAME> vt = AddVertex(t);
            // Create adjacency table entry for (f, t).
            int j = adj.Add(f, t);

            // Create EDGE with from/to.
            if (j >= EdgeSpace.Length)
            {
                Array.Resize(ref EdgeSpace, EdgeSpace.Length * 2);
            }
            if (EdgeSpace[j] == null)
            {
                GraphAdjListEdge <NAME> edge = CreateEdge();
                edge.to      = vt;
                edge.from    = vf;
                EdgeSpace[j] = edge;
                return(edge);
            }
            else
            {
                return(EdgeSpace[j]);
            }
        }
Exemple #2
0
        virtual protected GraphAdjListEdge <NAME> CreateEdge()
        {
            GraphAdjListEdge <NAME> e = (GraphAdjListEdge <NAME>)Activator.CreateInstance(EDGE, true);

            return(e);
        }