def weird_log_graph(self, stream):
        weird_log = list(stream)
        print 'Entering weird_log_graph...(%d rows)' % len(weird_log)

        # Here we're just going to capture that something weird
        # happened between two hosts
        weird_pairs = set()
        for row in weird_log:
            weird_pairs.add((row['id.orig_h'], row['id.resp_h']))

        # Okay now make the weird node for each pair
        for pair in weird_pairs:

            # Skip '-' hosts
            if (pair[0] == '-'):
                continue

            # Add the originating host
            self.add_node(pair[0], pair[0], ['host', 'origin'])

            # Add the response host
            self.add_node(pair[1], pair[1], ['host'])

            # Add a weird node
            weird_name = 'weird'+pair[0]+'_'+pair[1]
            self.add_node(weird_name, 'weird', ['weird'])

            # The relationships between the nodes
            self.add_rel(pair[0], weird_name, 'weird')
            self.add_rel(weird_name, pair[1], 'weird')
Build up a graph (nodes and edges from a Bro weird.log)
dataset/ETHPy150Open SuperCowPowers/workbench/workbench/workers/pcap_graph.py/PcapGraph.weird_log_graph