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);
        }
        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);
        }
Beispiel #3
0
        public void testPathConstruction()
        {
            var _Graph = TinkerGraphFactory.CreateTinkerGraph();

            var _Marko = _Graph.VertexById(1);

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

            var _Pipe2 = new InVertexPipe<UInt64, Int64, String, String, Object,
                                          UInt64, Int64, String, String, Object,
                                          UInt64, Int64, String, String, Object,
                                          UInt64, Int64, String, String, Object>();

            var _Pipe3 = new PropertyPipe<String, Object>(Keys: "name");

            _Pipe3.SetSource(_Pipe2);
            _Pipe2.SetSource(_Pipe1);

            var _MarkoList = new List<IGenericPropertyVertex<UInt64, Int64, String, String, Object,
                                                             UInt64, Int64, String, String, Object,
                                                             UInt64, Int64, String, String, Object,
                                                             UInt64, Int64, String, String, Object>>() { _Marko };

            _Pipe1.SetSource(_MarkoList.GetEnumerator());

            foreach (var _Name in _Pipe3)
            {

                var path = _Pipe3.Path;

                Assert.AreEqual(_Marko,                 path[0]);
                Assert.AreEqual(typeof(IGenericPropertyEdge<UInt64, Int64, String, String, Object,
                                                            UInt64, Int64, String, String, Object,
                                                            UInt64, Int64, String, String, Object,
                                                            UInt64, Int64, String, String, Object>), path[1].GetType());

                Assert.AreEqual(typeof(IGenericPropertyVertex<UInt64, Int64, String, String, Object,
                                                              UInt64, Int64, String, String, Object,
                                                              UInt64, Int64, String, String, Object,
                                                              UInt64, Int64, String, String, Object>), path[2].GetType());

                Assert.AreEqual(typeof(String),         path[3].GetType());

                if (_Name == "vadas")
                {
                    Assert.AreEqual(_Graph.EdgeById(7),     path[1]);
                    Assert.AreEqual(_Graph.VertexById(2), path[2]);
                    Assert.AreEqual("vadas", path[3]);
                }

                else if (_Name == "lop")
                {
                    Assert.AreEqual(_Graph.EdgeById(9),     path[1]);
                    Assert.AreEqual(_Graph.VertexById(3), path[2]);
                    Assert.AreEqual("lop", path[3]);
                }

                else if (_Name == "josh")
                {
                    Assert.AreEqual(_Graph.EdgeById(8),     path[1]);
                    Assert.AreEqual(_Graph.VertexById(4), path[2]);
                    Assert.AreEqual("josh", path[3]);
                }

                else
                    Assert.Fail();

            }
        }