Esempio n. 1
0
        public void testBigGraphWithNoEdges()
        {
            var _Graph = TinkerGraphFactory.CreateTinkerGraph();

            for (var i = 0; i < 100000; i++)
                _Graph.AddVertex();

            var _Vertices = new AllVerticesPipe<UInt64, Int64, String, String, Object,
                                                UInt64, Int64, String, String, Object,
                                                UInt64, Int64, String, String, Object,
                                                UInt64, Int64, String, String, Object>();

            _Vertices.SetSource(new SingleEnumerator<IGenericPropertyGraph<UInt64, Int64, String, String, Object,
                                                                           UInt64, Int64, String, String, Object,
                                                                           UInt64, Int64, String, String, Object,
                                                                           UInt64, Int64, String, String, Object>>(_Graph));

            var _OutEdges = new OutEdgesPipe<UInt64, Int64, String, String, Object,
                                             UInt64, Int64, String, String, Object,
                                             UInt64, Int64, String, String, Object,
                                             UInt64, Int64, String, String, Object>();

            _OutEdges.SetSource(_Vertices);

            var _Counter = 0;
            while (_OutEdges.MoveNext())
                _Counter++;

            Assert.AreEqual(0, _Counter);
        }
Esempio n. 2
0
        public void testOutGoingEdges()
        {
            var _Graph = TinkerGraphFactory.CreateTinkerGraph();
            var _Marko = _Graph.VertexById(1);

            var _VSF   = new OutEdgesPipe<UInt64, Int64, String, String, Object,
                                          UInt64, Int64, String, String, Object,
                                          UInt64, Int64, String, String, Object,
                                          UInt64, Int64, String, String, Object>();

            _VSF.SetSource(new List<IGenericPropertyVertex<UInt64, Int64, String, String, Object,
                                                           UInt64, Int64, String, String, Object,
                                                           UInt64, Int64, String, String, Object,
                                                           UInt64, Int64, String, String, Object>>() { _Marko }.GetEnumerator());

            var _Counter = 0;
            while (_VSF.MoveNext())
            {
                var _E = _VSF.Current;
                Assert.AreEqual(_Marko, _E.OutVertex);
                Assert.IsTrue(_E.InVertex.Id.Equals(2) || _E.InVertex.Id.Equals(3) || _E.InVertex.Id.Equals(4));
                _Counter++;
            }

            Assert.AreEqual(3, _Counter);

            var _Josh = _Graph.VertexById(4);

            _VSF = new OutEdgesPipe<UInt64, Int64, String, String, Object,
                                    UInt64, Int64, String, String, Object,
                                    UInt64, Int64, String, String, Object,
                                    UInt64, Int64, String, String, Object>();

            _VSF.SetSource(new List<IGenericPropertyVertex<UInt64, Int64, String, String, Object,
                                                           UInt64, Int64, String, String, Object,
                                                           UInt64, Int64, String, String, Object,
                                                           UInt64, Int64, String, String, Object>>() { _Josh }.GetEnumerator());

            _Counter = 0;
            while (_VSF.MoveNext())
            {
                var e = _VSF.Current;
                Assert.AreEqual(_Josh, e.OutVertex);
                Assert.IsTrue(e.InVertex.Id.Equals(5) || e.InVertex.Id.Equals(3));
                _Counter++;
            }

            Assert.AreEqual(2, _Counter);

            var _Lop = _Graph.VertexById(3);

            _VSF = new OutEdgesPipe<UInt64, Int64, String, String, Object,
                                    UInt64, Int64, String, String, Object,
                                    UInt64, Int64, String, String, Object,
                                    UInt64, Int64, String, String, Object>();

            _VSF.SetSource(new List<IGenericPropertyVertex<UInt64, Int64, String, String, Object,
                                                           UInt64, Int64, String, String, Object,
                                                           UInt64, Int64, String, String, Object,
                                                           UInt64, Int64, String, String, Object>>() { _Lop }.GetEnumerator());

            _Counter = 0;
            while (_VSF.MoveNext())
            {
                _Counter++;
            }

            Assert.AreEqual(0, _Counter);
        }