@staticmethod<EOL><INDENT>def parse_dom(dom):<DEDENT>
root = dom.getElementsByTagName("<STR_LIT>")[<NUM_LIT:0>]<EOL>graph = root.getElementsByTagName("<STR_LIT>")[<NUM_LIT:0>]<EOL>name = graph.getAttribute('<STR_LIT:id>')<EOL>g = Graph(name)<EOL>for node in graph.getElementsByTagName("<STR_LIT>"):<EOL><INDENT>n = g.add_node(id=node.getAttribute('<STR_LIT:id>'))<EOL>for attr in node.getElementsByTagName("<STR_LIT:data>"):<EOL><INDENT>if attr.firstChild:<EOL><INDENT>n[attr.getAttribute("<STR_LIT:key>")] = attr.firstChild.data<EOL><DEDENT>else:<EOL><INDENT>n[attr.getAttribute("<STR_LIT:key>")] = "<STR_LIT>"<EOL><DEDENT><DEDENT><DEDENT>for edge in graph.getElementsByTagName("<STR_LIT>"):<EOL><INDENT>source = edge.getAttribute('<STR_LIT:source>')<EOL>dest = edge.getAttribute('<STR_LIT:target>')<EOL>e = g.add_edge_by_id(source, dest)<EOL>for attr in edge.getElementsByTagName("<STR_LIT:data>"):<EOL><INDENT>if attr.firstChild:<EOL><INDENT>e[attr.getAttribute("<STR_LIT:key>")] = attr.firstChild.data<EOL><DEDENT>else:<EOL><INDENT>e[attr.getAttribute("<STR_LIT:key>")] = "<STR_LIT>"<EOL><DEDENT><DEDENT><DEDENT>return g<EOL>
Parse dom into a Graph.

        :param dom: dom as returned by minidom.parse or minidom.parseString
        :return: A Graph representation