double GetMaxLabelWidth(IntPair intPair) {
            IEnumerable<Label> multiEdgeLabels = PairLabels(intPair);

            if (multiEdgeLabels.Any())
                return multiEdgeLabels.Max(label => label.Width);
            return 0;
        }
        public static int Compare(IntPair pair0, IntPair pair1) {
            if (pair0 < pair1)
                return 1;
            if (pair0 == pair1)
                return 0;

            return -1;
        }
Exemplo n.º 3
0
        /// <summary>
        /// override the equality
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public override bool Equals(object obj)
        {
            IntPair other = obj as IntPair;

            if (other == null)
            {
                return(false);
            }

            return(x == other.x && y == other.y);
        }
Exemplo n.º 4
0
        public static int Compare(IntPair pair0, IntPair pair1)
        {
            if (pair0 < pair1)
            {
                return(1);
            }
            if (pair0 == pair1)
            {
                return(0);
            }

            return(-1);
        }
        internal void AddFeedbackSet(IEnumerable<IEdge> edges) {
            foreach (IEdge e in edges) {
                IntPair ip = new IntPair(e.Source, e.Target);
                IntPair ipr = new IntPair(e.Target, e.Source);

                //we shuffle reversed edges into the other multiedge
                List<IntEdge> listToShuffle = multiedges[ip];
                foreach (IntEdge er in listToShuffle)
                    er.Revert();

                if (multiedges.ContainsKey(ipr))
                    multiedges[ipr].AddRange(listToShuffle);
                else
                    multiedges[ipr] = listToShuffle;

                multiedges.Remove(ip);
            }
        }
 static IntEdge CreateUpDownConstrainedIntEdge(IntPair intPair) {
     var intEdge = new IntEdge(intPair.x, intPair.y);
     intEdge.Weight = 0;
     //we do not want the edge weight to contribute in to the sum but just take the constraint into account
     intEdge.Separation = 1;
     return intEdge;
 }
 static double SetFlatEdgesLabelsHeightAndPositionts(IntPair pair, double ymax, double dy, Database database) {
     double height = 0;
     List<IntEdge> list = database.GetMultiedge(pair);
     foreach (IntEdge edge in list) {
         height += dy;
         Label label = edge.Edge.Label;
         if (label != null) {
             label.Center = new Point(label.Center.X, ymax + height + label.Height/2);
             height += label.Height;
         }
     }
     return height;
 }
        void CalculateRegionAndInsertJumper(int i) {
            IntPair ip = new IntPair(Up(i), Down(i));
            this.possibleJumperFeasibleIntervals[i] = ip;

            InsertJumper(ip.x, ip.y, i);
        }
Exemplo n.º 9
0
        public int CompareTo(IntPair other)
        {
            var r = x.CompareTo(other.x);

            return(r != 0 ? r : y.CompareTo(other.y));
        }
        internal void RegisterOriginalEdgeInMultiedges(IntEdge edge) {
            IntPair ip = new IntPair(edge.Source, edge.Target);
            List<IntEdge> o;
            if (multiedges.ContainsKey(ip) == false)
                multiedges[ip] = o = new List<IntEdge>();
            else
                o = multiedges[ip];

            o.Add(edge);
        }
        internal List<IntEdge> GetMultiedge(IntPair ip) {
            if (multiedges.ContainsKey(ip))
                return multiedges[ip];

            return new List<IntEdge>();
        }
 internal IntPair GluedIntPair(IntPair p) {
     return new IntPair(NodeToRepr(p.First), NodeToRepr(p.Second));
 }
 IEnumerable<Label> PairLabels(IntPair intPair) {
     return from edge in Database.GetMultiedge(intPair)
            let label = edge.Edge.Label
            where label != null
            select label;
 }
 double GetLabelWeight(IntPair intPair) {
     return Database.GetMultiedge(intPair).Count;
 }
 internal void AddConstraintEdge(IntPair intPair) {
     int source = intPair.First; int target = intPair.Second;
     GetOrCreateNodeInfo(source).AddOutConstrainedEdge(target);
     GetOrCreateNodeInfo(target).AddInConstrainedEdge(source);
 }
 internal void AddEdge(IntPair edge) {
     edgesToKeep.Insert(edge);
     int source = edge.First; int target = edge.Second;
     GetOrCreateNodeInfo(source).AddOutEdge(target);
     GetOrCreateNodeInfo(target).AddInEdge(source);
 }