networks-science-course

A course on Network Science, including network formation models, structural patterns, and dynamic processes.

This project is maintained by chatox

Practice Session 01: Cytoscape Basics and Advanced

Materials for this session

:warning: Do not simply right-click on the file names below, or you will download an HTML file that will not be readable by Cytoscape. See how to download in the README of the data/ directory.

What you should deliver

What you should deliver is explained at the end of each practice handout. In short, it is a 9-pages report.

Contents of this session

Basic concepts:

  1. About Cytoscape
  2. Importing a network
  3. Editing nodes and edge styles
  4. Performing basic network analysis

Advanced concepts:

  1. Working with large network (Importing, creating subgraphs)
  2. Creating new networks (from a file, in a csv file)

0. About Cytoscape

Cytoscape is an open source software platform for visualizing complex networks and integrating these with any type of attribute data.

1. Importing a network

1.1. Import Zachary’s karate club

Let’s start with a simple case: Zachary’s Karate Club, which captures 34 members of a karate club at a university, with links representing interactions between members outside the club.

Do not use screenshots; use File > Export as image

1.2. Import network of tortoises

Open a graph representing tortoises who shared a burrow in the Nevada desert. It is interesting because desert tortoises are assumed to be solitary animals, and this study based on radio tags showed the extent to which they can sometimes be social. The graph we use is a projection of a bipartite graph of tortoises and burrows.

Note: you can zoom in and zoom out with the mouse scroll wheel, you can also use the panel on the bottom-right of the screen to navigate the graph.

Reminder: do not use screenshots; use File > Export as image

2. How to edit node and edge styles

You do not need to include anything from this part (part 2) in your report.

Reload the Karate Club dataset (karate.gml).

Now you can play with the “Style” panel (top-left, between “Network” and “Filter”). Here are some ideas.

2.1. How to change the style of the entire network

To style the entire networks in different ways:

2.2. How to name nodes

To include in each node its name:

To remove these names:

Note that node names might not be visible in large graphs until you zoom in. This is controlled by the setting under View > Always Show Graphics Details.

2.3. How to change the shape of node

To change the shape of nodes:

2.4. How to change edge width

To change the width of edges:

2.5. How to change the entire layout

Try some layouts (“Layout” menu)

You do not need to include anything from this part (part 2) in your report.

3. Basic network analysis

3.1. Plot degree distributions

Look at the results from the network analysis (you will need to go to View > Show results panel – if it does not show up, try hiding and showing the results panel)

Tip: the user interface of Cytoscape is a bit confusing, as the bottom panel needs to be showing Node Table for the Node Degree Distribution button to work properly.

4. Working with a large network

The Marvel Universe Social Graph contains characters from the Marvel Universe that appear in the same comic number. It contains over half a million edges. It is formatted in the following way:

BLACK PANTHER/T'CHAL<tab>HAWK
BLACK PANTHER/T'CHAL<tab>LOKI [ASGARDIAN]
BLACK PANTHER/T'CHAL<tab>HULK/DR. ROBERT BRUC
SPIDER-MAN/PETER PAR<tab>HULK/DR. ROBERT BRUC
...

4.1. Import this network into Cytoscape

To import it into Cytoscape:

Tip: change the style to “minimal” to see the graph better.

[REPORT] Include this graph in your report.

[REPORT] What are the top 20 nodes with the largest degree?

4.2. Create sub-graphs

[REPORT] Indicate the number of nodes and edges of this sub-graph, it appears on the left panel next to the name of the network.

:warning: Important: by default Cytoscape has a level of detail setting that is similar to the one found in videogames. If the current view contains more than render.nodeLabelThreshold, the node labels are not displayed. You can toggle between full details and reduced details using “View > Always Show Graphics Details”. You can also permanently adjust this by going to “Edit > Preferences”. Depending on the computer, you can set this up to 2000 from the default of 200. Be careful: this will block your computer when dealing with large networks.

5. Creating a network

Now we will practice creating small networks.

5.1. Creating from existing spreadsheets

We will create a network from two spreadsheets. The first one, got-characters.csv, contains the name and house of the characters in the series Game of Thrones by George R. R. Martin. The second one, got-relationships.csv contains relationships between characters.

First we import the edges:

Now we import the node attribute:

Next, style the network:

[REPORT] Include the graph of Game of Thrones.

[REPORT] Select and extract (i.e., File > New Network > From Selected Nodes, All Edges) a graph containing one clique of four or more characters. Indicate which characters are involved, and style the edges so that they show as label the relation between the characters.

[REPORT] Show two examples of a multi-edge in this graph. Indicate which characters are involved. Extract the corresponding (2-nodes) subgraphs.

[REPORT] Describe any observation you can make about how node attribute “house of birth” is distributed in the graph.

5.2. Create a new network in a CSV file

Now, create a network on your own using CSV files, on whatever topic of your choice as long as the network is real. You will need two CSV files: one for the network and one for the attributes. The network should include between 20 and 30 nodes.

Some ideas:

These are only ideas. Be creative.

Tip: to include a legend, you can use the Cytoscape app legend creator.

[REPORT] Describe the graph you created.

[REPORT] Include two tables with the contents of the CSV files you created (not screenshots).

[REPORT] Draw the graph in Cytoscape and include it in your report.

DELIVER (INDIVIDUALLY)

:warning: First of all, read delivering your report on the evaluation guidelines, and check your report against those guidelines before submitting.

Deliver a brief report of at most 9 pages (it can be less!!), in PDF format. Organize your report as follows:

Please be brief, you do not need to write too much; your report can be less than nine pages. A “brief commentary” means one or two paragraphs.

Your report should end with the following text:

I hereby declare that all of the text, tables, and figures in this report were produced by myself.