How to perform sub pattern matches with neo4j.Apoc?

I have the query:

MATCH (a:vertex {label: 'a'})<-->(b:vertex {label: 'b'})
    MATCH (a)<-->(e:vertex {label: 'e'})
    MATCH (b)<-->(c:vertex {label: 'c'})
    MATCH (b)<-->(e:vertex {label: 'e'})
    MATCH (c)<-->(d:vertex {label: 'd'}) 
    MATCH (d)<-->(e)
    MATCH (d)<-->(a)
    return a,b,c,d,e

And a graph of 50.000 vertices and 10.000.000 edges.
It only has labels a,b,c,d,e,f in total, and I know that this match exists.

I have installed the neo4j.apoc plugin in order to utilize the 8 cores on my machine, and I tried the following query already:


    CALL apoc.periodic.iterate(
    "MATCH (a:vertex {label: 'a'})<-->(b:vertex {label: 'b'})
    MATCH (a)<-->(e:vertex {label: 'e'})
    MATCH (b)<-->(c:vertex {label: 'c'})
    MATCH (b)<-->(e:vertex {label: 'e'})
    MATCH (c)<-->(d:vertex {label: 'd'}) 
    MATCH (d)<-->(e)
    MATCH (d)<-->(a)
    return a,b,c,d,e",
    "return DISTINCT([ID(a),ID(b),ID(c),ID(d),ID(e)]) AS LIST", {batchSize:10000, parallel:true})

This query only utilizes a few of the cores, and it basically never returns the result, it just processes forever. I have been looking at
the function apoc.path.subgraphAll(startNode <id>Node/list, {maxLevel, relationshipFilter, labelFilter, bfs:true, filterStartNode:true, limit:-1}) yield nodes, relationships

But since I am very new to NEO4J and also Apoc of course, I actually don't understand how to fill out these relationships. Is there someone who knows about this stuff and can point me in the right direction?

I have this query plan:

Edit: Obviously this query looks more dense, but still a crazy query plan:

CALL apoc.periodic.iterate(
"MATCH (a:vertex {label:'a'})--(b:vertex {label: 'b'})--(c:vertex {label: 'c'})--(d:vertex {label: 'd'})--(e:vertex {label: 'e'}) WHERE (c)<-->(d) AND (b)--(e) AND (d)--(a) RETURN a,b,c,d,e ",
"return DISTINCT([ID(a),ID(b),ID(c),ID(d),ID(e)]) AS LIST", {batchSize:10000, parallel:true})

Yeah ok, i had just misunderstood cypher, it works now and finishes in 12000 ms with:

MATCH (a:vertex {label:'a'})<-->(b:vertex {label: 'b'})-->(c:vertex {label: 'c'})-->(d:vertex {label: 'd'})-->(e:vertex {label: 'e'}) WHERE (d)-->(a) AND (b)-->(e) AND (d)-->(e)  WITH a,b,c,d,e
MATCH (a)<--(b)<--(c)<--(d)<--(e:vertex {label: 'e'}) WHERE (d)<--(a) AND (b)<--(e) AND (d)<--(e)  WITH a,b,c,d,e
return DISTINCT([ID(a),ID(b),ID(c),ID(d),ID(e)])