Grapho is an extensible nano framework based on Turbine that allows the user to create directed graphs to do awesome stuff like represent circuits, family trees and pretty much everything that can be modeled using a graph.
It has reached a state of simplicity and is open for you to tinker with it. In it's current implementation Grapho models a circuit where the edges have a direction. I've been thinking about packing it as a gem, adding more functionalities and constraints but honestly, I think it's a lot more fun if it's kept bare bones, accesible and hacky.
Grapho consists of three main classes, Graph, Node and Edge.
Creating a Graph:
a = Graph.newAdding components:
a.add(Node.new(:component_1))
a.add(Node.new(:component_2))Connecting components:
a.node(:component_1).connect_to(a.node(:component_2),"Serie")Deleting Components:
a.delete(a.node(:component_1))Console Serialization:
a.console_serializationInspecting (Works for all classes, returns totals overviews):
a.inspectPrinting components (For this example: ":component_1" will be printed):
# printing out_edges of ":component_1"
puts a.node(:component_1).instance_variable_get(:@out_edges).inspect
# printing in_edges of ":component_1"
puts a.node(:component_1).instance_variable_get(:@in_edges).inspectTo see it working just download the thing and run the test.rb from the command line ("ruby test.rb"). [Gabriel González Mañaná]: http://estilopanda.com [@gabrieldgm]: http://twitter.com/gabrieldgm