Exemplo n.º 1
0
 public Iterator(ListBasedGraphSE <VertexType, EdgeType> g, int bx)
 {
     _inner     = g;
     basevertex = bx;
     it         = g.data[bx].list.GetEnumerator();
     Reset();
 }
Exemplo n.º 2
0
        //------converters

        public void Convert2anothertype()
        {
            GraphBase <VertexType, EdgeType> ng;// will conatain new graph referance;

            if (g is MatrixBasedGraph <VertexType, EdgeType> )
            {
                ng = new ListBasedGraphSE <VertexType, EdgeType>(VertexCount, g.IsDirected);
            }
            else
            {
                ng = new MatrixBasedGraph <VertexType, EdgeType>(VertexCount, g.IsDirected);
            }
            //objectless functional calls are routed to g object
            for (int i = 0; i < VertexCount; i++)
            {
                for (int j = 0; j < VertexCount; j++)
                {
                    if (EdgeExists(i, j))
                    {
                        ng.AddEdge(i, j, GetEdgeWeight(i, j));
                    }
                }
            }
            g = ng;
            PrepareIterator(0);
        }