[SOLVED] Show only bi-directional edges > weight threshold?

Visual manipulations and refinements
Post Reply [phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275: count(): Parameter must be an array or an object that implements Countable
User avatar
MrPok
Posts:18
Joined:08 Jul 2010 11:09
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275: count(): Parameter must be an array or an object that implements Countable
[SOLVED] Show only bi-directional edges > weight threshold?

Post by MrPok » 13 Jul 2010 14:22

(This is a follow-up on a previous topic)
I don't know if the following can be done with the current Filter Library functions, but here goes:

Problem Summary:
From a directed network, I only want to show those bi-directional edges that have weight values above a certain threshold on both directions.

Problem description:
I use fully-connected directed networks for input. All edges are bi-directional (meaning: two edges that connect the same two nodes in opposite direction). Thus, every edge in the network serves as both an incoming as well as an outgoing edge for a node. In my current research, "reciprocation" play an important role, therefore I only want to show edges that have weights above a certain threshold level for both directions, e.g.:
edge(n0,n1)=4, edge(n1,n0)=3.6, threshold=3 --> show edge(n0,1) & edge(n1,n0) , but if
edge(n0,n1)=2, edge(n1,n0)=3.6, threshold=3 --> DON'T show edge(n0,1) & edge(n1,n0) !

I reckon that the filter will at least involve a query Edge Weight, but I can't figure out how to do that for a specific bi-directional edge -- edge(source,target) & edge(target,source).

:?: How to do the above with a Filter (which Filter Library functions?), or what else to do (/develop) to get this required feature?

..
Ideally, I would also like to be able to color or resize those edges that fit the criteria above, so that I can see the total graph and still have an idea of how much reciprocation is in there. Ranking an edge based on it's reciprocation (a boolean: either an edge is reciprocated or not) would be most logical.
So, a side-question is: Can one use a Filter query as input for the creation of a Ranking or Partition?
..


I hope you can find the time to help me out on this one, again much appreciated!

Kind regards,
Paul

-----
I'm not sure whether to post this here in the "How-To and Troubleshooting" section or in the "Plugins, presets and filters" section, because I don't know if it requires any "Extensions and customization". Pls move post if appropriate.

User avatar
mbastian
Gephi Architect
Posts:728
Joined:10 Dec 2009 10:11
Location:San Francisco, CA
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275: count(): Parameter must be an array or an object that implements Countable

Re: How to show only bi-directional edges > weight threshold?

Post by mbastian » 14 Jul 2010 23:20

Thank you for these clear explanations. I think for doing this we need a new Filter. There is unfortunately no tutorial for creating filters plugins, but it is possible by looking at the API documentation and at existing code.

Have a look in the SPI Javadoc to create the infrastructure of the Filter. Then the evaluate method of the edge filter should look like something like this:

Code: Select all

public boolean evaluate(Graph graph, Edge edge) {
   float weight = edge.getWeight();
   Edge mutualEdge = ((DirectedGraph)graph).getEdge(edge.getTarget(), edge.getSource());
   float mutualWeight = mutualEdge.getWeight();
   return range.isInRange(weight) && range.isInRange(mutualWeight);
        }
Ideally, I would also like to be able to color or resize those edges that fit the criteria above, so that I can see the total graph and still have an idea of how much reciprocation is in there. Ranking an edge based on it's reciprocation (a boolean: either an edge is reciprocated or not) would be most logical.
So, a side-question is: Can one use a Filter query as input for the creation of a Ranking or Partition?
If you do the above filter, you can use an interesting filter feature: "Export as true/false column" available from the UI. That would create for each edge a value "true" when the edge pass the filter and "false" otherwise. This column could then be used in Partition to color edges.

Post Reply
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275: count(): Parameter must be an array or an object that implements Countable
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275: count(): Parameter must be an array or an object that implements Countable