Bus detection equates to finding the highly integrative nodes in a network (graph). The
terminology bus originates from the bus component often found in electronical
hardware. Most other components plug into or communicate via the bus. The bus detection
algorithms are grouped into the
Bus nodes often display high node degrees (number of incoming and outgoing edges) or
other measures of centrality. Currently the only algorithm that is implemented is the
gamma bus detection. It utilizes the degree distribution of
nodes and distinguishes bus nodes by a factor gamma with respect to the median of node
degrees within a graph (or graph slice).
Detecting buses does not change any values or properties within the graph and merely returns the detection results. This is on purpose, as you might provide any groups of nodes that aren’t necessarily siblings in any way.
>>> from ragraph import datasets >>> from ragraph.analysis import bus >>> g = datasets.get("climate_control") >>> bus.gamma(g, leafs=g.leafs, gamma=2.0, names=True) (['Command Distribution', 'Compressor', 'Air Controls'], ['Radiator', 'Engine Fan', 'Heater Core', 'Heater Hoses', 'Condenser', 'Evaporator Case', 'Evaporator Core', 'Accumulator', 'Refrigeration Controls', 'Sensors', 'Actuators', 'Blower Controller', 'Blower Motor'])
Where we can see that we detect three nodes as the bus nodes for
It is up to the user to interpret the results of this analysis! (or any analysis, really 🕵)
Suppose we say we want to incorporate these results in our
we could then do the following:
>>> from ragraph.node import Node >>> g.add_node(Node("system", children=g.leafs)) # Add a root node. >>> bus, nonbus = bus.gamma(g, leafs=g.leafs, gamma=2.0, names=False) >>> for node in bus: ... node.is_bus = True ...
We add a parent
Node here named
"system" to indicate the system
boundary. This is intentional and even required! The
property namely indicates that a Node is a bus within that (sub-)sytem that we just
For instance, you could have a complete hierarchy of nodes and have a local bus node that isn’t highly integrative for your the complete system (all nodes), but does fulfill that role in a sub-system located deeper in your hierarchy.