Re: [gephi-dev] A few questions about the Filters API

3 views
Skip to first unread message

Mathieu Bastian

unread,
Oct 4, 2015, 10:53:17 AM10/4/15
to Luiz Ribeiro, geph...@lists.gephi.org


On Thu, Jul 28, 2011 at 2:09 PM, Luiz Ribeiro <luizr...@gmail.com> wrote:
Hi,

I have a few questions about the Filters API:

1) When you apply a NodeAttributeRangeFilter with a given range that
doesn't match any node (or edge, in the case of an
EdgeAttributeRangeFilter), a GraphView which is equal to the original
main graph is returned. Is this a bug or is it expected behavior?

Here's an example code, suppose that all the nodes have the
attributeColumn in the range [0, +inf[ (i.e. strictly positive):

AttributeRangeFilter filter = new
AttributeRangeBuilder.NodeAttributeRangeFilter(attributeColumn);
Query query = filterController.createQuery(filter);
// this shouldn't match any nodes
filter.setRange(new Range(-10, -5));
filterController.filterVisible(query);

That is a bug. It's not something that can be done from the UI as the range is restricted to existing values, so we probably don't deal with that case. Please file a bug on Launchpad.
 

2) I'm a bit unsure of how to create NodeEqualNumberFilters. Here's
what I've been trying so far, with no success:

NodeEqualNumberFilter filter = new
AttributeEqualBuilder.NodeEqualNumberFilter(attributeColumn);
Query query = filterController.createQuery(filter);
filter.setMatch(new Integer(2));

That sounds right. Is the column the same type as the match (i.e. Integer) ?
 

Am I missing something here? I've got NodeEqualStringFilter to work
correctly with a similar setup.

Thanks in advance,
Luiz Ribeiro
_______________________________________________
gephi-dev mailing list
geph...@lists.gephi.org
http://gephi.org/mailman/listinfo/gephi-dev

Mathieu Bastian

unread,
Oct 4, 2015, 11:15:52 AM10/4/15
to Luiz Ribeiro, geph...@lists.gephi.org
Thanks for report, I was able to reproduce the second bug. This is a serious bug, I'll check it out.

Mathieu

On Mon, Aug 8, 2011 at 8:28 PM, Luiz Ribeiro <luizr...@gmail.com> wrote:
On Thu, Aug 4, 2011 at 12:03 AM, Mathieu Bastian
<mathieu...@gmail.com> wrote:
>> 1) When you apply a NodeAttributeRangeFilter with a given range that
>> doesn't match any node (or edge, in the case of an
>> EdgeAttributeRangeFilter), a GraphView which is equal to the original
>> main graph is returned. Is this a bug or is it expected behavior?
>
> That is a bug. It's not something that can be done from the UI as the range
> is restricted to existing values, so we probably don't deal with that case.
> Please file a bug on Launchpad.



>> 2) I'm a bit unsure of how to create NodeEqualNumberFilters. Here's
>> what I've been trying so far, with no success:
>>
>> NodeEqualNumberFilter filter = new
>> AttributeEqualBuilder.NodeEqualNumberFilter(attributeColumn);
>> Query query = filterController.createQuery(filter);
>> filter.setMatch(new Integer(2));
>
> That sounds right. Is the column the same type as the match (i.e. Integer) ?

Yes, it is. Actually, I believe this is a bug too. I tried doing
everything via Gephi's UI: added some nodes to the graph, created an
Integer attribute column and assigned values to the nodes. Whenever I
try filtering the graph with the Attribute Equal Filter on the Filters
UI, I get the same exception that I get with my code:

java.lang.IllegalArgumentException: min, max and value must be the same class
       at org.gephi.filters.api.Range.tribToBounds(Range.java:356)
       at org.gephi.filters.plugin.attribute.AttributeEqualBuilder$EqualNumberFilter.refreshValues(AttributeEqualBuilder.java:390)
       at org.gephi.filters.plugin.attribute.AttributeEqualBuilder$EqualNumberFilter.init(AttributeEqualBuilder.java:337)
       at org.gephi.filters.FilterProcessor.processNodeFilter(FilterProcessor.java:110)
       at org.gephi.filters.FilterProcessor.process(FilterProcessor.java:84)
       at org.gephi.filters.FilterThread.filter(FilterThread.java:128)
[catch] at org.gephi.filters.FilterThread.run(FilterThread.java:99)

I've filed a bug report on Launchpad for this too (Bug #823038). I'll
try to track these bugs down during the next few days.

--Luiz

Reply all
Reply to author
Forward
0 new messages