Comparison Functions

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

Tests that two graphs have the same nodes

Parameters:
Returns:

Do the two graphs share the same set of nodes?

Return type:

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:
Returns:

Do the graphs share the same set of nodes, and the same connectivity?

Return type:

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:
Returns:

Do the two graphs share the same set of nodes, same connectivity, and types of connections?

Return type:

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:
Returns:

Do the two graphs share the same set of nodes, same connectivity, types of connections, evidences, and annotations?

Return type:

bool

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

Returns the set of node pairs that appear in both graphs

Parameters:
Returns:

The set of edges shared between the two graphs

Return type:

set

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

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

Parameters:
Returns:

The asymmetric difference between the edges in g and h

Return type:

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:
Returns:

The symmetric difference between the edges in g and h

Return type:

set