<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Georg Heiler on Medium]]></title>
        <description><![CDATA[Stories by Georg Heiler on Medium]]></description>
        <link>https://medium.com/@geoheil?source=rss-801cace710e1------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*kQ02z9s9fiaR95gD.</url>
            <title>Stories by Georg Heiler on Medium</title>
            <link>https://medium.com/@geoheil?source=rss-801cace710e1------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 04:41:02 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@geoheil/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[You are the mean of all your peers]]></title>
            <link>https://medium.com/@geoheil/graph-171dbd5b8de8?source=rss-801cace710e1------2</link>
            <guid isPermaLink="false">https://medium.com/p/171dbd5b8de8</guid>
            <category><![CDATA[apache-spark]]></category>
            <category><![CDATA[cypher]]></category>
            <category><![CDATA[graph]]></category>
            <category><![CDATA[neo4j]]></category>
            <dc:creator><![CDATA[Georg Heiler]]></dc:creator>
            <pubDate>Mon, 04 Dec 2017 07:17:19 GMT</pubDate>
            <atom:updated>2017-12-04T07:17:19.509Z</atom:updated>
            <content:encoded><![CDATA[<p>Identifying fraudsters &amp; terrorists using graph databases ; )</p><p>Let’s look at A graph containing vertices (persons) and edges (interactions, i.e. call or text) which might look like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*YIe1MVTXN9evd5-7Xhux8Q.png" /><figcaption>Graph of social interactions, 1 denotes the bad people we know of.</figcaption></figure><p>Having loaded the graph into a graph database like neo4j allows for easy queries of the social network of a :Person. To check the network for hidden terrorists, I select other nodes which are up to 3 edges away from the original node and calculate the fraudulence as the average of all its neighbours , i.e. their interactions:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ee07db7bf002a0601742541c1b5bcde5/href">https://medium.com/media/ee07db7bf002a0601742541c1b5bcde5/href</a></iframe><p>which will give the following result:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c5d9e1edde5e7714e10d6b706f9c4547/href">https://medium.com/media/c5d9e1edde5e7714e10d6b706f9c4547/href</a></iframe><p>Interestingly, David seems to be the one best connected to the terrorsts/fraudsters.</p><p>When breaking down the fraudulence by type of relationship:call|text as separate features this can easily be achieved by the following code snippet. It might look a bit intimidating, but is used to get a more efficient query plan. Instead of reading the graph twice, a single pass over the data is enough (<a href="https://stackoverflow.com/questions/47617655/neo4j-single-pass-over-graph-but-multiple-matches">https://stackoverflow.com/questions/47617655/neo4j-single-pass-over-graph-but-multiple-matches</a>)</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/808b144c2d67e2a65ed802ccbd96ca4e/href">https://medium.com/media/808b144c2d67e2a65ed802ccbd96ca4e/href</a></iframe><p>which results in:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dqsqS_urDyKPOft55a6RTA.png" /><figcaption>Fraud score per each type of relationship</figcaption></figure><p>The following jupyter notebook outlines how to use python to get a couple more alternate variants of this query (variations of depth and direction) <a href="https://github.com/geoHeil/graph-playground/blob/master/neo4j.ipynb">https://github.com/geoHeil/graph-playground/blob/master/neo4j.ipynb</a> and finally reshape the results.</p><p>For a small graph neo4j is a great tool — but assuming the data is larger a different tool is requried. There, hadoop comes into play. Spark offers some graph computation capabilities on Hadoop. The graphFrames package contains a subset of cypher patterns which ease the adoption of graph tasks in the distributed context of Hadoop.</p><p>The CSV files are read directly into spark. Then, the graphFrames library is used to resolve the cypher pattern.</p><blockquote>NOTE: currently the cypher patterns supported are rather minimal! Also scalability is questionable as the patterns are resolved using JOINS and not using an BSP iterative operator. <a href="https://stackoverflow.com/questions/41351802/partitioning-with-spark-graphframes">https://stackoverflow.com/questions/41351802/partitioning-with-spark-graphframes</a></blockquote><p>For this minimal dataset at least broadcast hash joins can be used (i.e. map side join)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mPddSPer9DSde3lqBB2GvA.png" /><figcaption>Execution plan for resolution of cypher patterns — outlining that plain joins are used</figcaption></figure><p>Also, aggregations need to be performed outside of the graph processing library, i.e. in this case in plain spark:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0d2aeb351dcee95e556f4f7dc451c7dc/href">https://medium.com/media/0d2aeb351dcee95e556f4f7dc451c7dc/href</a></iframe><p>Computing any of the combined queris as before gets a bit laborious as only few cypher patterns are supported out of the box. Here I build the [*1..3]by hand:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/30d657ad6221ab8a1c6bd020f55fe008/href">https://medium.com/media/30d657ad6221ab8a1c6bd020f55fe008/href</a></iframe><p>A lot is happening in the space of distributed graph analytics. Neo4j is pushing spark support within the opencypher project. Recently, <a href="https://github.com/opencypher/cypher-for-apache-spark">https://github.com/opencypher/cypher-for-apache-spark</a> was released — still in the alpha stage it CAPS will bring more comprehensive support for cypher queries on spark.</p><p>All the code can be found on github: <a href="https://github.com/geoHeil/graph-playground">https://github.com/geoHeil/graph-playground</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=171dbd5b8de8" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>