示例#1
0
def create_rooms(graph):
    """Convert a graph of netboxes to a graph of rooms.

    graph is assumed to have one nodes representing netboxes.  These
    are combined so that there is one node for each room.  Each room
    node has a property 'netboxes' (available as
    roomnode.properties['netboxes']) which is a list of the original
    nodes it is based on.

    Arguments:

    graph -- a Graph object.  It is destructively modified.

    """
    collapse_nodes(
        graph,
        group(lambda node: node.properties['roomid'], graph.nodes.values()),
        AGGREGATE_PROPERTIES_ROOM)
示例#2
0
def create_rooms(graph):
    """Convert a graph of netboxes to a graph of rooms.

    graph is assumed to have one nodes representing netboxes.  These
    are combined so that there is one node for each room.  Each room
    node has a property 'netboxes' (available as
    roomnode.properties['netboxes']) which is a list of the original
    nodes it is based on.

    Arguments:

    graph -- a Graph object.  It is destructively modified.

    """
    collapse_nodes(graph,
                   group(lambda node: node.properties['roomid'],
                         graph.nodes.values()),
                   AGGREGATE_PROPERTIES_ROOM)