Gelly and degree filtering

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Gelly and degree filtering

Daniel Dalek
Hi all,

I have a question related to Gelly and graph filtering and hoping to get some pointers/input. 

Basically I have a bipartite graph prepared for a signal/collect iteration, but want to prune it first to only include target nodes with x or more edges (indegree >= x). To filter on vertex value (or id) it seems straightforward to use subgraph and FilterFunction:

prunedG = graph.subgraph(
new FilterFunction<Vertex<String, String>>() {
public boolean filter(Vertex<String, String> vertex) {
return (vertex.getValue() > 0);
}
}, ...


Modifying this to call something like "return (vertex.getInDegree() >=x)" seemed appropriate but the degree information is in the graph (or available as separate methods when running GatherFunction etc), and not accessible directly from the vertex object inside the filter function.

Any suggestions on how to accomplish this?

Reply | Threaded
Open this post in threaded view
|

Re: Gelly and degree filtering

Nico Kruber
Does Martin's answer to a similar thread help?

https://lists.apache.org/thread.html/
000af2fb17a883b60f4a2359ebbeca42e3160c2167a88995c2ee28c2@
%3Cuser.flink.apache.org%3E

On Monday, 29 May 2017 19:38:20 CEST Martin Junghanns wrote:

> Hi Ali :)
>
> You could compute the degrees beforehand (e.g. using the
> Graph.[in|out|get]degrees()) methods and use the resulting dataset as a
> new vertex dataset. You can now run your vertex-centric computation and
> access the degrees as vertex value.
>
> Cheers,
>
> Martin

On Sunday, 28 May 2017 12:02:52 CEST Daniel Dalek wrote:

> Hi all,
>
> I have a question related to Gelly and graph filtering and hoping to get
> some pointers/input.
>
> Basically I have a bipartite graph prepared for a signal/collect iteration,
> but want to prune it first to only include target nodes with x or more
> edges (indegree >= x). To filter on vertex value (or id) it seems
> straightforward to use subgraph and FilterFunction:
>
> prunedG = graph.subgraph(
> new FilterFunction<Vertex<String, String>>() {
> public boolean filter(Vertex<String, String> vertex) {
> return (vertex.getValue() > 0);
> }
> }, ...
>
>
> Modifying this to call something like "return (vertex.getInDegree() >=x)"
> seemed appropriate but the degree information is in the graph (or available
> as separate methods when running GatherFunction etc), and not accessible
> directly from the vertex object inside the filter function.
>
> Any suggestions on how to accomplish this?


signature.asc (201 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Gelly and degree filtering

Daniel Dalek
Thanks for the suggestions,

Yes I believe Ali is also looking for a more straight forward approach to access the degree of a vertex (i.e without creating a new dataset). 
But Martin and Vasias suggestions will work, so thanks again


On Tue, May 30, 2017 at 10:44 AM, Nico Kruber <[hidden email]> wrote:
Does Martin's answer to a similar thread help?

https://lists.apache.org/thread.html/
000af2fb17a883b60f4a2359ebbeca42e3160c2167a88995c2ee28c2@
%3Cuser.flink.apache.org%3E

On Monday, 29 May 2017 19:38:20 CEST Martin Junghanns wrote:
> Hi Ali :)
>
> You could compute the degrees beforehand (e.g. using the
> Graph.[in|out|get]degrees()) methods and use the resulting dataset as a
> new vertex dataset. You can now run your vertex-centric computation and
> access the degrees as vertex value.
>
> Cheers,
>
> Martin


On Sunday, 28 May 2017 12:02:52 CEST Daniel Dalek wrote:
> Hi all,
>
> I have a question related to Gelly and graph filtering and hoping to get
> some pointers/input.
>
> Basically I have a bipartite graph prepared for a signal/collect iteration,
> but want to prune it first to only include target nodes with x or more
> edges (indegree >= x). To filter on vertex value (or id) it seems
> straightforward to use subgraph and FilterFunction:
>
> prunedG = graph.subgraph(
> new FilterFunction<Vertex<String, String>>() {
> public boolean filter(Vertex<String, String> vertex) {
> return (vertex.getValue() > 0);
> }
> }, ...
>
>
> Modifying this to call something like "return (vertex.getInDegree() >=x)"
> seemed appropriate but the degree information is in the graph (or available
> as separate methods when running GatherFunction etc), and not accessible
> directly from the vertex object inside the filter function.
>
> Any suggestions on how to accomplish this?