public GraphEdge addEdge(GraphNode head, GraphNode tail, object data = null) { var edge = new GraphEdge(head, tail, data); head.addEdgeOut(edge); tail.addEdgeIn(edge); this.edges.Add(edge); return(edge); }
public void removeEdge(GraphEdge edge) { var head = edge.getHead(); head.removeEdgeOut(edge); var tail = edge.getTail(); tail.removeEdgeIn(edge); this.edges.Remove(edge); }
public int[,] GetEdgeIndex() { List <GraphEdge> edges = this.g.getEdges(); int[,] edgeIndex = new int[edges.Count, 2]; for (int i = 0; i < edges.Count; i++) { GraphEdge e = edges[i]; int headNodeIndex = GetNodeIndex(e.getHead()); int tailNodeIndex = GetNodeIndex(e.getTail()); edgeIndex[i, 0] = headNodeIndex; edgeIndex[i, 1] = tailNodeIndex; } return(edgeIndex); }
public List <float[]> GetEdges(List <float[]> nodePositions) { List <float[]> lines = new List <float[]>(); int numDims = nodePositions[0].Length * 2; List <GraphEdge> edges = this.g.getEdges(); int[,] edgeIndex = new int[edges.Count, 2]; for (int i = 0; i < edges.Count; i++) { GraphEdge e = edges[i]; float[] headPos = this.g.GetNodePosition(e.getHead()); float[] tailPos = this.g.GetNodePosition(e.getTail()); float[] newLine = new float[numDims]; headPos.CopyTo(newLine, 0); tailPos.CopyTo(newLine, tailPos.Length); lines.Add(newLine); } return(lines); }
public void removeEdgeOut(GraphEdge edge) { eout.Remove(edge); }
public void removeEdgeIn(GraphEdge edge) { ein.Remove(edge); }
public void addEdgeOut(GraphEdge edge) { eout.Add(edge); }
public void addEdgeIn(GraphEdge edge) { ein.Add(edge); }