diff --git a/networkx/algorithms/mis.py b/networkx/algorithms/mis.py
index 4b6aab9b6..ad48a5379 100644
--- a/networkx/algorithms/mis.py
+++ b/networkx/algorithms/mis.py
@@ -1,24 +1,26 @@
 # -*- coding: utf-8 -*-
 # $Id: maximalIndependentSet.py 576 2011-03-01 05:50:34Z lleeoo $
-"""
-Algorithm to find a maximal (not maximum) independent set.
-
-"""
 #    Leo Lopes <leo.lopes@monash.edu>
 #    Aric Hagberg <hagberg@lanl.gov>
 #    Dan Schult <dschult@colgate.edu>
 #    Pieter Swart <swart@lanl.gov>
 #    All rights reserved.
 #    BSD license.
+#
+# Authors: Leo Lopes <leo.lopes@monash.edu>
+#          Loïc Séguin-C. <loicseguin@gmail.com>
+"""
+Algorithm to find a maximal (not maximum) independent set.
 
-__author__ = "\n".join(["Leo Lopes <leo.lopes@monash.edu>",
-                        "Loïc Séguin-C. <loicseguin@gmail.com>"])
+"""
+import random
+import networkx as nx
+from networkx.utils import not_implemented_for
 
 __all__ = ['maximal_independent_set']
 
-import random
-import networkx as nx
 
+@not_implemented_for('directed')
 def maximal_independent_set(G, nodes=None):
     """Return a random maximal independent set guaranteed to contain
     a given set of nodes.
@@ -27,10 +29,10 @@ def maximal_independent_set(G, nodes=None):
     of G induced by these nodes contains no edges. A maximal
     independent set is an independent set such that it is not possible
     to add a new node and still get an independent set.
-    
+
     Parameters
     ----------
-    G : NetworkX graph 
+    G : NetworkX graph
 
     nodes : list or iterable
        Nodes that must be part of the independent set. This set of nodes
@@ -38,7 +40,7 @@ def maximal_independent_set(G, nodes=None):
 
     Returns
     -------
-    indep_nodes : list 
+    indep_nodes : list
        List of nodes that are part of a maximal independent set.
 
     Raises
@@ -47,6 +49,9 @@ def maximal_independent_set(G, nodes=None):
        If the nodes in the provided list are not part of the graph or
        do not form an independent set, an exception is raised.
 
+    NetworkXNotImplemented
+        If `G` is directed.
+
     Examples
     --------
     >>> G = nx.path_graph(5)
@@ -54,7 +59,7 @@ def maximal_independent_set(G, nodes=None):
     [4, 0, 2]
     >>> nx.maximal_independent_set(G, [1]) # doctest: +SKIP
     [1, 3]
-    
+
     Notes
     -----
     This algorithm does not solve the maximum independent set problem.
@@ -67,7 +72,7 @@ def maximal_independent_set(G, nodes=None):
     if not nodes.issubset(G):
         raise nx.NetworkXUnfeasible(
                 "%s is not a subset of the nodes of G" % nodes)
-    neighbors = set.union(*[set(G.neighbors(v)) for v in nodes])
+    neighbors = set.union(*[set(G.adj[v]) for v in nodes])
     if set.intersection(neighbors, nodes):
         raise nx.NetworkXUnfeasible(
                 "%s is not an independent set of G" % nodes)
@@ -76,6 +81,5 @@ def maximal_independent_set(G, nodes=None):
     while available_nodes:
         node = random.choice(list(available_nodes))
         indep_nodes.append(node)
-        available_nodes.difference_update(list(G.neighbors(node)) + [node])
+        available_nodes.difference_update(list(G.adj[node]) + [node])
     return indep_nodes
-

maximal_independent_set does not work for DiGraph
Currently [maximal_independent_set](https://github.com/networkx/networkx/blob/d7d906e1d16ef331da0bc1d149953e7532155acc/networkx/algorithms/mis.py#L70) returns the wrong results for a `DiGraph` because it uses the `G.neighbors` method which returns only the successor nodes in a `DiGraph`.  I believe the [all_neighbors](https://github.com/networkx/networkx/blob/13b373bf6938c077d1e61adc60a48cb910a75755/networkx/classes/function.py#L540) function should be used instead to make `maximal_independent_set` work correctly for both graph types.

diff --git a/networkx/algorithms/tests/test_mis.py b/networkx/algorithms/tests/test_mis.py
index 9136e2db7..ba72b20a4 100644
--- a/networkx/algorithms/tests/test_mis.py
+++ b/networkx/algorithms/tests/test_mis.py
@@ -1,10 +1,6 @@
 #!/usr/bin/env python
 # -*- coding: utf-8 -*-
 # $Id: test_maximal_independent_set.py 577 2011-03-01 06:07:53Z lleeoo $
-"""
-Tests for maximal (not maximum) independent sets.
-
-"""
 #    Copyright (C) 2004-2016 by
 #    Leo Lopes <leo.lopes@monash.edu>
 #    Aric Hagberg <hagberg@lanl.gov>
@@ -12,37 +8,42 @@ Tests for maximal (not maximum) independent sets.
 #    Pieter Swart <swart@lanl.gov>
 #    All rights reserved.
 #    BSD license.
+#
+# Author: Leo Lopes <leo.lopes@monash.edu>
+"""
+Tests for maximal (not maximum) independent sets.
 
