horizon.tech

Building a Source-Sink Graph Theory Model in Horizon

In this tutorial we'll show you how to implement and visualize classic graph theory problems using Horizon

The 'source-sink' model is used to measure inflows and outflows across a graph. You can imagine a set of nodes to be anything from the generation and load of energy on a utility's transmission grid, to cashflows of a system of bank accounts, or maybe even a software infrastructure handling various requests.

In each of these, the fundamentals are 'source and sink'. A source of income is routed from a checking account through a series of transactions. Each transaction incurs a cost and has a 'capacity'.

It turns out with Horizon you can model and visualize this abstraction, building your own sample graph and setting values, then running simulations via a plugin.

Step 1: Build a graph in a space with points and lines.

You can create a schema where each node represents an 'account' or 'income source' or a 'sink'.

Step 2: Assign schemas with time, capacity and financial costs.

With the nodes and their relationships, where nodes or relationships may have maximum capacities at any given time, you will want to provide a basic 'sink' consisting of monthly costs for varying services and the accounts they're paid out of. The goal is to present over a time step (week, month), an algorithm which will satisfy time requirements while maximizing the total amount of value retained in the graph as a whole (sum of values for all nodes).

Step 3: Set the 'size range' and 'color' attributes on tables

You can set the radius of various points (or the widths of lines) to represent the movement of funds in real time. This way, when values change across the application, you can witness the change in the data visualization.

Step 4: Write a plugin which contains the algorithm and which adjusts per simulation 'tick' the value

Use the plugins or API to capture simulation ticks. Control the timing so that the visualization is readable for a human user, and use algorithms like Min-Cut to determine the 'shortest path' of resources, ensuring that time or money amounts are minimized.

Step 5: Aggregates Dashboard

Add a site in your space contents and style it to represent a dashboard--representing current time, total value in dollars within the system, etc. Make sure the plugin updates the values in the dashboard as the simulation continues.

Step 6 (optional): Make the plugin available to share or to buy

Once your algorithm and use case are clear, you can take the plugin and provide it to others--allowing the plugin to be attached to different graphs in order to cover distinct use cases.

horizon.tech

A low-code platform for data collection, schema management, data visualization, and publishing.

© 2024 - 2025 Yrbia LLC, Delaware. All rights reserved.