Constructor for MoleculeGraph, using a strategy
        from :Class: `pymatgen.analysis.local_env`.

        :param molecule: Molecule object
        :param strategy: an instance of a
            :Class: `pymatgen.analysis.local_env.NearNeighbors` object
        :param reorder: bool, representing if graph nodes need to be reordered
            following the application of the local_env strategy
        :param extend_structure: If True (default), then a large artificial box
            will be placed around the Molecule, because some strategies assume
            periodic boundary conditions.
        :return: mg, a MoleculeGraph

def with_local_env_strategy(molecule, strategy, reorder=True,
                                extend_structure=True):
        """
        Constructor for MoleculeGraph, using a strategy
        from :Class: `pymatgen.analysis.local_env`.

        :param molecule: Molecule object
        :param strategy: an instance of a
            :Class: `pymatgen.analysis.local_env.NearNeighbors` object
        :param reorder: bool, representing if graph nodes need to be reordered
            following the application of the local_env strategy
        :param extend_structure: If True (default), then a large artificial box
            will be placed around the Molecule, because some strategies assume
            periodic boundary conditions.
        :return: mg, a MoleculeGraph
        """

        mg = MoleculeGraph.with_empty_graph(molecule, name="bonds",
                                            edge_weight_name="weight",
                                            edge_weight_units="")

        # NearNeighbor classes only (generally) work with structures
        # molecules have to be boxed first
        coords = molecule.cart_coords

        if extend_structure:
            a = max(coords[:, 0]) - min(coords[:, 0]) + 100
            b = max(coords[:, 1]) - min(coords[:, 1]) + 100
            c = max(coords[:, 2]) - min(coords[:, 2]) + 100

            molecule = molecule.get_boxed_structure(a, b, c, no_cross=True)

        for n in range(len(molecule)):
            neighbors = strategy.get_nn_info(molecule, n)
            for neighbor in neighbors:

                # all bonds in molecules should not cross
                # (artificial) periodic boundaries
                if not np.array_equal(neighbor['image'], [0, 0, 0]):
                    continue

                # local_env will always try to add two edges
                # for any one bond, one from site u to site v
                # and another form site v to site u: this is
                # harmless, so warn_duplicates=False
                mg.add_edge(from_index=n,
                            to_index=neighbor['site_index'],
                            weight=neighbor['weight'],
                            warn_duplicates=False)

        if reorder:
            # Reverse order of nodes to match with molecule
            n = len(mg.molecule)
            mapping = {i: (n-i) for i in range(n)}
            mapping = {i: (j-1) for i, j in mapping.items()}

            mg.graph = nx.relabel_nodes(mg.graph, mapping)

        duplicates = []
        for edge in mg.graph.edges:
            if edge[2] != 0:
                duplicates.append(edge)

        for duplicate in duplicates:
            mg.graph.remove_edge(duplicate[0], duplicate[1], key=duplicate[2])

        mg.set_node_attributes()
        return mg