Gist 5986840
✓ Published0🌍 Public
Aamundo
Last edited Jul 12, 2013
Created on Jul 12, 2013
This example demonstrates a minimal Python script that sorts an array of node objects by the `nodename` attribute. It shows how to reorder JSON-structured data before any visualization or further processing occurs. The code defines a small dataset containing two nodes, “foo” and “bar,” and uses the built-in `json` module to print the original and sorted representations. It relies on the standard Python `list.sort` method with a lambda function as the sorting key, directly mutating the `nodes` list and updating the `data` dictionary. The example illustrates a simple preprocessing step common in data-driven visualization workflows.
AI-generated description