Repository: incubator-senssoft-distill
Updated Branches:
  refs/heads/master d4f5f00e3 -> c82fe230c


Removed self-loops in sankey results.


Project: http://git-wip-us.apache.org/repos/asf/incubator-senssoft-distill/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-distill/commit/c82fe230
Tree: 
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-distill/tree/c82fe230
Diff: 
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-distill/diff/c82fe230

Branch: refs/heads/master
Commit: c82fe230caccba22fc89414a6721781c4d6910b0
Parents: d4f5f00
Author: msbeard <msbe...@apache.org>
Authored: Mon Aug 7 15:29:11 2017 -0400
Committer: msbeard <msbe...@apache.org>
Committed: Mon Aug 7 15:29:11 2017 -0400

----------------------------------------------------------------------
 distill/algorithms/graphs/graph.py | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-senssoft-distill/blob/c82fe230/distill/algorithms/graphs/graph.py
----------------------------------------------------------------------
diff --git a/distill/algorithms/graphs/graph.py 
b/distill/algorithms/graphs/graph.py
index dc323d7..e5b34bd 100644
--- a/distill/algorithms/graphs/graph.py
+++ b/distill/algorithms/graphs/graph.py
@@ -264,17 +264,18 @@ class GraphAnalytics (object):
                     seqID = '%s->%s' % (nodename1, nodename2)
 
                     # @todo Ensure src and target are not the same (self-loop)
-                    link = {
-                        'sequenceID': seqID,
-                        'sourceName': nodename1,
-                        'targetName': nodename2,
-                        'type': node1['type'],
-                        # 'duration': node1['duration'],
-                        'pathLength': len(node1['path']),
-                        'targetChange': node1['targetChange'],
-                        'typeChange': node1['typeChange']
-                    }
-                    visitedLinks.append(link)
+                    if nodename1 != nodename2:
+                        link = {
+                            'sequenceID': seqID,
+                            'sourceName': nodename1,
+                            'targetName': nodename2,
+                            'type': node1['type'],
+                            # 'duration': node1['duration'],
+                            'pathLength': len(node1['path']),
+                            'targetChange': node1['targetChange'],
+                            'typeChange': node1['typeChange']
+                        }
+                        visitedLinks.append(link)
 
             # How many users visited a sequence at this step
             counts = collections.Counter(k['sequenceID'] for k in visitedLinks 
if k.get('sequenceID'))

Reply via email to