Visual distinction for directed edges

18 views
Skip to first unread message

Martin Cerny

unread,
Jun 29, 2016, 5:04:00 AM6/29/16
to cytoscap...@googlegroups.com
Hi all,
is there a way to visualise directed edges (those where CyEdge.isDirected() returns true) differently than undirected edges? (e.g. show arrows only for directed edges). All visual mappings work with columns and there is AFAIK no "directed" column in the edge table.

Thanks
Martin

Matthias König

unread,
Jun 30, 2016, 4:35:01 AM6/30/16
to cytoscape-discuss
Hi Martin,
you could just create the attribute.

Iterate over all edges and write the CyEdge.isDirected() for the attribute.
Than use the created attribute to set EdgeHeadStyle and EdgeTailStyle (this are not the names in the visual mapping) in the Visual Style.

M

Martin Cerny

unread,
Jun 30, 2016, 6:19:41 AM6/30/16
to cytoscap...@googlegroups.com
Hi,
thanks for the suggestion, I guess this would work programmatically, but it is weird. If the user has no way of distinguishing whether the edges in his network are directed, does it make sense to distinguish directed and undirected edges in code? The fun part is that undirected edges can be visualised as directed (since the visual mapping distinguishes start and end nodes). I intended my plugin to treat directed edges differently than undirected, but if the user cannot see the difference, it does not really make sense.

Thanks
Martin


--
You received this message because you are subscribed to the Google Groups "cytoscape-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cytoscape-disc...@googlegroups.com.
To post to this group, send email to cytoscap...@googlegroups.com.
Visit this group at https://groups.google.com/group/cytoscape-discuss.
For more options, visit https://groups.google.com/d/optout.

Matthias König

unread,
Jun 30, 2016, 4:21:29 PM6/30/16
to cytoscape-discuss
Hi Martin,
a thing to consider is that one normally doesn't have a mix of directed and undirected edges in a graph, i.e. a graph/network is either directed or indirected.
I think most of the algorithms and apps rely on this (for instance things like NetworkAnalyzer or graph traversal).
So you probably only have to find out if the network is direct or undirected and switch your style based on that.
M

srikanth bezawada

unread,
Jul 1, 2016, 9:04:57 AM7/1/16
to cytoscap...@googlegroups.com
Hi all,

Import GalFiltered.gml from the sample files folder of Cytoscape. You can see both directed and undirected edges in the same network.

Thanks,
Srikanth.B.

Matthias König

unread,
Jul 4, 2016, 3:49:23 AM7/4/16
to cytoscape-discuss
Hi Srikanth,

you are right. There are use case where there are mixed edge types, i.e. directed and undirected.
For instance if you have symmetric and assymmetric relations in a graph and want to be able to reason over the graph.
But normally you just use a directed network in this cases and split the undirected in two directed edges. Most of the graph theory is for either directed or undirected graphs, and consequently most of the available algorithms. If you have mixed graphs your graph logic becomes complicated and error prone, because you have to have many if (directed) than expressions in your code. You won't be able to reuse much code.

It is possible to use mixed graphs, but I definitely would not recommend using them for more than visualization.
You can always use a directed network and than display edges without arrows based on their edge type, i.e. define some edge types you display as undirected edges, if it is only about visualization.

Matthias
Reply all
Reply to author
Forward
0 new messages