pydevDAG._compare module — pydevDAG 1.0 documentation

### Navigation

- index
- modules |
- next |
- previous |
- pydevDAG 1.0 documentation »
- pydevDAG »
- pydevDAG package »

# pydevDAG._compare module

## pydevDAG._compare

Compare graphs to determine if they represent the same storage configuration.

class `pydevDAG._compare.` `Compare`

  Bases: `object`

  Compare two storage graphs.

  classmethod `is_equivalent`(graph1, graph2, node_match, edge_match)

    Whether these graphs represent equivalent storage configurations.

    Parameters: | graph1 – a graph graph2 – a graph node_match (node * node -> bool) – a function that checks whether nodes are equal edge_match (node * node -> bool) – a function that checks whether edges are equal
    Returns: | True if the graphs are equivalent, otherwise False
    Return type: | bool

class `pydevDAG._compare.` `Differences`

  Bases: `object`

  Find the differences between two graphs, if they exist.

  static `edge_differences`(graph1, graph2, edges_equal)

    Find the edge differences between graph1 and graph2 as a pair of graphs.

    Parameters: | graph1 (DiGraph) – a graph graph2 (DiGraph) – a graph edge_equal (DiGraph * DiGraph -> edge * edge -> bool) – a function that checks if two edges are equal
    Returns: | a pair of graphs, representing graph1 - graph2 and vice-versa
    Return type: | tuple of DiGraph

  classmethod `full_diff`(graph1, graph2, node_equal=<function <lambda> at 0x7fa3c18c17d0>, edge_equal=<function <lambda> at 0x7fa3c18c1848>)

    Return a graph that shows the full difference between graph1 and graph2.

    Parameters: | graph1 (DiGraph) – a graph graph2 (DiGraph) – a graph node_equal (DiGraph * DiGraph -> node * node -> bool) – a function that determines if two nodes are equal edge_equal (DiGraph * DiGraph -> edge * edge -> bool) – a function that determines if two edges are equal
    Returns: | an annotated graph composed of `graph1` and `graph2`
    Return type: | DiGraph

  classmethod `left_diff`(graph1, graph2, node_equal=<function <lambda> at 0x7fa3c18c1938>, edge_equal=<function <lambda> at 0x7fa3c18c19b0>)

    Return a graph of the left difference between graph1 and graph2.

    Parameters: | graph1 (DiGraph) – a graph graph2 (DiGraph) – a graph node_equal (DiGraph * DiGraph -> node * node -> bool) – a function that determines if two nodes are equal edge_equal (DiGraph * DiGraph -> edge * edge -> bool) – a function that determines if two edges are equal
    Returns: | `graph1` with removed nodes marked
    Return type: | DiGraph

  static `node_differences`(graph1, graph2, node_equal)

    Find the differences between graph1 and graph2 as a pair of graphs.

    Parameters: | graph1 (DiGraph) – a graph graph2 (DiGraph) – a graph node_equal (DiGraph * DiGraph -> node * node -> bool) – a function that checks if two nodes are equal
    Returns: | a pair of graphs, representing graph1 - graph2 and vice-versa
    Return type: | tuple of DiGraph

  classmethod `right_diff`(graph1, graph2, node_equal=<function <lambda> at 0x7fa3c18c1aa0>, edge_equal=<function <lambda> at 0x7fa3c18c1b18>)

    Return a graph of the right difference between graph1 and graph2.

    Parameters: | graph1 (DiGraph) – a graph graph2 (DiGraph) – a graph node_equal (DiGraph * DiGraph -> node * node -> bool) – a function that determines if two nodes are equal edge_equal (DiGraph * DiGraph -> edge * edge -> bool) – a function that determines if two edges are equal
    Returns: | `graph2` with added nodes marked
    Return type: | DiGraph

class `pydevDAG._compare.` `Matcher`(keys, ele_type=u'node')

  Bases: `object`

  Class with functions to match graph elements based on selected keys.

  Note that the keys must be at the top-level.

  `get_iso_match`()

    Get match function suitable for use with is_isomorphism method.

    Returns: | a function that checks the equality of two graph elements
    Return type: | ele * ele -> bool

  `get_match`(graph1, graph2)

    Returns a function that checks equality of two graph elements.

    Parameters: | keys – a list of keys whose values must be equal graph1 (DiGraph) – a graph graph2 (DiGraph) – a graph
    Types keys: | list of str
    Returns: | a function that compares two graph elements
    Return type: | ele * ele -> bool

### Navigation

- index
- modules |
- next |
- previous |
- pydevDAG 1.0 documentation »
- pydevDAG »
- pydevDAG package »