-__author__ = """Leo Lopes (leo.lopes@monash.edu)"""
+"""
 
 from nose.tools import *
 import networkx as nx
 import random
 
+
 class TestMaximalIndependantSet(object):
     def setup(self):
         self.florentine = nx.Graph()
-        self.florentine.add_edge('Acciaiuoli','Medici')
-        self.florentine.add_edge('Castellani','Peruzzi')
-        self.florentine.add_edge('Castellani','Strozzi')
-        self.florentine.add_edge('Castellani','Barbadori')
-        self.florentine.add_edge('Medici','Barbadori')
-        self.florentine.add_edge('Medici','Ridolfi')
-        self.florentine.add_edge('Medici','Tornabuoni')
-        self.florentine.add_edge('Medici','Albizzi')
-        self.florentine.add_edge('Medici','Salviati')
-        self.florentine.add_edge('Salviati','Pazzi')
-        self.florentine.add_edge('Peruzzi','Strozzi')
-        self.florentine.add_edge('Peruzzi','Bischeri')
-        self.florentine.add_edge('Strozzi','Ridolfi')
-        self.florentine.add_edge('Strozzi','Bischeri')
-        self.florentine.add_edge('Ridolfi','Tornabuoni')
-        self.florentine.add_edge('Tornabuoni','Guadagni')
-        self.florentine.add_edge('Albizzi','Ginori')
-        self.florentine.add_edge('Albizzi','Guadagni')
-        self.florentine.add_edge('Bischeri','Guadagni')
-        self.florentine.add_edge('Guadagni','Lamberteschi')
-        
+        self.florentine.add_edge('Acciaiuoli', 'Medici')
+        self.florentine.add_edge('Castellani', 'Peruzzi')
+        self.florentine.add_edge('Castellani', 'Strozzi')
+        self.florentine.add_edge('Castellani', 'Barbadori')
+        self.florentine.add_edge('Medici', 'Barbadori')
+        self.florentine.add_edge('Medici', 'Ridolfi')
+        self.florentine.add_edge('Medici', 'Tornabuoni')
+        self.florentine.add_edge('Medici', 'Albizzi')
+        self.florentine.add_edge('Medici', 'Salviati')
+        self.florentine.add_edge('Salviati', 'Pazzi')
+        self.florentine.add_edge('Peruzzi', 'Strozzi')
+        self.florentine.add_edge('Peruzzi', 'Bischeri')
+        self.florentine.add_edge('Strozzi', 'Ridolfi')
+        self.florentine.add_edge('Strozzi', 'Bischeri')
+        self.florentine.add_edge('Ridolfi', 'Tornabuoni')
+        self.florentine.add_edge('Tornabuoni', 'Guadagni')
+        self.florentine.add_edge('Albizzi', 'Ginori')
+        self.florentine.add_edge('Albizzi', 'Guadagni')
+        self.florentine.add_edge('Bischeri', 'Guadagni')
+        self.florentine.add_edge('Guadagni', 'Lamberteschi')
+
     def test_K5(self):
         """Maximal independent set: K5"""
         G = nx.complete_graph(5)
@@ -63,19 +64,22 @@ class TestMaximalIndependantSet(object):
         assert_raises(nx.NetworkXUnfeasible,
                       nx.maximal_independent_set, G, ["Salviati", "Pazzi"])
 
+    def test_digraph_exception(self):
+        G = nx.DiGraph([(1, 2), (3, 4)])
+        assert_raises(nx.NetworkXNotImplemented, nx.maximal_independent_set, G)
+
     def test_florentine_family(self):
         G = self.florentine
         indep = nx.maximal_independent_set(G, ["Medici", "Bischeri"])
         assert_equal(sorted(indep),
                      sorted(["Medici", "Bischeri", "Castellani", "Pazzi",
-                      "Ginori", "Lamberteschi"]))
+                             "Ginori", "Lamberteschi"]))
 
     def test_bipartite(self):
         G = nx.complete_bipartite_graph(12, 34)
         indep = nx.maximal_independent_set(G, [4, 5, 9, 10])
         assert_equal(sorted(indep), list(range(12)))
 
-
     def test_random_graphs(self):
         """Generate 50 random graphs of different types and sizes and
         make sure that all sets are independent and maximal."""
@@ -86,4 +90,3 @@ class TestMaximalIndependantSet(object):
             neighbors_of_MIS = set.union(*(set(G.neighbors(v)) for v in IS))
             for v in set(G.nodes()).difference(IS):
                 assert_true(v in neighbors_of_MIS)
-

pip install -e .
parse_log_pytest
requirements.txt
nose pytest
apt-get update apt-get install -y libgdal-dev graphviz
3.6
requirements/default.txt requirements/test.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
attrs==22.2.0
certifi==2021.5.30
decorator==5.1.1
importlib-metadata==4.8.3
iniconfig==1.1.1
-e git+https://github.com/networkx/networkx.git@f1601955df3e0e9c221cfb0460b761d1d00a2eca#egg=networkx
nose==1.3.7
packaging==21.3
pluggy==1.0.0
py==1.11.0
pyparsing==3.1.4
pytest==7.0.1
tomli==1.2.3
typing_extensions==4.1.1
zipp==3.6.0

name: networkx
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2021.5.30=py36h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.3=he6710b0_2
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - pip=21.2.2=py36h06a4308_0
  - python=3.6.13=h12debd9_1
  - readline=8.2=h5eee18b_0
  - setuptools=58.0.4=py36h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - wheel=0.37.1=pyhd3eb1b0_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - attrs==22.2.0
      - decorator==5.1.1
      - importlib-metadata==4.8.3
      - iniconfig==1.1.1
      - nose==1.3.7
      - packaging==21.3
      - pluggy==1.0.0
      - py==1.11.0
      - pyparsing==3.1.4
      - pytest==7.0.1
      - tomli==1.2.3
      - typing-extensions==4.1.1
      - zipp==3.6.0
prefix: /opt/conda/envs/networkx

networkx/algorithms/tests/test_mis.py::TestMaximalIndependantSet::test_digraph_exception
networkx/algorithms/tests/test_mis.py::TestMaximalIndependantSet::test_K5 networkx/algorithms/tests/test_mis.py::TestMaximalIndependantSet::test_K55 networkx/algorithms/tests/test_mis.py::TestMaximalIndependantSet::test_exception networkx/algorithms/tests/test_mis.py::TestMaximalIndependantSet::test_florentine_family networkx/algorithms/tests/test_mis.py::TestMaximalIndependantSet::test_bipartite networkx/algorithms/tests/test_mis.py::TestMaximalIndependantSet::test_random_graphs
networkx/algorithms/mis.py
networkx/algorithms/mis.py