<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Graph edge weight SPL query in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/Graph-edge-weight-SPL-query/m-p/157417#M9701</link>
    <description>&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;...your search...
| eval edges=x.",".y 
| makemv delim="," edges 
| eval edgessorted=mvjoin(mvsort(edges),",") 
| stats sum(weight) as weight by edgessorted 
| rex field=edgessorted "(?&amp;lt;x&amp;gt;.*),(?&amp;lt;y&amp;gt;.*)" 
| table x y weight
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The trick here is to create a new field (&lt;CODE&gt;edges&lt;/CODE&gt;) that holds both the &lt;CODE&gt;x&lt;/CODE&gt; and &lt;CODE&gt;y&lt;/CODE&gt; values, then use multivalue field functions to sort them so that the edges appear in the same order. Once you've done that you can sum the weights, and lastly get the &lt;CODE&gt;x&lt;/CODE&gt; and &lt;CODE&gt;y&lt;/CODE&gt; values back out.&lt;/P&gt;</description>
    <pubDate>Fri, 12 Dec 2014 14:43:33 GMT</pubDate>
    <dc:creator>aweitzman</dc:creator>
    <dc:date>2014-12-12T14:43:33Z</dc:date>
    <item>
      <title>Graph edge weight SPL query</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Graph-edge-weight-SPL-query/m-p/157416#M9700</link>
      <description>&lt;P&gt;I could not figure out the proper title, so kindly bear with me. The query results in edge lengths of a Graph.&lt;/P&gt;

&lt;P&gt;I have output of a query like this:&lt;/P&gt;

&lt;H2&gt;x      y      weight&lt;/H2&gt;

&lt;P&gt;a      b       10&lt;BR /&gt;
b      a       15&lt;BR /&gt;
a      c       12&lt;BR /&gt;
c      a       15&lt;/P&gt;

&lt;P&gt;I want to get desired output like:&lt;/P&gt;

&lt;H2&gt;x      y      weight&lt;/H2&gt;

&lt;P&gt;a      b       25&lt;BR /&gt;
a      c       27&lt;/P&gt;

&lt;P&gt;Any ideas?&lt;/P&gt;</description>
      <pubDate>Fri, 12 Dec 2014 12:45:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Graph-edge-weight-SPL-query/m-p/157416#M9700</guid>
      <dc:creator>mohitab</dc:creator>
      <dc:date>2014-12-12T12:45:55Z</dc:date>
    </item>
    <item>
      <title>Re: Graph edge weight SPL query</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Graph-edge-weight-SPL-query/m-p/157417#M9701</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;...your search...
| eval edges=x.",".y 
| makemv delim="," edges 
| eval edgessorted=mvjoin(mvsort(edges),",") 
| stats sum(weight) as weight by edgessorted 
| rex field=edgessorted "(?&amp;lt;x&amp;gt;.*),(?&amp;lt;y&amp;gt;.*)" 
| table x y weight
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The trick here is to create a new field (&lt;CODE&gt;edges&lt;/CODE&gt;) that holds both the &lt;CODE&gt;x&lt;/CODE&gt; and &lt;CODE&gt;y&lt;/CODE&gt; values, then use multivalue field functions to sort them so that the edges appear in the same order. Once you've done that you can sum the weights, and lastly get the &lt;CODE&gt;x&lt;/CODE&gt; and &lt;CODE&gt;y&lt;/CODE&gt; values back out.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Dec 2014 14:43:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Graph-edge-weight-SPL-query/m-p/157417#M9701</guid>
      <dc:creator>aweitzman</dc:creator>
      <dc:date>2014-12-12T14:43:33Z</dc:date>
    </item>
  </channel>
</rss>

