Skip to content

Commit

Permalink
Remove patterns with outdegree 0
Browse files Browse the repository at this point in the history
  • Loading branch information
beatro0t committed May 26, 2021
1 parent 00ce4ce commit a43e511
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/aws/attacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -1382,7 +1382,10 @@ def compute(self, max_iterations=5):
pruned += db.run(
"MATCH (:Pattern)-[attack:ATTACK|CREATE]->(:Generic) "
"DELETE attack "
"RETURN COUNT(attack) AS pruned"
"WITH COUNT(attack) AS pruned "
"OPTIONAL MATCH (p:Pattern) WHERE NOT EXISTS((p)-[:ATTACK|CREATE]->()) "
"DETACH DELETE p "
"RETURN pruned"
)[0]["pruned"]

db.close()

0 comments on commit a43e511

Please sign in to comment.