def get_bonded_structure(self, structure, decorate=False):
        """
        Obtain a StructureGraph object using this NearNeighbor
        class. Requires the optional dependency networkx
        (pip install networkx).

        Args:
            structure: Structure object.
            decorate (bool): whether to annotate site properties
            with order parameters using neighbors determined by
            this NearNeighbor class

        Returns: a pymatgen.analysis.graphs.BondedStructure object
        """

        # requires optional dependency which is why it's not a top-level import
        from pymatgen.analysis.graphs import StructureGraph

        if decorate:
            # Decorate all sites in the underlying structure
            # with site properties that provides information on the
            # coordination number and coordination pattern based
            # on the (current) structure of this graph.
            order_parameters = [self.get_local_order_parameters(structure, n)
                                for n in range(len(structure))]
            structure.add_site_property('order_parameters', order_parameters)

        sg = StructureGraph.with_local_env_strategy(structure, self)

        return sg
Obtain a StructureGraph object using this NearNeighbor
        class. Requires the optional dependency networkx
        (pip install networkx).

        Args:
            structure: Structure object.
            decorate (bool): whether to annotate site properties
            with order parameters using neighbors determined by
            this NearNeighbor class

        Returns: a pymatgen.analysis.graphs.BondedStructure object