Highlight edges
See original GitHub issueHi!
I want to highlight edges after user input via some widgets. For this I defined a CSS class like:
#...
{
"selector": "edge.highlighted",
"css": {
"line-color": "red"
}
},
#....
I then have some widgets for input and also a cell which looks like this:
widget = ipycytoscape.CytoscapeWidget()
widget.set_style(precgraph_jupyterutil.graph_css)
widget.graph.add_graph_from_networkx(some_networkx_graph, directed=True)
btn = widgets.Button(description="apply", icon="check", disabled=False)
def btn_callback(b):
for edge in widget.graph.edges:
classes = set(edge.classes.split(" "))
classes.add("highlighted")
edge.classes = " ".join(classes)
btn.on_click(callback=btn_callback)
display(btn)
widget
However I cannot get the graph to update interactively. It renders at the beginning as it should, but updating the classes
attribute has no effect. I also cannot find any update
function or similar.
I verified that it works at all by adding another cell after the one posted above with:
widget
If I run this cell I can see the graph with all edges in red (which verifies that the CSS etc works as expected).
What is the intended way to update the visualization? I would really appreciate any help 😃
Issue Analytics
- State:
- Created 3 years ago
- Comments:5
Top Results From Across the Web
Edge Highlighting Is Easier to Learn Than You Think (Tutorial)
Learning how to do edge highlighting can be a bit intimidating. However, it really is easy to learn and I'll show you how...
Read more >Highlight nodes and edges in plotted graph - MATLAB highlight
Isolated nodes with degree 0 are not highlighted. highlight( H , s,t ) highlights all edges between the specified source and target ...
Read more >HighlightEdges - Maple Help - Maplesoft
The command HighlightEdges, marks the specified edges to be rendered with the default highlighted style. •. Given only a graph G and an...
Read more >More highlights - The Army Painter
How to edge highlight · Add a drop of water to your Warpaints. · The key to precise edge highlights is using the...
Read more >Highlight an edge in a graphviz generated svg - gists · GitHub
Highlight an edge in a graphviz generated svg. GitHub Gist: instantly share code, notes, and snippets.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Unfortunately that’s exactly how it’s working. This is what we have for the current code, every time you make a change the whole graph is rerendered. I opened an issue so we could discuss solutions about that #105
Hi @marimeireles, awesome, thank you very much for the quick fix. I installed ipycytoscape via pip, so I think I’ll just wait for the release. Until then the quickfix works.
One question though, does this now trigger a redraw for each changed class? Because I planned to iterate over all edges and adjust the classes, which would be quite wasteful if it would be redrawn in each loop.