[SOLVED] Confused about Filters - Bipartite Graph

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
psychemedia
Posts:18
Joined:15 Apr 2010 17:50
[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] Confused about Filters - Bipartite Graph

Post by psychemedia » 15 Apr 2010 18:14

Hi

I'm new to SNA and was hoping to bootstrap my learning through visual exploration of networks using Gephi.

As a regular blogger, I'm happy to post mini-tutorials about how to use Gephi, so if you can give me occasional pointers and answers to my naive questions, I may be able to help with your Getting Started and tutorial writing efforts!

So - to start:

I have a bipartite graph (user IDs and comment IDs) relating to users who viewed comments in a forum. I popped the data into a directed format (user->comment) and also assigned a typ attribute ("comment" or "user") for each node in a gdf file.

What I would like to do is create a network view that shows, for example, comments with more than 10 viewers (eg in-degree > 10, typ partition "comment") that have been viewed by people who have viewed more than 15 comments (out-degree > 15, typ partition "user"). How do I define a query to do this?

As well as the nodes, I want to see any edges that connect the displayed nodes (ie i want to see edges that connect users who've viewed lots of comments with the popular comments they've viewed).

I was also wondering whether it's possible to use gephi to get a unipartite projection of a bipartite graph. eg in the above case, can i get a projection that shows edges directly connecting two users who have viewed the same comment, or comments directly connected by edges if the same person viewed them?

thanks
tony
ps i'm really struggling to generate preview views of graphs, though the graph window gives me a view over the network. I'm missing something somewhere? Just clicking Refresh in the Preview Settings window does nothing - what else do i need to do in order to generate a preview view (fyi, i'm using gephi on a Macbook pro, os/x 10.5.8; whilst i can zoom in and out with two fingers on the trackpad, i haven't found a trick that emulates the right button pan?)

admin
Gephi Community Manager
Posts:964
Joined:09 Dec 2009 14:41
[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: Confused about Filters - Bipartite Graph

Post by admin » 15 Apr 2010 21:13

Hi,
psychemedia wrote: I have a bipartite graph (user IDs and comment IDs) relating to users who viewed comments in a forum. I popped the data into a directed format (user->comment) and also assigned a typ attribute ("comment" or "user") for each node in a gdf file.

What I would like to do is create a network view that shows, for example, comments with more than 10 viewers (eg in-degree > 10, typ partition "comment") that have been viewed by people who have viewed more than 15 comments (out-degree > 15, typ partition "user"). How do I define a query to do this?
You have 2 ways to do that:
* Pre-processing the graph by adding the number of viewers as comments' attribute, and number of comments as people's attribute, and directly filtering by attribute.
* Create two filters by attribute, each one select a node type. Then chains each filter to a Topological sub-filter by drag-and-drop an in-degree / out-degree filter from the filter library to the query window.
psychemedia wrote: As well as the nodes, I want to see any edges that connect the displayed nodes (ie i want to see edges that connect users who've viewed lots of comments with the popular comments they've viewed).
This is like the second way above.
psychemedia wrote: I was also wondering whether it's possible to use gephi to get a unipartite projection of a bipartite graph. eg in the above case, can i get a projection that shows edges directly connecting two users who have viewed the same comment, or comments directly connected by edges if the same person viewed them?
It's not possible, you need to create another graph.
psychemedia wrote: i'm really struggling to generate preview views of graphs, though the graph window gives me a view over the network. I'm missing something somewhere? Just clicking Refresh in the Preview Settings window does nothing - what else do i need to do in order to generate a preview view (fyi, i'm using gephi on a Macbook pro, os/x 10.5.8; whilst i can zoom in and out with two fingers on the trackpad, i haven't found a trick that emulates the right button pan?)
Some advanced options in Gephi are only accessible by right-clicking, and only using a trackpad is...a real pain in general I guess. Anyway, the Preview doesn't need right button action. Did you apply a layout first in the Overview tab, before trying to render the graph in Preview?

psychemedia
Posts:18
Joined:15 Apr 2010 17:50
[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: Confused about Filters - Bipartite Graph

Post by psychemedia » 15 Apr 2010 22:49

Create two filters by attribute, each one select a node type. Then chains each filter to a Topological sub-filter by drag-and-drop an in-degree / out-degree filter from the filter library to the query window.
I'm really slow tonight - I don't understand what you mean by this. Any chance of a screenshot? I don't have a good model of how the filters work, and can't find a way of arranging the filter blocks to achieve what I want to do?

What it amounts to is that I don't really have a feel for how the filters work at all; if I get a chance, I'll try to construct a set of worked examples to teach myself how the filtering thing works. eg if filter queries aren't nested, are they independent of each other?

tony

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: Confused about Filters - Bipartite Graph

Post by mbastian » 15 Apr 2010 23:31

Filters basically justs says if a node or an edge pass the filter according to parameters. Therefore the result of a filter is a subgraph - a subset of the complete graph.

The idea of chaining two filters is that you'll apply the result of the first filter as an input of the second filter. That is what you need. The first filter would be the one that filter only node from a particular category. Then, the second filter is the one that counts links and prune the graph with in-degree/out-degree.

To sum up the steps:
1) Create a query with the In-Degree Filter
2) Then expand the query, you should see the "Drag subfilter here"
3) Pick the Attribute > Partition > Comment and drag it there
4) Configure the filters and click "FIlter" button to activate filtering.

Then you can create a second query with Out-Degree.
Attachments
filtering_chain.png
Chain of In-Degree & Partition
filtering_chain.png (3.13KiB)Viewed 5486 times

psychemedia
Posts:18
Joined:15 Apr 2010 17:50
[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: Confused about Filters - Bipartite Graph

Post by psychemedia » 15 Apr 2010 23:41

So the order the filters run is:
- pass the graph through the element rooted on the Query;
- pass the result of this filtering to the subquery;

So the last part of the query to run is the leaf element; and the first part of the query to run is the one rooted on the top level query element?

I can then save a copy of the graph that is output from the query by pushing it into a new workspace, correct? And then I can run a new set of statistics on the new workspace graph and apply new filter options to this new graph using the statistics for this new graph? (Should I also assume that the Export graph option from the file menu exports the graph definition of the graph in the currently selected workspace?)

Re the problems with displaying the preview graph, I've developed a supertstitious behaviour of previewing the graph regularly and often. This seems to work. If i do several steps without previewing, it seems to break for me and not render anything? (I'll have another play tomorrow to see if I can spot the step that appears to break the preview for me.)

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: Confused about Filters - Bipartite Graph

Post by mbastian » 15 Apr 2010 23:54

So the last part of the query to run is the leaf element; and the first part of the query to run is the one rooted on the top level query element?
No, it's the contrary. Make more sense if you think about AND/OR operators.
I can then save a copy of the graph that is output from the query by pushing it into a new workspace, correct? And then I can run a new set of statistics on the new workspace graph and apply new filter options to this new graph using the statistics for this new graph? (Should I also assume that the Export graph option from the file menu exports the graph definition of the graph in the currently selected workspace?)
3 x Yes
Re the problems with displaying the preview graph, I've developed a supertstitious behaviour of previewing the graph regularly and often. This seems to work.
That doesn't make sense to me...but who knows...sometimes things could get wrong on some computer and run perfectly on others. If you find the way to reproduce the bug I'm of course interested.

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