public void ConnectVertex(Vertex a, Vertex b, int weight) { a.Connect (b, weight); if (VertexConnected != null) VertexConnected (a, b); }
public Edge(Vertex fromv, Vertex tov, int weight) { From = fromv; To = tov; Weight = weight; _marked = false; }
// Messages public void AddVertex(Vertex v) { _vertexes.Add (v); if (VertexAdded != null) VertexAdded (v); }
public void DeleteVertex(Vertex v) { foreach (Graphite.Core.Edge edge in v.Edges()) { DisconnectVertex (v, edge.To); DisconnectVertex (edge.To, v); } if (VertexRemoved != null) VertexRemoved (v); _vertexes.Remove (v); }
// TODO: Refactoring private Vertex buildVertexFromXmlNode(XmlElement vertexElt) { int id; string alias; if (vertexElt.HasAttribute ("id")) id = System.Convert.ToInt32 (vertexElt.Attributes["id"].InnerText); else throw new Exception ("Vertex node does not have ID attribute!"); if (vertexElt.HasAttribute ("shape")) alias = vertexElt.Attributes ["shape"].InnerText; else throw new Exception ("Vertex node does not have Shape attribute!"); System.Xml.XmlNode positionNode = vertexElt.GetElementsByTagName ("position")[0]; Vertex vertex = new Vertex (id, buildPositionFromXmlNode (positionNode)); vertex.VertexShape = Graphite.Shapes.Manager.instance().FromAlias (alias); return vertex; }
public void MoveVertex(Vertex v, Point pt) { v.Position = pt; if (LayoutUpdated != null) LayoutUpdated (); }
public void DisconnectVertex(Vertex a, Vertex b) { a.Disconnect (b); if (VertexDisconnected != null) VertexDisconnected (a, b); }
public bool Connected(Vertex v) { return To == v; }
public void Disconnect(Vertex v) { Edge e = _edges.First (x => x.Connected (v)); _edges.Remove (e); }
public bool Connected(Vertex v) { return _edges.Any (x => x.Connected (v)); }
public void Connect(Vertex v, int weight = 0) { if (!Connected (v)) _edges.Add (new Edge (this, v, weight)); }