summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArafat <arafat.da.khan@gmail.com>2016-01-05 23:27:29 +0530
committerArafat <arafat.da.khan@gmail.com>2016-01-05 23:27:29 +0530
commit8ac7407649aa481ad4f38138ba444371a46e0770 (patch)
treeff8d4839c67611dbe013ad60f5d5a35cf53b353f
parente0479d2e090ec301de9612330585e9bc8d1f967c (diff)
downloadnetworkx-8ac7407649aa481ad4f38138ba444371a46e0770.tar.gz
Fixes #1736
-rw-r--r--networkx/algorithms/matching.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/networkx/algorithms/matching.py b/networkx/algorithms/matching.py
index afc505e5..6bb064de 100644
--- a/networkx/algorithms/matching.py
+++ b/networkx/algorithms/matching.py
@@ -46,7 +46,7 @@ def maximal_matching(G):
for u,v in G.edges():
# If the edge isn't covered, add it to the matching
# then remove neighborhood of u and v from consideration.
- if u not in nodes and v not in nodes:
+ if u not in nodes and v not in nodes and u!=v:
matching.add((u,v))
nodes.add(u)
nodes.add(v)