/// <summary>
        /// Converts the VisitedGraph to the inner type (which is a mutable graph representation).
        /// Wraps the vertices, converts the edges.
        /// </summary>
        protected void ConvertGraph(IDictionary <TVertex, Size> vertexSizes)
        {
            //creating the graph with the new type
            _graph = new SoftMutableHierarchicalGraph <SugiVertex, SugiEdge>(true);

            var vertexDict = new Dictionary <TVertex, SugiVertex>();

            //wrapping the vertices
            foreach (TVertex v in VisitedGraph.Vertices)
            {
                var size = vertexSizes[v];
                size.Height += Parameters.VerticalGap;
                size.Width  += Parameters.HorizontalGap;
                var wrapped = new SugiVertex(v, size);

                _graph.AddVertex(wrapped);
                vertexDict[v] = wrapped;
            }

            //creating the new edges
            foreach (TEdge e in VisitedGraph.Edges)
            {
                var wrapped = new SugiEdge(e, vertexDict[e.Source], vertexDict[e.Target], _edgePredicate(e));
                _graph.AddEdge(wrapped);
            }
        }
Beispiel #2
0
 public VertexLayer(
     SoftMutableHierarchicalGraph <SugiVertex, SugiEdge> graph,
     int layerIndex,
     IEnumerable <SugiVertex> vertices)
 {
     Graph      = graph;
     LayerIndex = layerIndex;
     AddRange(vertices);
 }