You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tinkerpop.apache.org by "Stephen Mallette (Jira)" <ji...@apache.org> on 2023/02/16 13:50:00 UTC
[jira] [Commented] (TINKERPOP-2868) Inconsistent results when querying symmetric path with dedup()
[ https://issues.apache.org/jira/browse/TINKERPOP-2868?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17689769#comment-17689769 ]
Stephen Mallette commented on TINKERPOP-2868:
---------------------------------------------
I think this is a similar issue as TINKERPOP-2869 which is to say that it is expected behavior. Note the profiles:
{code}
gremlin> g.V().inE().dedup().otherV().inE().otherV().as('s1').select('s1').profile()
==>Traversal Metrics
Step Count Traversers Time (ms) % Dur
=============================================================================================================
TinkerGraphStep(vertex,[]) 10 10 0.158 13.59
VertexStep(IN,edge) 50 50 0.075 6.46
DedupGlobalStep(null,null) 50 50 0.040 3.50
EdgeOtherVertexStep 50 50 0.046 4.03
VertexStep(IN,vertex)@[s1] 254 254 0.657 56.42
SelectOneStep(last,s1,null) 254 254 0.186 15.99
>TOTAL - - 1.165 -
gremlin> g.V().as('s1').outE().otherV().outE().dedup().otherV().select('s1').profile()
==>Traversal Metrics
Step Count Traversers Time (ms) % Dur
=============================================================================================================
TinkerGraphStep(vertex,[])@[s1] 10 10 0.110 20.79
VertexStep(OUT,vertex) 50 50 0.084 15.79
VertexStep(OUT,edge) 254 254 0.166 31.37
DedupGlobalStep(null,null) 50 50 0.080 15.03
EdgeOtherVertexStep 50 50 0.043 8.23
SelectOneStep(last,s1,null) 50 50 0.046 8.78
>TOTAL - - 0.532 -
{code}
In the first one you traverse all 50 {{in()}} then {{dedup()}} them to 50 traversers, then get all their {{inE()}} which is 254. In the second you get all 254 first and then {{dedup()}} those.
> Inconsistent results when querying symmetric path with dedup()
> --------------------------------------------------------------
>
> Key: TINKERPOP-2868
> URL: https://issues.apache.org/jira/browse/TINKERPOP-2868
> Project: TinkerPop
> Issue Type: Bug
> Affects Versions: 3.6.1
> Reporter: Yuancheng
> Priority: Major
>
> {code:java}
> g.V().inE().otherV().inE().otherV().as('s1').select('s1').count()
> // result: 254
> g.V().as('s1').outE().otherV().outE().otherV().select('s1').count()
> // result: 254
> g.V().inE().dedup().otherV().inE().otherV().as('s1').select('s1').count()
> // result: 254
> g.V().as('s1').outE().otherV().outE().dedup().otherV().select('s1').count()
> // result: 50 {code}
> {code:java}
> # Dataset
> from gremlin_python import statics from gremlin_python.structure.graph import Graph from gremlin_python.process.graph_traversal import __ from gremlin_python.process.strategies import * from gremlin_python.driver.driver_remote_connection import DriverRemoteConnection from gremlin_python.process.traversal import T from gremlin_python.process.traversal import Cardinalityclass GremlinSchemaInit: id = T.id single = Cardinality.single graph = Graph() g = graph.traversal().withRemote(DriverRemoteConnection('ws://localhost:8182/gremlin','g')) def init_dataset(self): self.g.V().drop().iterate() n1 = self.g.addV('A').property('id', '1').property('p', "node01").next() n2 = self.g.addV('A').property('id', '2').property('p', 'node02').next() n3 = self.g.addV('A').property('id', '3').property('p', 'node03').next() n4 = self.g.addV('A').property('id', '4').property('p', 'node04').next() n5 = self.g.addV('A').property('id', '5').property('p', 'node05').next() n6 = self.g.addV('B').property('id', '6').property('p', 'node06').next() n7 = self.g.addV('B').property('id', '7').property('p', 'node07').next() n8 = self.g.addV('B').property('id', '8').property('p', 'node08').next() n9 = self.g.addV('B').property('id', '9').property('p', 'node09').next() n10 = self.g.addV('B').property('id', '10').property('p', 'node10').next() self.g.addE('X').property('p', 'edge01').from_(n1).to(n2).iterate() self.g.addE('X').property('p', 'edge02').from_(n2).to(n3).iterate() self.g.addE('X').property('p', 'edge03').from_(n3).to(n4).iterate() self.g.addE('X').property('p', 'edge04').from_(n4).to(n5).iterate() self.g.addE('X').property('p', 'edge05').from_(n5).to(n6).iterate() self.g.addE('X').property('p', 'edge06').from_(n6).to(n7).iterate() self.g.addE('X').property('p', 'edge07').from_(n7).to(n8).iterate() self.g.addE('X').property('p', 'edge08').from_(n8).to(n9).iterate() self.g.addE('X').property('p', 'edge09').from_(n9).to(n10).iterate() self.g.addE('X').property('p', 'edge10').from_(n10).to(n1).iterate() self.g.addE('Y').property('p', 'edge11').from_(n2).to(n1).iterate() self.g.addE('Y').property('p', 'edge12').from_(n3).to(n2).iterate() self.g.addE('Y').property('p', 'edge13').from_(n4).to(n3).iterate() self.g.addE('Y').property('p', 'edge14').from_(n5).to(n4).iterate() self.g.addE('Y').property('p', 'edge15').from_(n6).to(n5).iterate() self.g.addE('Y').property('p', 'edge16').from_(n7).to(n6).iterate() self.g.addE('Y').property('p', 'edge17').from_(n8).to(n7).iterate() self.g.addE('Y').property('p', 'edge18').from_(n9).to(n8).iterate() self.g.addE('Y').property('p', 'edge19').from_(n10).to(n9).iterate() self.g.addE('Y').property('p', 'edge20').from_(n1).to(n10).iterate() self.g.addE('X').property('p', 'edge21').from_(n3).to(n9).iterate() self.g.addE('Y').property('p', 'edge22').from_(n6).to(n3).iterate() self.g.addE('Y').property('p', 'edge23').from_(n1).to(n8).iterate() self.g.addE('X').property('p', 'edge24').from_(n2).to(n8).iterate() self.g.addE('Y').property('p', 'edge25').from_(n5).to(n8).iterate() self.g.addE('X').property('p', 'edge26').from_(n7).to(n3).iterate() self.g.addE('Y').property('p', 'edge27').from_(n9).to(n2).iterate() self.g.addE('Y').property('p', 'edge28').from_(n9).to(n6).iterate() self.g.addE('X').property('p', 'edge29').from_(n1).to(n6).iterate() self.g.addE('Y').property('p', 'edge30').from_(n2).to(n1).iterate() self.g.addE('X').property('p', 'edge31').from_(n1).to(n5).iterate() self.g.addE('X').property('p', 'edge32').from_(n2).to(n1).iterate() self.g.addE('X').property('p', 'edge33').from_(n3).to(n5).iterate() self.g.addE('X').property('p', 'edge34').from_(n4).to(n7).iterate() self.g.addE('X').property('p', 'edge35').from_(n5).to(n6).iterate() self.g.addE('X').property('p', 'edge36').from_(n6).to(n5).iterate() self.g.addE('X').property('p', 'edge37').from_(n7).to(n6).iterate() self.g.addE('X').property('p', 'edge38').from_(n8).to(n2).iterate() self.g.addE('X').property('p', 'edge39').from_(n9).to(n7).iterate() self.g.addE('X').property('p', 'edge40').from_(n10).to(n3).iterate() self.g.addE('Y').property('p', 'edge41').from_(n2).to(n1).iterate() self.g.addE('Y').property('p', 'edge42').from_(n8).to(n2).iterate() self.g.addE('Y').property('p', 'edge43').from_(n9).to(n3).iterate() self.g.addE('Y').property('p', 'edge44').from_(n9).to(n4).iterate() self.g.addE('Y').property('p', 'edge45').from_(n2).to(n5).iterate() self.g.addE('Y').property('p', 'edge46').from_(n7).to(n6).iterate() self.g.addE('Y').property('p', 'edge47').from_(n6).to(n7).iterate() self.g.addE('Y').property('p', 'edge48').from_(n3).to(n8).iterate() self.g.addE('Y').property('p', 'edge49').from_(n1).to(n9).iterate() self.g.addE('Y').property('p', 'edge50').from_(n7).to(n10).iterate()test = GremlinSchemaInit() test.init_dataset()
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)