// adds a node to the graph public void AddNode(GraphNode node) { Nodes.Add(node); if (node.NodeType == GraphNode.Type.Type2) { ModelsSet.Add(node); } if (node.NodeType == GraphNode.Type.Type1) { VariablesSet.Add(node); } }
IDrawable generate(VariablesSet pars) { //double r1 = pars["Radius1"].Value; //double r2 = pars["Radius2"].Value; //Segment a = new Segment(l, 0, 0, l); //Point p = new Point(2 * l * Math.Cos(angle), 2 * l * Math.Sin(angle)); //Segment b = new Segment(0, 0, p.X, p.Y); Point a = new Point(20, 20); Point b = new Point(20.0000001, 20); return(new PointSet(a, b)); }
// adds a node to the graph public void AddNode(string value, GraphNode.Type type) //for bipartite graph { var t = new GraphNode(value, type); Nodes.Add(t); if (type == GraphNode.Type.Type2) { ModelsSet.Add(t); } if (type == GraphNode.Type.Type1) { VariablesSet.Add(t); } }
IDrawable generate(VariablesSet pars) { double l = pars["Length"].Value; double minX = pars["minX"].Value; double maxX = pars["maxX"].Value; double minY = pars["minY"].Value; double maxY = pars["maxY"].Value; double angle = Math.PI * pars["Angle"].Value / 180; Point a = new Point(l * Math.Cos(angle), l * Math.Sin(angle)); Point b = new Point(minX, minY); Point c = new Point(maxX, maxY); return(new PointSet(a, b, c)); }
IDrawable generate(VariablesSet pars) { double angle1 = Math.PI * pars["Angle1"].Value / 180; double angle2 = Math.PI * pars["Angle2"].Value / 180; double l = pars["Length"].Value; Segment a = new Segment(l * Math.Cos(angle2), 40, 40, l * Math.Sin(angle2)); Point p = new Point(2 * l * Math.Cos(angle1), 2 * l * Math.Sin(angle1)); Segment b = new Segment(40, 40, p.X, p.Y); //Segment b = new Segment(0, -20, 50, -20); //Segment b = new Segment(25, -25, 25, 25); //Segment a = new Segment(new Point(0,0),p ); return(new SegmentSet(a, b)); }
IDrawable generate(VariablesSet pars) { double po = pars["Point"].Value; double le = pars["Length"].Value; //Segment a = new Segment(l, 0, 0, l); //Point p = new Point(2 * l * Math.Cos(angle), 2 * l * Math.Sin(angle)); //Segment b = new Segment(0, 0, p.X, p.Y); Point a = new Point(po, po); Point b = new Point(0, 0); Point c = new Point(le, le); return(new PointSet(a, b, c)); }
IDrawable generate(VariablesSet pars) { double r1 = pars["Radius1"].Value; double r2 = pars["Radius2"].Value; double c1 = pars["Center1"].Value; double c2 = pars["Center2"].Value; //Segment a = new Segment(l, 0, 0, l); //Point p = new Point(2 * l * Math.Cos(angle), 2 * l * Math.Sin(angle)); //Segment b = new Segment(0, 0, p.X, p.Y); Circle a = new Circle(c1, c1, r1); Circle b = new Circle(c2, c2, r2); return(new CircleSet(a, b)); }
IDrawable generate(VariablesSet pars) { double minX1 = pars["minX1"].Value; double maxX1 = pars["maxX1"].Value; double minY1 = pars["minY1"].Value; double maxY1 = pars["maxY1"].Value; double minX2 = pars["minX2"].Value; double maxX2 = pars["maxX2"].Value; double minY2 = pars["minY2"].Value; double maxY2 = pars["maxY2"].Value; double angle = Math.PI * pars["Angle"].Value / 180; //Point a = new Point(l * Math.Cos(angle), l * Math.Sin(angle)); Point b = new Point(minX1, minY1); Point c = new Point(maxX1, maxY1); Point d = new Point(minX2 * Math.Cos(angle), minY2 * Math.Cos(angle)); Point e = new Point(maxX2 * Math.Cos(angle), maxY2 * Math.Cos(angle)); return(new PointSet(b, c, d, e)); }
public bool Remove(string value) { // first remove the node from the nodeset var nodeToRemove = (GraphNode)Nodes.FindByValue(value); if (nodeToRemove == null) { // node wasn't found return(false); } // otherwise, the node was found Nodes.Remove(nodeToRemove); //removing the node from the node of the graph if (nodeToRemove.NodeType == GraphNode.Type.Type2) //removing the same node from modeSet if its type is 'model' { ModelsSet.Remove(nodeToRemove); } if (nodeToRemove.NodeType == GraphNode.Type.Type1)//removing hte same node from varSet if its type is 'variable' { VariablesSet.Remove(nodeToRemove); } // enumerate through each node in the nodeSet, removing edges to this node foreach (GraphNode gnode in Nodes) {//not deleting properly the edges while deleting the node... index is not found properly 27-12-2016...check edge deletion works or not if (gnode.Neighbors.Remove(nodeToRemove)) { Edges.Remove(Edges.FindByNodes(gnode, nodeToRemove)); //YHB: nodeToRemove is 'toNode' in the edge whereas 'fromNode' is a node(here gnode) in whos neighbors contains nodeToRemove } if (nodeToRemove.Neighbors.Contains(gnode)) { Edges.Remove(Edges.FindByNodes(nodeToRemove, gnode)); //added on 27-12-2016 } } return(true); }