1
Vote

bug in Simple tree layout algorithm when graph is empty

description

When you're editing a graph this can be empty. However if you try to layou this empty graph with simple tree layout algoritm you get an exception in method GenerateSpanningTree of source file SimpleTreeLayoutAlgoritm.cs. I fixed changing
vb.Enqueue(VisitedGraph.Vertices.OrderBy(v => VisitedGraph.InDegree(v)).First());
by
        if (VisitedGraph.VertexCount > 0)
        {
            vb.Enqueue(VisitedGraph.Vertices.OrderBy(v => VisitedGraph.InDegree(v)).First());
        }

file attachments

comments