def parse(self, data):
<EOL>graph = self._init_graph()<EOL>if len(data) != <NUM_LIT:0>:<EOL><INDENT>if "<STR_LIT>" not in data[<NUM_LIT:0>]:<EOL><INDENT>raise ParserError('<STR_LIT>')<EOL><DEDENT><DEDENT>for node in data:<EOL><INDENT>for link in node['<STR_LIT>']:<EOL><INDENT>cost = (link['<STR_LIT>'] + link['<STR_LIT>']) / <NUM_LIT><EOL>graph.add_edge(node['<STR_LIT:name>'],<EOL>link['<STR_LIT:name>'],<EOL>weight=cost,<EOL>tx_rate=link['<STR_LIT>'],<EOL>rx_rate=link['<STR_LIT>'])<EOL><DEDENT><DEDENT>return graph<EOL>
Converts a BMX6 b6m JSON to a NetworkX Graph object
which is then returned.