Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New option: Dim edges not directly connected to a clicked node #48

Open
computermacgyver opened this issue Sep 15, 2014 · 2 comments
Open

Comments

@computermacgyver
Copy link
Member

Requested by @Princen in #31

That is, if you have a graph with A-->B, A-->C, and B-->C, and the user clicks on A, you would like nodes A,B,and C to be shown, but only edges A-->B and A-->C to show normally, while edge B-->C would be 'dimmed'

@novastra
Copy link

Thank you for creating a specific issue. It is important in my instance because it will be easier to understand the connections from and to the active node without the links between the 'non-active' nodes.

I tried 2 things :

  • Add a for loop to this line to distinguish direct and undirect edges.
  • Adapt the code here and replace it in function nodeActive(a) as you mentionned in issue 31.

I was unable to get something working in both possibilities. I would like to know which approach is the best?

@computermacgyver
Copy link
Member Author

@Princen wrote:

Can you explain me how can I modify this part of the code to add a condition that would achieve this goal? I tried many modifications but if I understand correctly sigInst.neighbords includes both direct and indirect edges from activeNode (a).

if (a == b.source || a == b.target) sigInst.neighbors[a == b.target ? b.source : b.target] = n;

@Princen I'm not sure what you mean by 'direct' and 'indirect' edges. The code at that point is looping over all edges and building up sigInst.neighbors, which is a list of all the nodes that have an edge with the activeNode (a).

That line could be rewritten more verbosely (but probably clearer) as:

if (a==b.source) {
    sigInst.neighbors[b.target]=n;
} else if (a==b.target) {
    sigInst.neighbors[b.source]=n;
}

The change I think you want (dimming edges not connected to the active node) is more involved. At the moment, all edges are hidden with the line at the interEdges function/loop you are looking at. Then, all nodes are hidden after that. Using the list of nodes sigInst.neighbors, all nodes and edges connected to them are shown later.

Changing this requires a bit of a rewrite. A list of the edges will need to be kept in addition to the notes and used to determine the dim/not dim status when the edges are redisplayed. The code that undoes this when a node is deselected will also have to be rewritten I suspect. I don't have time to write this at the moment but should hopefully be able to look at in later in the month.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants