From 4b0b76cd3c35a977f2e7bdf16a5fb919c64be88a Mon Sep 17 00:00:00 2001 From: klawil Date: Thu, 10 May 2018 16:51:32 -0700 Subject: [PATCH] Prevent duplicate edges in the resulting graph --- index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 62ac2ef..cea9712 100644 --- a/index.js +++ b/index.js @@ -19,7 +19,9 @@ const mapTupleToString = t => `"${t[0]}" -> "${t[1]}"` parser(input, tuples => { const stream = fs.openSync('callgraph.dot', 'w'); - const callsString = tuples.map(mapTupleToString).join(`\n`) + let calls = tuples.map(mapTupleToString); + calls = calls.filter((call, index) => calls.indexOf(call) === index); + const callsString = calls.join(`\n`) const data = ` digraph test{ overlap=scalexy;