# Comparison Functions¶

pybel_tools.comparison.graph_entities_equal(g, h)[source]

Tests that two graphs have the same nodes

Parameters: g (pybel.BELGraph) – A BEL Graph h (pybel.BELGraph) – Another BEL Graph Do the two graphs share the same set of nodes? bool
pybel_tools.comparison.graph_topologically_equal(g, h)[source]

Tests that two graphs are topologically equal, defined by having the same nodes, and same connectivity

Parameters: g (pybel.BELGraph) – A BEL Graph h (pybel.BELGraph) – Another BEL Graph Do the graphs share the same set of nodes, and the same connectivity? bool
pybel_tools.comparison.graph_relations_equal(g, h)[source]

Tests that two graphs are equal, defined by having the same nodes, same connections, and existence of same connection types

Parameters: g (pybel.BELGraph) – A BEL Graph h (pybel.BELGraph) – Another BEL Graph Do the two graphs share the same set of nodes, same connectivity, and types of connections? bool
pybel_tools.comparison.graph_provenance_equal(g, h)[source]

Tests that two graphs are equal, defined by having the same nodes, same connections with same types, and same attributes exactly.

Parameters: g (pybel.BELGraph) – A BEL Graph h (pybel.BELGraph) – Another BEL Graph Do the two graphs share the same set of nodes, same connectivity, types of connections, evidences, and annotations? bool
pybel_tools.comparison.graph_edges_intersection(g, h)[source]

Returns the set of node pairs that appear in both graphs

Parameters: g (pybel.BELGraph) – A BEL Graph h (pybel.BELGraph) – Another BEL Graph The set of edges shared between the two graphs set
pybel_tools.comparison.graph_edges_difference(g, h)[source]

Returns the set of node pairs that appear in g but not h

Parameters: g (pybel.BELGraph) – A BEL Graph h (pybel.BELGraph) – Another BEL Graph The asymmetric difference between the edges in g and h set
pybel_tools.comparison.graph_edges_symmetric_difference(g, h)[source]

Returns the set of edges that appear in only one of g or h

Parameters: g (pybel.BELGraph) – A BEL Graph h (pybel.BELGraph) – Another BEL Graph The symmetric difference between the edges in g and h set