How to create a histogram

Hi Tigers

I like to bin vertices according to the numbers of their one-hop relationship and create histogram with that output. It’s not obvious how to do this most effectively. Any thought or suggestion is much appreciated!

Best,

SH

Hi SH,

I’m not 100% clear on what you’re asking - are you saying you want to link all vertices to a vertex with a number ID which signifies their number of directly connected neighbors?

Thanks,
Kevin

Hi Sh,

You can try this

CREATE QUERY histogram-1-hop() FOR GRAPH test {

 MapAccum<int, int> @@degreeHistogram;

  Start = {any};

  OneStep = SELECT s

                     FROM Start:s

                     ACCUM @@degreeHistogram +=  (s.outdegree() ->1);

 PRINT @@degreeHistogram;

}

thanks,

Mingxi

Hi Mingxi

Thx for the input. I was missing the outdegree attribute. Where is the “outdegree” documented? I’ve looked everywhere on your documentation and I can’t find a section that discusses the “outdegree” attribute. And I can only surmise that there are other attributes that I can use, but again, I can’t find them…

Thanks for your help.

SH Howard

minor correction: outdegree() is a built-in function, not an attribute. And I found it in the gsql_query_v2.2.pdf… Would have been great to have a section on built-in functions under the GSQL Language Reference on the web.

Thx,

SH

good suggestion. we will add doc for this.