Exemple #1
0
    def pred(self):
        """Graph adjacency object holding the predecessors of each node.

        This object is a read-only dict-like structure with node keys
        and neighbor-dict values.  The neighbor-dict is keyed by neighbor
        to the edge-data-dict.  So `G.pred[2][3]['color'] = 'blue'` sets
        the color of the edge `(3, 2)` to `"blue"`.

        Iterating over G.pred behaves like a dict. Useful idioms include
        `for nbr, datadict in G.pred[n].items():`.  A data-view not provided
        by dicts also exists: `for nbr, foovalue in G.pred[node].data('foo'):`
        A default can be set via a `default` argument to the `data` method.
        """
        return AdjacencyView(self._pred)
Exemple #2
0
    def adj(self):
        """Graph adjacency object holding the neighbors of each node.

        This object is a read-only dict-like structure with node keys
        and neighbor-dict values.  The neighbor-dict is keyed by neighbor
        to the edge-data-dict.  So `G.adj[3][2]['color'] = 'blue'` sets
        the color of the edge `(3, 2)` to `"blue"`.

        Iterating over G.adj behaves like a dict. Useful idioms include
        `for nbr, datadict in G.adj[n].items():`.

        The neighbor information is also provided by subscripting the graph.
        So `for nbr, foovalue in G[node].data('foo', default=1):` works.

        For directed graphs, `G.adj` holds outgoing (successor) info.
        """
        return AdjacencyView(self._succ)
Exemple #3
0
    def succ(self):
        """Graph adjacency object holding the successors of each node.

        This object is a read-only dict-like structure with node keys
        and neighbor-dict values.  The neighbor-dict is keyed by neighbor
        to the edge-data-dict.  So `G.succ[3][2]['color'] = 'blue'` sets
        the color of the edge `(3, 2)` to `"blue"`.

        Iterating over G.succ behaves like a dict. Useful idioms include
        `for nbr, datadict in G.succ[n].items():`.  A data-view not provided
        by dicts also exists: `for nbr, foovalue in G.succ[node].data('foo'):`
        and a default can be set via a `default` argument to the `data` method.

        The neighbor information is also provided by subscripting the graph.
        So `for nbr, foovalue in G[node].data('foo', default=1):` works.

        For directed graphs, `G.adj` is identical to `G.succ`.
        """
        return AdjacencyView(self._succ)
def test_topo_Gadj(topo_compute):
    Gadj = topo_compute[0].adj
    Gadj_test = AdjacencyView({'2_6': {'2_5': {'edge_type': 'stratigraphic'}, '1_4': {'edge_type': 'fault'}, '1_5': {'edge_type': 'fault'}, '1_6': {'edge_type': 'fault'}}, '2_5': {'2_6': {'edge_type': 'stratigraphic'}, '2_4': {'edge_type': 'stratigraphic'}, '1_3': {'edge_type': 'fault'}, '1_4': {'edge_type': 'fault'}}, '2_4': {'2_5': {'edge_type': 'stratigraphic'}, '2_3': {'edge_type': 'stratigraphic'}, '1_3': {'edge_type': 'fault'}, '1_2': {'edge_type': 'fault'}}, '2_3': {'2_4': {'edge_type': 'stratigraphic'}, '2_2': {'edge_type': 'stratigraphic'}, '1_2': {'edge_type': 'fault'}}, '2_2': {'2_3': {'edge_type': 'stratigraphic'}, '1_2': {'edge_type': 'fault'}}, '1_2': {'2_4': {'edge_type': 'fault'}, '2_3': {'edge_type': 'fault'}, '2_2': {'edge_type': 'fault'}, '1_3': {'edge_type': 'stratigraphic'}}, '1_3': {'2_5': {'edge_type': 'fault'}, '2_4': {'edge_type': 'fault'}, '1_2': {'edge_type': 'stratigraphic'}, '1_4': {'edge_type': 'stratigraphic'}}, '1_4': {'2_6': {'edge_type': 'fault'}, '2_5': {'edge_type': 'fault'}, '1_3': {'edge_type': 'stratigraphic'}, '1_5': {'edge_type': 'stratigraphic'}}, '1_5': {'2_6': {'edge_type': 'fault'}, '1_4': {'edge_type': 'stratigraphic'}, '1_6': {'edge_type': 'stratigraphic'}}, '1_6': {'2_6': {'edge_type': 'fault'}, '1_5': {'edge_type': 'stratigraphic'}}})

    assert Gadj == Gadj_test, "Mismatch in G.adj from topology analysis. Could be (a) general topology misclassification; or (b) wrong edge_type classification."
Exemple #5
0
 def pred(self):
     return AdjacencyView(self._pred)
Exemple #6
0
 def adj(self):
     return AdjacencyView(self._succ)