/// <summary> /// Creating buckets for multi edges and allocating the graph. /// </summary> private void CreateFullLayeredGraph() { totalNodes = this.intGraph.NodeCount; foreach (List <IntEdge> list in database.RegularMultiedges) { int span = 0; bool first = true; foreach (IntEdge e in list) { if (first) { first = false; span = e.LayerSpan * 2; } if (span > 0) { e.LayerEdges = new LayerEdge[span]; for (int i = 0; i < span; i++) { int source = EdgePathsInserter.GetSource(ref totalNodes, e, i); int target = EdgePathsInserter.GetTarget(ref totalNodes, e, i, span); e.LayerEdges[i] = new LayerEdge(source, target, e.CrossingWeight); } LayerInserter.RegisterDontStepOnVertex(this.database, e); } } } this.nLayeredGraph = new ProperLayeredGraph(this.intGraph); }
///// <summary> ///// the entry point of the class ///// </summary> ///// <param name="layeredGraph"></param> ///// <param name="la"></param> ///// <param name="db"></param> static internal void InsertLayers( ref ProperLayeredGraph layeredGraph, ref LayerArrays la, Database db, BasicGraph<Node, IntEdge> intGraphP) { LayerInserter li = new LayerInserter(layeredGraph, la, db, intGraphP); li.InsertLayers(); layeredGraph = li.NLayeredGraph; la = li.Nla.DropEmptyLayers(); }
///// <summary> ///// the entry point of the class ///// </summary> ///// <param name="layeredGraph"></param> ///// <param name="la"></param> ///// <param name="db"></param> static internal void InsertLayers( ref ProperLayeredGraph layeredGraph, ref LayerArrays la, Database db, BasicGraph<Node, IntEdge> intGraphP) { LayerInserter li = new LayerInserter(layeredGraph, la, db, intGraphP); li.InsertLayers(); layeredGraph = li.NLayeredGraph; la = li.Nla.DropEmptyLayers(); }
private void CreateFullLayeredGraph() { int currentVV = this.layeredGraph.NodeCount; foreach (KeyValuePair <IntPair, List <IntEdge> > kv in database.Multiedges) { if (kv.Key.x != kv.Key.y) //not a self edge { List <IntEdge> list = kv.Value; bool first = true; int span = 0; foreach (IntEdge e in list) { if (first) { first = false; span = e.LayerSpan; } else { e.LayerEdges = new LayerEdge[span]; if (span == 1) { e.LayerEdges[0] = new LayerEdge(e.Source, e.Target, e.CrossingWeight); } else { for (int i = 0; i < span; i++) { int source = GetSource(ref currentVV, e, i); int target = GetTarget(ref currentVV, e, i, span); e.LayerEdges[i] = new LayerEdge(source, target, e.CrossingWeight); } } } LayerInserter.RegisterDontStepOnVertex(this.database, e); } } } this.nLayeredGraph = new ProperLayeredGraph(this.intGraph); }