Hi Wilfried, thank you for your help. But I still can't get result I want. 
When I run following query without filters:

for d in vDevice filter d.hostname == "lab54unl85AC172"
FOR v,e,p IN 1..10000 any d GRAPH 'linkGraph' OPTIONS { 'uniqueVertices': 
'global', 'uniqueEdges': 'global'} 
return {v:v.hostname, e:e.type, pe: p.edges[*].type, 
pv:p.vertices[*].hostname}

[
  {
    "v": "lab54unl85AC174",
    "e": "cdp",
    "pe": [
      "cdp"
    ],
    "pv": [
      "lab54unl85AC172",
      "lab54unl85AC174"
    ]
  },
  {
    "v": "lab54unl85EXR13",
    "e": "arp",
    "pe": [
      "cdp",
      "arp"
    ],
    "pv": [
      "lab54unl85AC172",
      "lab54unl85AC174",
      "lab54unl85EXR13"
    ]
  },
  {
    "v": "lab54unl85AC173",
    "e": "arp",
    "pe": [
      "cdp",
      "arp",
      "arp"
    ],
    "pv": [
      "lab54unl85AC172",
      "lab54unl85AC174",
      "lab54unl85EXR13",
      "lab54unl85AC173"
    ]
  },
  {
    "v": "lab54unl85AC171",
    "e": "cdp",
    "pe": [
      "cdp",
      "arp",
      "arp",
      "cdp"
    ],
    "pv": [
      "lab54unl85AC172",
      "lab54unl85AC174",
      "lab54unl85EXR13",
      "lab54unl85AC173",
      "lab54unl85AC171"
    ]
  },
  {
    "v": "lab54unl85EXR14",
    "e": "cef",
    "pe": [
      "cdp",
      "arp",
      "cef"
    ],
    "pv": [
      "lab54unl85AC172",
      "lab54unl85AC174",
      "lab54unl85EXR13",
      "lab54unl85EXR14"
    ]
  },
  {
    "v": "lab54unl85H179",
    "e": "cef",
    "pe": [
      "cdp",
      "arp",
      "cef"
    ],
    "pv": [
      "lab54unl85AC172",
      "lab54unl85AC174",
      "lab54unl85EXR13",
      "lab54unl85H179"
    ]
  },
  {
    "v": "lab54unl85AC175",
    "e": "arp",
    "pe": [
      "cdp",
      "arp",
      "arp"
    ],
    "pv": [
      "lab54unl85AC172",
      "lab54unl85AC174",
      "lab54unl85EXR13",
      "lab54unl85AC175"
    ]
  }
]

I can see that traverse visited all vertices using some edges (with 
different types). Now I apply filter you suggest:

for d in vDevice filter d.hostname == "lab54unl85AC172"
FOR v,e,p IN 1..10000 any d GRAPH 'linkGraph' OPTIONS { 'uniqueVertices': 
'global', 'uniqueEdges': 'global'} 
FILTER p.edges[*].type ALL == "cdp" 
return {v:v.hostname, e:e.type, pe: p.edges[*].type, 
pv:p.vertices[*].hostname}

[
  {
    "v": "lab54unl85AC174",
    "e": "cdp",
    "pe": [
      "cdp"
    ],
    "pv": [
      "lab54unl85AC172",
      "lab54unl85AC174"
    ]
  }
]

So the filter took results a filtered out all path where all types are not 
cdp. But this is not correct result. If you look on my graph example 
picture, all vertices (except one lab54unl85H179) are reachable via edges 
with type cdp. If I tried to change uniqueness  from global to path OPTIONS 
{ 'uniqueVertices': 'path', 'uniqueEdges': 'path'} then I got correct 
result but with duplicit vertices.

If I run explain:

Execution plan:
 Id   NodeType                  Est.   Comment
  1   SingletonNode                1   * ROOT
  2   EnumerateCollectionNode   1487     - FOR d IN vDevice   /* full 
collection scan */
  3   CalculationNode           1487       - LET #6 = (d.`hostname` == 
"lab54unl85AC172")   /* simple expression */   /* collections used: d : 
vDevice */
  4   FilterNode                1487       - FILTER #6
  5   TraversalNode                1       - FOR v  /* vertex */, p  /* 
paths */ IN 1..10000  /* min..maxPathDepth */ ANY d /* startnode */  GRAPH 
'linkGraph'
  6   CalculationNode              1       - LET #8 = (p.`edges`[*].`type` 
all == "cdp")   /* simple expression */
  7   FilterNode                   1       - FILTER #8
  8   CalculationNode              1       - LET #10 = v.`hostname`   /* 
attribute expression */
  9   ReturnNode                   1       - RETURN #10

What you mean by "If the FOR statement has a copy of the FILTER 
statements"? 

-- 
You received this message because you are subscribed to the Google Groups 
"ArangoDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to