Ejemplo n.º 1
0
        /**
         * A lazy build of edge container for specified vertex.
         *
         * @param vertex a vertex in this graph.
         *
         * @return an edge container
         */
        protected DirectedEdgeContainer <V, E> getEdgeContainer(V vertex)
        {
            DirectedEdgeContainer <V, E> ec = vertexMapDirected[vertex];

            if (ec == null)
            {
                ec = new DirectedEdgeContainer <V, E> (edgeSetFactory, vertex);
                vertexMapDirected[vertex] = ec;
            }

            return(ec);
        }
Ejemplo n.º 2
0
        /**
         * {@inheritDoc}
         */
        public override E getEdge(V sourceVertex, V targetVertex)
        {
            if (abstractBaseGraph.containsVertex(sourceVertex) &&
                abstractBaseGraph.containsVertex(targetVertex))
            {
                DirectedEdgeContainer <V, E> ec = getEdgeContainer(sourceVertex);

                foreach (E e in ec.outgoing)
                {
                    if (abstractBaseGraph.getEdgeTarget(e).Equals(targetVertex))
                    {
                        return(e);
                    }
                }
            }

            return(default(E));
        }
Ejemplo n.º 3
0
        /**
         * {@inheritDoc}
         */
        public override HashSet <E> getAllEdges(V sourceVertex, V targetVertex)
        {
            List <E> edges = null;

            if (abstractBaseGraph.containsVertex(sourceVertex) &&
                abstractBaseGraph.containsVertex(targetVertex))
            {
                edges = new ArrayUnenforcedSet <E>();

                DirectedEdgeContainer <V, E> ec = getEdgeContainer(sourceVertex);

                foreach (E e in ec.outgoing)
                {
                    if (abstractBaseGraph.getEdgeTarget(e).Equals(targetVertex))
                    {
                        edges.Add(e);
                    }
                }
            }

            return(new HashSet <E>(edges));
        }