Ejemplo n.º 1
0
        public void removeEdge(GraphEdge edge)
        {
            var head = edge.getHead();

            head.removeEdgeOut(edge);

            var tail = edge.getTail();

            tail.removeEdgeIn(edge);

            this.edges.Remove(edge);
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        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);
        }