Home / Companies / Neo4j / Blog / Post Details
Content Deep Dive

Creating Beauty With Cypher reduce()

Blog post from Neo4j

Post Details
Company
Date Published
Author
Christoffer Bergman
Word Count
1,549
Company Posts That Month
16
Language
English
Hacker News Points
-
Post removed?
No
Summary

The author of the blog post is attempting to generate a Mandelbrot fractal using Cypher, a query language for graph databases. The fractal is represented as an ASCII art image, where each pixel is assigned a color based on the number of iterations it takes for the corresponding point in the fractal to "escape". The author uses the `reduce()` function in Cypher to iterate over the pixels and perform the Mandelbrot calculation. The `reduce()` function is used to aggregate values from an iterable, in this case, a list of objects representing the pixels. The function iterates 100 times for each pixel, updating the values of `zx` and `zy` according to the Mandelbrot equation, and assigns an ASCII character based on the number of iterations. The final result is a string representation of the fractal, where each character corresponds to a specific color in the image. The author's goal was to test implementing an iterative algorithm in a declarative language like Cypher, and they successfully demonstrated the power of the `reduce()` function in this context.

Trends Found in this Post

No tracked trend matches for this post yet.

Use This Data

Use this post, company, and trend context to find content marketing opportunities, perform competitive analysis, or address product feature gaps via the Plushcap MCP server or the Plushcap API.